mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-19 15:39:49 +00:00
shore transition test
This commit is contained in:
parent
ab8b74dcac
commit
36fd9b9f26
2 changed files with 18 additions and 5 deletions
|
@ -35,8 +35,10 @@ void main_fp
|
|||
|
||||
, uniform sampler2D reflectionMap : register(s0)
|
||||
, uniform sampler2D refractionMap : register(s1)
|
||||
, uniform sampler2D normalMap : register(s2)
|
||||
, uniform sampler2D depthMap : register(s2)
|
||||
, uniform sampler2D normalMap : register(s3)
|
||||
, uniform float time
|
||||
, uniform float far
|
||||
, uniform float4 fogParams
|
||||
, uniform float4 fogColour
|
||||
)
|
||||
|
@ -45,6 +47,9 @@ void main_fp
|
|||
float2 screenCoords = iScreenCoords.xy / iScreenCoords.z;
|
||||
screenCoords.y = (1-saturate(renderTargetFlipping))+renderTargetFlipping*screenCoords.y;
|
||||
|
||||
float depth1 = tex2D(depthMap, screenCoords).r * far - iDepth;
|
||||
depth1 = saturate(depth1 / 500.f);
|
||||
|
||||
float2 uv1 = iUv + time * float2(0.5, 0);
|
||||
float2 uv2 = iUv + time * float2(0, 0.5);
|
||||
float2 uv3 = iUv + time * float2(-0.5, 0);
|
||||
|
@ -53,12 +58,14 @@ void main_fp
|
|||
float4 normal = tex2D(normalMap, uv1) + tex2D(normalMap, uv2) + tex2D(normalMap, uv3) + tex2D(normalMap, uv4);
|
||||
normal = normal / 4.f;
|
||||
normal = 2*normal - 1;
|
||||
screenCoords += normal.yx * 0.05;
|
||||
|
||||
float4 reflection = tex2D(reflectionMap, screenCoords);
|
||||
float4 refraction = tex2D(refractionMap, screenCoords);
|
||||
float2 screenCoords_reflect = screenCoords + normal.yx * 0.05;
|
||||
float2 screenCoords_refract = screenCoords + normal.yx * 0.1 * depth1;
|
||||
|
||||
oColor.xyz = lerp(reflection.xyz, refraction.xyz, 1);
|
||||
float4 reflection = tex2D(reflectionMap, screenCoords_reflect);
|
||||
float4 refraction = tex2D(refractionMap, screenCoords_refract);
|
||||
|
||||
oColor.xyz = lerp(refraction.xyz, reflection.xyz, depth1);
|
||||
|
||||
float fogValue = saturate((iDepth - fogParams.y) * fogParams.w);
|
||||
oColor.xyz = lerp(oColor.xyz, fogColour, fogValue);
|
||||
|
|
|
@ -55,6 +55,7 @@ material Water
|
|||
param_named_auto fogColour fog_colour
|
||||
param_named_auto fogParams fog_params
|
||||
param_named_auto renderTargetFlipping render_target_flipping
|
||||
param_named_auto far far_clip_distance
|
||||
}
|
||||
|
||||
texture_unit reflectionMap
|
||||
|
@ -68,6 +69,11 @@ material Water
|
|||
tex_address_mode clamp
|
||||
}
|
||||
|
||||
texture_unit depthMap
|
||||
{
|
||||
tex_address_mode clamp
|
||||
}
|
||||
|
||||
texture_unit normalMap
|
||||
{
|
||||
texture WaterNormal2.tga
|
||||
|
|
Loading…
Reference in a new issue