Created
January 30, 2019 03:43
-
-
Save slembcke/22012a07361e52820423c216a15923ad to your computer and use it in GitHub Desktop.
Anisotropic reflections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// '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