diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-01-16 20:17:02 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-01-16 20:22:25 +0300 |
commit | c372113489cbcd072aaba5abe50e6fa125f35cea (patch) | |
tree | da0ff586cca37c9c5518b6402fbe88c7938be323 /source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl | |
parent | 5f569378d2d8c3a9f923afb5b94e68862926922d (diff) |
Eevee: Add macro to sample noise in utilTex.
Avoid future coding error.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl index 88e71a060c5..a0c39c79048 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl @@ -12,7 +12,12 @@ uniform float jitterThreshold; uniform sampler2D depthBuffer; uniform sampler2D sssData; uniform sampler2D sssAlbedo; + +#ifndef UTIL_TEX +#define UTIL_TEX uniform sampler2DArray utilTex; +#define texelfetch_noise_tex(coord) texelFetch(utilTex, ivec3(ivec2(coord) % LUT_SIZE, 2.0), 0) +#endif /* UTIL_TEX */ out vec4 FragColor; @@ -41,7 +46,7 @@ void main(void) vec4 sss_data = texture(sssData, uvs).rgba; float depth_view = get_view_z_from_depth(texture(depthBuffer, uvs).r); - float rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2), 0).r; + float rand = texelfetch_noise_tex(gl_FragCoord.xy).r; #ifdef FIRST_PASS float angle = M_2PI * rand + M_PI_2; vec2 dir = vec2(1.0, 0.0); |