mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 04:45:32 +00:00
fresnel effect
This commit is contained in:
parent
f6342cfd60
commit
add4ebe445
3 changed files with 9 additions and 6 deletions
|
@ -11,6 +11,7 @@ compositor gbuffer
|
|||
input none
|
||||
pass clear
|
||||
{
|
||||
// make sure to set this to the viewport background color from outside
|
||||
colour_value 0 0 0 1
|
||||
}
|
||||
pass render_scene
|
||||
|
|
|
@ -64,7 +64,6 @@ 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;
|
||||
//normal = normalize(normal);
|
||||
|
||||
float2 screenCoords_reflect = screenCoords + normal.yx * 0.05;
|
||||
float2 screenCoords_refract = screenCoords + normal.yx * 0.1 * depth1;
|
||||
|
@ -72,11 +71,14 @@ void main_fp
|
|||
float4 reflection = tex2D(reflectionMap, screenCoords_reflect);
|
||||
float4 refraction = tex2D(refractionMap, screenCoords_refract);
|
||||
|
||||
// fresnel
|
||||
//float facing = 1.0 - max(abs(dot(iEyeVector.xyz, normal.xyz)), 0);
|
||||
//float reflectionFactor = saturate(0.3 + 0.7 * pow(facing, 2));
|
||||
// tangent to object space
|
||||
normal.xyz = normal.xzy;
|
||||
|
||||
oColor.xyz = lerp(refraction.xyz, reflection.xyz, depth1);
|
||||
// fresnel
|
||||
float facing = 1.0 - max(abs(dot(normalize(iEyeVector.xyz), normal.xyz)), 0);
|
||||
float reflectionFactor = saturate(0.3 + 0.7 * pow(facing, 2));
|
||||
|
||||
oColor.xyz = lerp(refraction.xyz, reflection.xyz, depth1 * reflectionFactor);
|
||||
|
||||
float fogValue = saturate((iDepth - fogParams.y) * fogParams.w);
|
||||
oColor.xyz = lerp(oColor.xyz, fogColour, fogValue);
|
||||
|
|
|
@ -48,7 +48,7 @@ material Water
|
|||
|
||||
vertex_program_ref Water_VP
|
||||
{
|
||||
//param_named_auto camPosObjSpace camera_position_object_space
|
||||
param_named_auto camPosObjSpace camera_position_object_space
|
||||
}
|
||||
fragment_program_ref Water_FP
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue