Not really a request, I’m just gonna do it. Cause that’s kinda a standard one.
`varying vec2 vUV;
uniform vec2 textureSize;
uniform sampler2D textureSampler;
void main(){
vec2 unit = vec2(1.0)/textureSize;
float x = ((texture2D(textureSampler, vUV+(unit*vec2(-1.,0.))).r
-texture2D(textureSampler, vUV+(unit*vec2(1.,0.))).r)+1.)*0.5;
float y = ((texture2D(textureSampler, vUV+(unit*vec2(0.,1.))).r
-texture2D(textureSampler, vUV+(unit*vec2(0.,-1.))).r)+1.)*0.5;
#if defined(invertDepth)
gl_FragColor = vec4(x, y, 1.0, 1.0);
#else
gl_FragColor = vec4(1.0-x, y, 1.0, 1.0);
#endif
}`;
Just a really quick question, do we have a way to access the natural size of the sampler texture from the glsl side? So I do not have to include the textureSize Uniform.