Water Shader Refraction Part
Posted: Sun Nov 12, 2017 4:18 pm
Hello there,
just bought the plugin for unity and im trying a few things around.
At the moment im recreating the water shader from the samples and one part is a bit weird though.
Working refraction: https://imgur.com/a/U5Zx8
Not working refraction: https://imgur.com/a/vyeAh
The first one uses the component mask node but doesnt mask it at all (seen by the xyzw text). This nodesystem works well and i think the refraction looks good.
But as you can see in the second screenshot, which uses the component mask to use only xy, the refraction is not correct anymore. The sample nodesystem uses the same mask (xy) and when you start the sample scene everything is ok.
As soon as you switch the mask node to xyzw and back to xy again the sample scene as well does not work as intended anymore.
The only difference i could find in the generated code is the following:
Mask (xyzw, which is working as intended):
Mask (xy, looks wrong):
Dont know whether or not this is a bug, but if its not, i would appreciate it if you could explain it to me so i can understand how this works.
just bought the plugin for unity and im trying a few things around.
At the moment im recreating the water shader from the samples and one part is a bit weird though.
Working refraction: https://imgur.com/a/U5Zx8
Not working refraction: https://imgur.com/a/vyeAh
The first one uses the component mask node but doesnt mask it at all (seen by the xyzw text). This nodesystem works well and i think the refraction looks good.
But as you can see in the second screenshot, which uses the component mask to use only xy, the refraction is not correct anymore. The sample nodesystem uses the same mask (xy) and when you start the sample scene everything is ok.
As soon as you switch the mask node to xyzw and back to xy again the sample scene as well does not work as intended anymore.
The only difference i could find in the generated code is the following:
Mask (xyzw, which is working as intended):
- Code: Select all
float4 screenColor17 = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD( ( (ase_screenPos26).xyzw + float4( ( _Distortion * temp_output_15_0 ) , 0.0 ) ) ) );
Mask (xy, looks wrong):
- Code: Select all
float4 screenColor17 = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD( float4( ( float3( (ase_screenPos26).xy , 0.0 ) + ( _Distortion * temp_output_15_0 ) ) , 0.0 ) ) );
Dont know whether or not this is a bug, but if its not, i would appreciate it if you could explain it to me so i can understand how this works.