improve water, cleanup
This commit is contained in:
parent
3bbd3d9aaf
commit
93c2d5407c
1 changed files with 15 additions and 12 deletions
|
@ -22,9 +22,9 @@
|
|||
_StarTint ("Star tint", Range(0, 1)) = 0.4
|
||||
[Header(Water)]
|
||||
_WaterCol ("Water color", Color) = (0.03, 0.08, 0.12, 1.0)
|
||||
_WaveStrength ("Wave scale", Range(0, 1)) = 1
|
||||
[NoScaleOffset]
|
||||
_WaterSurface ("Surface Normal", 2D) = "white" {}
|
||||
_Temp ("Wave scale", Range(0, 1)) = 0
|
||||
[Header(Debug)]
|
||||
_Grid ("Grid visibility", Range(0, 1)) = 0
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
|
||||
sampler2D _WaterSurface;
|
||||
fixed4 _WaterCol;
|
||||
float _Temp;
|
||||
float _WaveStrength;
|
||||
|
||||
float _Grid;
|
||||
|
||||
|
@ -93,10 +93,12 @@
|
|||
|
||||
fixed3 get_water_normal(float2 pos) {
|
||||
float3 normal = 0.0;
|
||||
float t1 = _Time.x * 0.2;
|
||||
normal += (tex2D(_WaterSurface, pos * 1.0 + float2(t1, t1*0.5)) - 0.5);
|
||||
float t2 = _Time.x * 0.5;
|
||||
normal += (tex2D(_WaterSurface, pos * 0.2 + float2(t2*0.5, t2)) - 0.5) * 0.25;
|
||||
float t1 = _Time.x * 0.18;
|
||||
normal += (tex2D(_WaterSurface, pos * 1.04 + float2(t1, t1 * 0.5)) - 0.5);
|
||||
float t2 = _Time.x * 0.37;
|
||||
normal += (tex2D(_WaterSurface, pos * 0.276 + float2(t2 * 0.8, t2)) - 0.5);
|
||||
float t3 = _Time.x * 0.08;
|
||||
normal += (tex2D(_WaterSurface, pos * 0.07 + float2(t3 * 0.8, -t3)) - 0.5);
|
||||
|
||||
return normalize(normal.zxy);
|
||||
}
|
||||
|
@ -116,6 +118,7 @@
|
|||
camera_local_pos.z - camera_local_pos.y / (real_dir.y / real_dir.z)
|
||||
);
|
||||
float3 water_normal = get_water_normal(surface_pos.xz);
|
||||
water_normal = lerp(UP, water_normal, _WaveStrength);
|
||||
|
||||
dir = reflect(dir, water_normal);
|
||||
water_mod = dot(dir, water_normal);
|
||||
|
|
Loading…
Reference in a new issue