Initial commit: Minecraft 光追着色器包(从零实现的 path tracing)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// MinecraftPT — Temporal Noise
|
||||
// Blue noise sampling with temporal interleaving, used for dithering and ray offsets.
|
||||
|
||||
#ifndef TEMPORAL_NOISE_GLSL
|
||||
#define TEMPORAL_NOISE_GLSL
|
||||
|
||||
float BlueNoiseTemporal(){
|
||||
vec2 coord = (gl_FragCoord.xy + 0.5) / screenSize;
|
||||
coord = fract(coord * vec2(128.0, 128.0) + 0.5);
|
||||
vec2 texel = coord * vec2(127.0 / 128.0) + vec2(0.5 / 128.0);
|
||||
float noise = textureLod(noisetex, texel, 0.0).r;
|
||||
return fract(noise + frameCounter * 0.03125);
|
||||
}
|
||||
|
||||
vec2 BlueNoiseTemporal2(){
|
||||
vec2 coord = (gl_FragCoord.xy + 0.5) / screenSize;
|
||||
coord = fract(coord * vec2(128.0, 128.0) + 0.5);
|
||||
vec2 texel = coord * vec2(127.0 / 128.0) + vec2(0.5 / 128.0);
|
||||
vec2 noise = textureLod(noisetex, texel, 0.0).rg;
|
||||
return fract(noise + frameCounter * 0.03125);
|
||||
}
|
||||
|
||||
// Interleaved gradient noise
|
||||
float InterleavedNoise(vec2 pos){
|
||||
vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);
|
||||
return fract(magic.z * fract(dot(pos, magic.xy)));
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user