Hey!
I am using a Plane with my Terrain, which uses the FX-Water (pro), but the Reflection is too strong. I want make this lower.
how does it work?
In other words,
How can I fade the reflection.
Thank you
Hey!
I am using a Plane with my Terrain, which uses the FX-Water (pro), but the Reflection is too strong. I want make this lower.
how does it work?
In other words,
How can I fade the reflection.
Thank you
Ok it sounds like you want to reduce the strength of the reflection when using the Pro water shader.
It seems that there isn't a setting to do this with the water controls - the strength of the reflection is actually controlled by the alpha values in the "Reflective Colour" texture gradiant, which makes it a little awkward to adjust.
It is possible to add a simple slider, so that you can use this instead of editing the alpha channel of that texture. To do this, you'll need to make 3 simple edits to the water shader source file.
You need to open up the file called "FX-Water.shader" in a text editor. This file should be in your project assets folder, in "Pro Standard Assets/Water/Sources". (note: not "FX-Water simple.shader").
Once you have it open, first, add a line, underneath line 10:
line 10: _ReflectiveColor ("Reflective color (RGB) fresnel (A) ", 2D) = "" {}
Add This-> _ReflectionStrength ("Reflection strength", Range(0.0,1.0)) = 0.5
Next, add a line under what is now line 96:
line 96: sampler2D _ReflectionTex;
Add This-> uniform float _ReflectionStrength;
Next, delete the lines that are currently directly above and below line 100:
before:
delete-> 99: #if defined WATER_REFLECTIVE || defined WATER_SIMPLE
100: sampler2D _ReflectiveColor;
delete-> 101: #endif
after:
99: sampler2D _ReflectiveColor;
Finally, change the block of code from lines 138-147 from:
original:
#ifdef WATER_REFRACTIVE
half fresnel = tex2D( _Fresnel, float2(fresnelFac,fresnelFac) ).a;
color = lerp( refr, refl, fresnel );
#endif
#ifdef WATER_REFLECTIVE
half4 water = tex2D( _ReflectiveColor, float2(fresnelFac,fresnelFac) );
color.rgb = lerp( water.rgb, refl.rgb, water.a );
color.a = refl.a * water.a;
#endif
to this:
#ifdef WATER_REFRACTIVE
half fresnel = tex2D( _Fresnel, float2(fresnelFac,fresnelFac) ).a;
half4 water = tex2D( _ReflectiveColor, float2(fresnelFac,fresnelFac) );
color.rgb = lerp( water.rgb, refl.rgb, _ReflectionStrength );
color = lerp( refr, color, fresnel );
#endif
#ifdef WATER_REFLECTIVE
half4 water = tex2D( _ReflectiveColor, float2(fresnelFac,fresnelFac) );
color.rgb = lerp( water.rgb, refl.rgb, _ReflectionStrength );
color.a = refl.a * water.a;
#endif
Now, save & close the shader file, and go back to Unity. You should now find that if you select your water, and scroll in the inspector down to the shader, there's a new slider called "Reflection Strength". You can adjust this from 0-1, which takes you from no reflection, all the way to the surface being 100% opaque reflection!
enjoy :-)
If you are using physics, you can adjust the physics materials of your colliding objects and reduce their bouncyness. Otherwise we could use some more info to help you...
You don't need to change the water shader to adjust the amount of relfection. You can create your own fresnel texture that does the same thing.
In photoshop, select File -> New. Set the Width to 256 Pixels, Height to 32 Pixels. Set Background Contents to Transparent. Select OK.
Now, select the Brush Tool, and adjust its Size so that it covers the entire image.
Now, what adjusts the amount of reflection is the Opacity. 100% is totally reflective. 0% is no reflection. I find that about 15% gives a nice balance. But try it out for yourself!
Save it as a PSD file and put it into your assets folder. Then use it as the fresnel texture in the Water Shader.
Does anyone know how to change this for unity pro 3.0’s Water4 Shader?