вода (ps)
Автор: Andrey Dobroradnikh
[TODO.... в разработке]
/////////////////////////////////////////////////////////////// // global float4x4 mWVP : WorldViewProjection; float4 vTime; float TimeScale; float3 vEye ; float3 vReflect ; float3 vRefract ; float4 vNoise0 ; float4 vNoise1 ; float3 WaterColor = {0.02, 0.1, 0.15};; static float fScale = 1.0f; texture Texture0;//reflect texture Texture1;//refract texture Texture2;//noice /////////////////////////////////////////////////////////////// // samplers // sampler tex0 = sampler_state { texture = <Texture0>; MIPFILTER = LINEAR; MINFILTER = LINEAR; MAGFILTER = LINEAR; }; sampler tex1 = sampler_state { texture = <Texture1>; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; MIPFILTER = LINEAR; MINFILTER = LINEAR; MAGFILTER = LINEAR; }; sampler tex2 = sampler_state { texture = <Texture2>; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; MIPFILTER = LINEAR; MINFILTER = LINEAR; MAGFILTER = LINEAR; }; struct VpIn11 { float4 Pos : POSITION; float3 TexCoord0 : TEXCOORD0; }; struct VpOut11 { float4 HPos : POSITION; float2 Wave0 : TEXCOORD0; float2 Wave1 : TEXCOORD1; float2 TexCoord0 : TEXCOORD2; float2 TexCoord1 : TEXCOORD3; }; VpOut11 VS_main11(VpIn11 IN) { vTime.x = scaleTime( ); VpOut11 OUT; OUT.HPos = mul( IN.Pos,mWVP); float2 fTranslation={vTime.x, 0}; float2 vTexCoords=IN.TexCoord0.xy; OUT.Wave0.xy = vTexCoords.xy+fTranslation; OUT.Wave1.xy = vTexCoords.xy*.5+fTranslation*3; OUT.HPos.y = -OUT.HPos.y; OUT.TexCoord0 = ( OUT.HPos.xy + OUT.HPos.w)*0.5/OUT.HPos.w; OUT.TexCoord1 = ( OUT.HPos.xy + OUT.HPos.w)*0.5/OUT.HPos.w; OUT.HPos.y = -OUT.HPos.y; return OUT; } float4 PS_main11( VpOut11 IN):COLOR { float3 vBumpTexA = tex2D( tex0, IN.Wave0.xy).xyz; float3 vBumpTexB = tex2D( tex0, IN.Wave1.xy).xyz; float4 vRefraction = tex2D( tex1,IN.TexCoord0.xy); float4 vReflection = tex2D( tex2,IN.TexCoord1.xy); float4 fragment = vRefraction*1.2+vReflection*0.5; return fragment + ( ( vBumpTexA.x )* 0.2)* vBumpTexB.y; } technique ps11 { pass p0 { VertexShader = compile vs_1_1 VS_main11( ); PixelShader = compile ps_1_1 PS_main11( ); } }
28 июня 2006 (Обновление: 8 июля 2006)
Комментарии [4]