You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.9 KiB
Plaintext
62 lines
1.9 KiB
Plaintext
void main_vp
|
|
(
|
|
in float4 inPos : POSITION,
|
|
|
|
out float4 pos : POSITION,
|
|
out float2 uv0 : TEXCOORD0,
|
|
out float4 noiseCoord : TEXCOORD1,
|
|
|
|
uniform float4x4 worldViewProj,
|
|
uniform float timeVal,
|
|
uniform float scale
|
|
)
|
|
{
|
|
// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
|
|
pos = mul(worldViewProj, inPos);
|
|
|
|
// The input positions adjusted by texel offsets, so clean up inaccuracies
|
|
inPos.xy = sign(inPos.xy);
|
|
|
|
// Convert to image-space
|
|
uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
|
|
noiseCoord = (pos + timeVal) * scale;
|
|
}
|
|
|
|
|
|
|
|
float4 main_fp_nomrt (float2 iTexCoord : TEXCOORD0,
|
|
float3 noiseCoord : TEXCOORD1,
|
|
uniform sampler2D RT : register(s0),
|
|
uniform sampler2D NormalMap : register(s1),
|
|
uniform sampler2D CausticMap : register(s2)) : COLOR
|
|
{
|
|
float4 normal = tex2D(NormalMap, noiseCoord) * 2 - 1;
|
|
|
|
float4 col = tex2D(RT, iTexCoord + normal.xy * 0.015) +
|
|
(tex2D(CausticMap, noiseCoord) / 5);
|
|
col.xyz = lerp(col.xyz, float3(0.15, 0.40, 0.40), 0.4);
|
|
return col;
|
|
|
|
}
|
|
|
|
|
|
float4 main_fp (float2 iTexCoord : TEXCOORD0,
|
|
float3 noiseCoord : TEXCOORD1,
|
|
uniform float far,
|
|
uniform sampler2D RT : register(s0),
|
|
uniform sampler2D NormalMap : register(s1),
|
|
uniform sampler2D CausticMap : register(s2),
|
|
uniform sampler2D DepthMap : register(s3)) : COLOR
|
|
{
|
|
float4 normal = tex2D(NormalMap, noiseCoord) * 2 - 1;
|
|
|
|
float depth = tex2D(DepthMap, iTexCoord + normal.xy * 0.015).r * far;
|
|
depth = saturate(depth / 2000.f);
|
|
|
|
float4 color = tex2D(RT, iTexCoord + normal.xy * 0.015) +
|
|
(tex2D(CausticMap, noiseCoord) / 5);
|
|
color.xyz = lerp(color.xyz, float3(0.15, 0.40, 0.40), 0.4);
|
|
|
|
return lerp(color, float4(0.15, 0.40, 0.40, 1), depth);
|
|
}
|