Skip to content

Instantly share code, notes, and snippets.

@slembcke
Created January 30, 2019 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slembcke/22012a07361e52820423c216a15923ad to your computer and use it in GitHub Desktop.
Save slembcke/22012a07361e52820423c216a15923ad to your computer and use it in GitHub Desktop.
Anisotropic reflections
// 'coord.y' is the clip space y-coordinate of the pixel on the water.
// 'ray0.y/ray0.w' is the clip space y-coordinate of the reflected pixel.
// The basic idea is near the horizion where the reflected point is close to the water,
// you should have a strong reflection. The further it gets from the horizon the more it should be blurred vertically.
// The result is pretty good. :D
float aniso = _SSRAniso*abs(coord.y - ray0.y/ray0.w);
float2 ddy_uv = max(ddy(uv), float2(0, aniso));
...
float4 color = tex2Dgrad(_CameraColorTexture, uv, ddx(uv), ddy_uv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment