Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/WaveformProvider/Sample/Material/Reflect.mat
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpAmt: 5
- _BumpAmt: 1000
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
Expand Down
3 changes: 2 additions & 1 deletion Assets/WaveformProvider/Sample/Shader/GrabDistortion.shader
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
};

sampler2D _BackgroundTexture;
float4 _BackgroundTexture_TexelSize;
float _NormalScale;
//wave texture definition.
WAVE_TEX_DEFINE(_WaveTex)
Expand All @@ -54,7 +55,7 @@
{
//compute wave normal.
float3 normal = WAVE_NORMAL(_WaveTex, i.uv);
float2 offset = normal.xy * _NormalScale - _NormalScale * 0.5;
float2 offset = normal.xy * _NormalScale - _BackgroundTexture_TexelSize.xy;
float4 bgcolor = tex2D(_BackgroundTexture, i.grabPos.xy / i.grabPos.w + offset);

return bgcolor;
Expand Down
4 changes: 2 additions & 2 deletions Assets/WaveformProvider/Sample/Shader/WaterSurface.shader
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
_WaveInputTex("Wave Input Texture", 2D) = "black" {}
_RefTex("Ref",2D) = "black" {}
_BumpMap("Normalmap", 2D) = "bump" {}
_BumpAmt("BumpAmt", Range(0,100)) = 0
_BumpAmt("BumpAmt", Range(0,10000)) = 0

//this property is populated with the wave's RenderTexture.
_WaveTex("Wave",2D) = "gray" {}
Expand Down Expand Up @@ -66,7 +66,7 @@
//compute wave normal.
bump += WAVE_NORMAL_ADJ(_WaveTex, i.uv, _ParallaxScale, _NormalScaleFactor);

float2 offset = bump * _BumpAmt - _BumpAmt * 0.5;
float2 offset = bump * _BumpAmt * _RefTex_TexelSize.xy;
i.ref.xy = offset * i.ref.z + i.ref.xy;
float4 ref = tex2D(_RefTex, i.ref.xy / i.ref.w * 0.5 + 0.5);

Expand Down
3 changes: 2 additions & 1 deletion Assets/WaveformProvider/Sample/Shader/WaveHeight.shader
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
float4 frag (v2f i) : SV_Target
{
//compute wave height.
return float4(1, 1, 1, 1) * WAVE_HEIGHT(_WaveTex, i.uv);
float height01 = WAVE_HEIGHT(_WaveTex, i.uv) * 0.5 + 0.5;
return float4(height01, height01, height01, 1);
}
ENDCG
}
Expand Down
3 changes: 2 additions & 1 deletion Assets/WaveformProvider/Sample/Shader/WaveNormal.shader
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
float4 frag (v2f i) : SV_Target
{
//compute wave normal.
return float4(WAVE_NORMAL(_WaveTex, i.uv), 1);
float3 normal01 = WAVE_NORMAL(_WaveTex, i.uv) * 0.5 + 0.5;
return float4(normal01, 1);
}
ENDCG
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/WaveformProvider/Sample/Texture/Wave.renderTexture
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RenderTexture:
m_Width: 256
m_Height: 256
m_AntiAliasing: 1
m_DepthFormat: 2
m_DepthFormat: 0
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
Expand Down
2 changes: 1 addition & 1 deletion Assets/WaveformProvider/Shader/Lib/WaveUtil.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ float3 WaveNormal(sampler2D waveTex, float2 uv, float2 texelSize, float parallax
float3 texz = WAVE_HEIGHT(waveTex, uv.xy - shiftZ);
float3 du = { 1, 0, normalScale * (texX.x - texx.x) };
float3 dv = { 0, 1, normalScale * (texZ.x - texz.x) };
return normalize(cross(du, dv)) * 0.5 + 0.5;
return normalize(cross(du, dv));
}

#endif //WAVE_UTIL