forked from mirror/openmw-tes3mp
Transparent water
parent
8798f7dd40
commit
ff2bbc9fc5
@ -0,0 +1,321 @@
|
||||
vertex_program Water/Test cg
|
||||
{
|
||||
source water1.cg
|
||||
entry_point main
|
||||
profiles vs_1_1 arbvp1
|
||||
|
||||
}
|
||||
vertex_program Water/GlassVP cg
|
||||
{
|
||||
source GlassVP.cg
|
||||
entry_point glass_vp
|
||||
profiles vs_1_1 arbvp1
|
||||
|
||||
default_params
|
||||
{
|
||||
param_named_auto worldViewProj worldviewproj_matrix
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fragment_program Water/GlassFP cg
|
||||
{
|
||||
source GlassFP.cg
|
||||
entry_point main_ps
|
||||
profiles ps_2_0 arbfp1
|
||||
}
|
||||
|
||||
material Water/Compositor
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
depth_check off
|
||||
|
||||
vertex_program_ref Water/GlassVP
|
||||
{
|
||||
param_named_auto timeVal time 0.25
|
||||
param_named scale float 0.1
|
||||
}
|
||||
|
||||
fragment_program_ref Water/GlassFP
|
||||
{
|
||||
param_named tintColour float4 0 0.35 0.35 1
|
||||
}
|
||||
|
||||
texture_unit RT
|
||||
{
|
||||
tex_coord_set 0
|
||||
tex_address_mode clamp
|
||||
filtering linear linear linear
|
||||
}
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture WaterNormal1.tga 2d
|
||||
tex_coord_set 1
|
||||
//tex_address_mode clamp
|
||||
filtering linear linear linear
|
||||
}
|
||||
texture_unit
|
||||
{
|
||||
texture caustic_0.png 2d
|
||||
tex_coord_set 2
|
||||
//tex_address_mode clamp
|
||||
filtering linear linear linear
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vertex_program Water/RefractReflectVP cg
|
||||
{
|
||||
source Example_Fresnel.cg
|
||||
entry_point main_vp
|
||||
profiles vs_1_1 arbvp1
|
||||
}
|
||||
vertex_program Water/RefractReflectVPold cg
|
||||
{
|
||||
source Example_Fresnel.cg
|
||||
entry_point main_vp_old
|
||||
profiles vs_1_1 arbvp1
|
||||
}
|
||||
|
||||
fragment_program Water/RefractReflectFP cg
|
||||
{
|
||||
source Example_Fresnel.cg
|
||||
entry_point main_fp
|
||||
// sorry, ps_1_1 and fp20 can't do this
|
||||
profiles ps_2_0 arbfp1
|
||||
}
|
||||
|
||||
fragment_program Water/RefractReflectPS asm
|
||||
{
|
||||
source Example_FresnelPS.asm
|
||||
// sorry, only for ps_1_4 :)
|
||||
syntax ps_1_4
|
||||
|
||||
}
|
||||
material Examples/Water0
|
||||
{
|
||||
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
//
|
||||
|
||||
|
||||
vertex_program_ref Water/RefractReflectVP
|
||||
{
|
||||
param_named_auto worldViewProjMatrix worldviewproj_matrix
|
||||
param_named_auto eyePosition camera_position_object_space
|
||||
param_named_auto timeVal time 0.15
|
||||
param_named scroll float 1
|
||||
param_named scale float 1
|
||||
param_named noise float 1
|
||||
// scroll and noisePos will need updating per frame
|
||||
}
|
||||
fragment_program_ref Water/RefractReflectFP
|
||||
{
|
||||
param_named fresnelBias float -0.1
|
||||
param_named fresnelScale float 0.8
|
||||
param_named fresnelPower float 20
|
||||
param_named tintColour float4 1 1 1 1
|
||||
param_named noiseScale float 0.05
|
||||
}
|
||||
// Water
|
||||
scene_blend alpha_blend
|
||||
texture_unit
|
||||
{
|
||||
|
||||
// Water texture
|
||||
texture Water02.jpg
|
||||
// min / mag filtering, no mip
|
||||
filtering linear linear none
|
||||
colour_op_ex source1 src_manual src_current 0 1 0
|
||||
alpha_op_ex source1 src_manual src_current 0.1
|
||||
|
||||
}
|
||||
// Noise
|
||||
texture_unit
|
||||
{
|
||||
colour_op_ex source1 src_manual src_current 0 1 0
|
||||
alpha_op_ex source1 src_manual src_current 0.1
|
||||
// Perlin noise volume
|
||||
texture waves2.dds
|
||||
// min / mag filtering, no mip
|
||||
filtering linear linear none
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
material Examples/Water1
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
scene_blend colour_blend
|
||||
depth_write off
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture BeachStones.jpg
|
||||
scale 0.25 0.25
|
||||
}
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture Water01.jpg
|
||||
env_map spherical
|
||||
scroll_anim 0.01 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water2
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
scene_blend colour_blend
|
||||
depth_write off
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture Water01.jpg
|
||||
scroll_anim 0.01 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water3
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
scene_blend colour_blend
|
||||
depth_write off
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture Water02.jpg
|
||||
env_map spherical
|
||||
scroll_anim 0.01 0.01
|
||||
rotate_anim 0.03
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water4
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
cull_hardware none
|
||||
cull_software none
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture Water02.jpg
|
||||
env_map spherical
|
||||
scroll_anim 0.01 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water5
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
cull_hardware none
|
||||
cull_software none
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture BeachStones.jpg
|
||||
scale 0.25 0.25
|
||||
}
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture Water01.jpg
|
||||
env_map spherical
|
||||
scroll_anim 0.01 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water6
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
lighting off
|
||||
|
||||
texture_unit
|
||||
{
|
||||
cubic_texture cubescene.jpg combinedUVW
|
||||
tex_address_mode clamp
|
||||
env_map cubic_reflection
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water7
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
cull_hardware none
|
||||
cull_software none
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture BeachStones.jpg
|
||||
scale 0.25 0.25
|
||||
}
|
||||
|
||||
texture_unit
|
||||
{
|
||||
cubic_texture cubescene.jpg combinedUVW
|
||||
tex_address_mode clamp
|
||||
env_map cubic_reflection
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
material Examples/Water8
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
lighting off
|
||||
scene_blend add
|
||||
depth_write off
|
||||
cull_hardware none
|
||||
cull_software none
|
||||
|
||||
texture_unit
|
||||
{
|
||||
cubic_texture cubescene.jpg combinedUVW
|
||||
tex_address_mode clamp
|
||||
env_map cubic_reflection
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 288 KiB |
@ -0,0 +1,39 @@
|
||||
void main( in float4 fresnel : COLOR0,
|
||||
in float4 inTex0 : TEXCOORD0,
|
||||
in float4 inTex1 : TEXCOORD1,
|
||||
in float4 inTex2 : TEXCOORD2,
|
||||
in float4 inTex3 : TEXCOORD3,
|
||||
in float4 inTex4 : COLOR1,
|
||||
in float4 inTex5 : BCOL1,
|
||||
out float4 outCol : COLOR,
|
||||
uniform float4 matrix,
|
||||
uniform sampler2D offsetTexture : texunit0,
|
||||
uniform sampler2D reflexTexture : texunit1,
|
||||
uniform sampler2D refractTexture : texunit2,
|
||||
uniform sampler2D depthTexture : texunit3)
|
||||
{
|
||||
float4 norm = tex2D(offsetTexture, inTex0.xy);
|
||||
float4 refr = tex2D(depthTexture, inTex3.xy);
|
||||
|
||||
float4 norm2 = tex2D(offsetTexture, inTex0.xy/10.0f);
|
||||
|
||||
float4 projCoord = inTex1 / inTex1.w;
|
||||
projCoord = (projCoord + 1.0) * 0.5;
|
||||
projCoord += norm * 0.02;
|
||||
projCoord = clamp(projCoord, 0.001, 0.999);
|
||||
|
||||
float4 reflexe = tex2D(reflexTexture, projCoord.xy);
|
||||
float4 refrakce = tex2D(refractTexture, projCoord.xy);
|
||||
|
||||
float4 odrazy = reflexe*(0.7+0.3*refr);
|
||||
|
||||
reflexe = (float4(0,0.4,0.4,1.0) + reflexe*0.5);
|
||||
|
||||
outCol = lerp(refrakce, reflexe, fresnel.r)-refr*0.08;
|
||||
|
||||
//outCol = lerp(refrakce, reflexe, fresnel.r);
|
||||
|
||||
// outCol = norm;
|
||||
|
||||
outCol.a = 1;
|
||||
}
|
Loading…
Reference in New Issue