2 registered members (rki, AndrewAMD),
426
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Slin's Water Shader
#179567
01/23/08 22:32
01/23/08 22:32
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Hi guys, i've downloaded Slin's water shader>> http://files.filefront.com/Water+for+Everyone/;8570332;/fileinfo.htmlI have implemented it into my project and it works very well. The only addition i would like is that it is slightly transparent so i can see like the sea floor or rocks underneath the water plane/terrain. I asked slin and he told me to add a couple of lines but they did not work and he said he has no more ideas. I dont program shaders so does anyone know how to add transparency to the reflecting water shader? Thanks.... DJB.
Last edited by DJBMASTER; 01/23/08 22:33.
|
|
|
Re: Slin's Water Shader
[Re: lostclimate]
#179569
01/24/08 00:12
01/24/08 00:12
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
////////////////////////////////////////////////////////
matrix matMtl; texture mtlSkin1; texture mtlSkin2;
technique makewater2 { pass p0 { AlphaBlendEnable=false; Zenable = True; ZwriteEnable = True;
BlendOp=Add; Lighting=True;
Texture[0] = <mtlSkin1>; Texture[1] = <mtlSkin2>; magFilter[0] = linear; minFilter[0] = linear; mipFilter[0] = linear; COLOROP[0] = BumpEnvMap; COLORARG1[0] = Texture; COLORARG2[0] = Current; TexCoordIndex[0] = 1; TextureTransformFlags[0] = Count2; TextureTransform[0] = <matMtl>; magFilter[1] = Linear; minFilter[1] = Linear; mipFilter[1] = Linear; AddressU[1] = Clamp; AddressV[1] = Clamp; ColorOp[1] = Modulate; //Modulate/AddSigned/Modulate2x/Modulate4x/Add <----------This looks all okay ColorArg1[1] = Texture; ColorArg2[1] = Current; texcoordindex[1] = cameraspaceposition | 1; // For cubemap use: cameraspacereflectionvector TextureTransformFlags[1] = count3 | projected; TextureTransform[1] = { 0.8, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 1.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; } }
//technique fallback { pass p0 { } }
|
|
|
Re: Slin's Water Shader
[Re: DJBMASTER]
#179570
01/24/08 01:41
01/24/08 01:41
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Code:
matrix matMtl;
texture mtlSkin1; texture mtlSkin2;
float4 AlphaX = {1.0, 1.0, 1.0, 0.5}; // change 0.5 to your alpha (0 - 1)
technique makewater2 { pass p0 { AlphaBlendEnable = true; //AlphaTestEnable = true; // <-- you may need to add this Zenable = True; ZwriteEnable = True;
BlendOp=Add; Lighting=True;
Texture[0] = <mtlSkin1>; Texture[1] = <mtlSkin2>;
magFilter[0] = linear; minFilter[0] = linear; mipFilter[0] = linear;
COLOROP[0] = BumpEnvMap; COLORARG1[0] = Texture; COLORARG2[0] = Current;
TexCoordIndex[0] = 1; TextureTransformFlags[0] = Count2; TextureTransform[0] = <matMtl>;
magFilter[1] = Linear; minFilter[1] = Linear; mipFilter[1] = Linear;
AddressU[1] = Clamp; AddressV[1] = Clamp;
ColorOp[1] = Modulate; ColorArg1[1] = Texture; ColorArg2[1] = Current;
ColorOp[2] = Modulate; ColorArg1[2] = AlphaX; ColorArg2[2] = Current;
texcoordindex[1] = cameraspaceposition | 1; cameraspacereflectionvector TextureTransformFlags[1] = count3 | projected; TextureTransform[1] = { 0.8, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 1.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; } }
//technique fallback { pass p0 { } }
xXxGuitar511 - Programmer
|
|
|
Re: Slin's Water Shader
[Re: Steempipe]
#179573
01/24/08 15:41
01/24/08 15:41
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Done that... now i get this error>>>
Error in effect: Water_mat(56); ID3DXEffectCompiler: State 'COLORARG1' does not accept 'AlphaX' as a value. There was an error initializing the compiler. ColorArg1[2] = AlphaX;
I have no idea what is going wrong, lol. Has anyone got this to work?
Last edited by DJBMASTER; 01/24/08 15:41.
|
|
|
Re: Slin's Water Shader
[Re: Steempipe]
#179576
01/24/08 22:14
01/24/08 22:14
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
placing <> around AlphaX just makes the water render as a black plane.
I have tried using >>
material mtl_ffpwater { skin1=waterbump; event = mtl_ffpwater_event; effect = "efx_water.fx"; my.transparent = on; my.alpha=50; }
But it doesnt accept transparent or alpha flags because it gives me errors when i run it.
I have tried adding transparent/translucent and alpha flags to the water action, view and material, but so far no look in making the water have alpha. I am guessing the solution is to code it into the shader, but i am no good with programming shaders.
You mention alpha states and blending operations - i have no idea what these mean, lol.
Last edited by DJBMASTER; 01/24/08 22:15.
|
|
|
|