Why has my refractive water shader become reflective
So I was making a water shader in unity and well it looked fine in the scene view but as soon as I went into the game view the refraction texture basically flipped up 180 degrees and made it look like the water was reflective. The problem with this is that it breaks the transparency of the shader. Scene View (how it should look): Game View (how it does look): Shader: (I can't post more than 2 images) Part of the shader: float4 Lerp2=lerp(Tex2D2,float4( 0.0, 0.0, 0.0, 0.0 ),_Refraction.xxxx); float4 Subtract0=Lerp2 - _RefractionCorrection.xxxx; float4 Add2=((IN.screenPos.xy/IN.screenPos.w).xyxy) + Subtract0; float4 Tex2D0=tex2D(_GrabTexture,Add2.xy);
Have you tried flipping it back in the shader?
float4 Tex2D0=tex2D(_GrabTexture, float2(Add2.x, 1.0-Add2.y));
This is a shot in the dark. Check the scene output for different rendering path options for the main camera. My distortion shader acted weird for deferred rendering, got no clue why. It got fixed for forward rendering path.
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Entertainment & General News
- Games & eSport