|
Re: Probleme mit Wassershader
[Re: Blattsalat]
#31678
08/05/04 16:16
08/05/04 16:16
|
Joined: Nov 2003
Posts: 1,380 Switzerland; Zurich
Sebe
OP
Serious User
|
OP
Serious User
Joined: Nov 2003
Posts: 1,380
Switzerland; Zurich
|
Wie gesagt, ich benutze Steempipes Rivershader, einfach mit etwas anderem Skin sowie leicht angepasster Waternoise... Hier ist der Code (nach dem Shader hätte es noch einen längeren Mesh Deformation Code für die Wellen, den lass ich mal weg) Code:
//----------------------------------------------------------------------------- // Simple Riverwater Shader // // For use on transparent pools and streams. // // It's a start.... hopefully imoprovements will happen and be posted at // http://steempipe.technicalfoundry.com //-----------------------------------------------------------------------------
// Based on ATI's Procedural Fire Shader. // Rev. 2.23.04.01
// Note: Vertexshader 1.1 and Pixelshader 1.4 needed.
bmap water = <waterdorfumlandpart1.tga>; // Nur um den Strand herum transparent bmap waternoise= <waternoise.bmp>;
MATERIAL mat_riverwater {
Skin1 = water; Skin2 = waternoise;
effect= " matrix matWorldViewProj; matrix matWorld; matrix matWorldView; vector vecSunDir; vector vecDiffuse; vector vecAmbient; vector vecLight; vector vecFog; vector vecSkill41; texture mtlSkin1; //Water texture mtlSkin2; //Noise technique riverwater { pass p0 { Texture[0]=<mtlSkin1>; // Texture Texture[1]=<mtlSkin2>; // Noise Texture Texture[2]=<mtlSkin2>; // Noise Texture Texture[3]=<mtlSkin2>; // Noise Texture ALPHATESTENABLE= true; ALPHAFUNC=NOTEQUAL; ALPHAREF= 0x00; ALPHABLENDENABLE= true; SRCBLEND=SRCALPHA; DESTBLEND= INVSRCALPHA; Cullmode=1; zWriteEnable=true; magFilter[0]=linear; minFilter[0]=linear; mipFilter[0]=linear; //ADDRESSU[0]=wrap; //ADDRESSV[0]=wrap; magFilter[1]=linear; minFilter[1]=linear; mipFilter[1]=linear; //ADDRESSU[1]=wrap; //ADDRESSV[1]=wrap;
magFilter[2]=linear; minFilter[2]=linear; mipFilter[2]=linear; //ADDRESSU[2]=wrap; //ADDRESSV[2]=wrap;
magFilter[3]=linear; minFilter[3]=linear; mipFilter[3]=linear; //ADDRESSU[3]=wrap; //ADDRESSV[3]=wrap; ////////////////////////////////////////////////////// // Vertex Shader Constants
// c0..c3 - MVP // c11.xy - scroll speed 1 // c12.xy - scroll speed 2 // c13.xy - scroll speed 3 // c14.xy - scale 1 // c15.xy - scale 2 // c16.xy - scale 3 // c41.x - time
vertexShaderConstant[0]=<matWorldViewProj>; vertexShaderConstant[4]=<matWorld>; vertexShaderConstant[8]=<matWorldView>; // scroll speed - change as needed with model scaling VertexShaderConstant[11]={0.0f, 1.0f, 0.0f, 0.0f}; VertexShaderConstant[12]={0.0f, -1.2f, 0.0f, 0.0f}; VertexShaderConstant[13]={1.0f, 1.5f, 0.0f, 0.0f};
// scale - change according to model scaleing VertexShaderConstant[14]={2.0f, 2.0f, 0.0f, 0.0f}; VertexShaderConstant[15]={3.0f, 3.0f, 0.0f, 0.0f}; VertexShaderConstant[16]={4.0f, 4.0f, 0.0f, 0.0f};
vertexShaderConstant[17]=<vecSunDir>; vertexShaderConstant[18]=<vecDiffuse>; vertexShaderConstant[19]=<vecAmbient>; vertexShaderConstant[20]=<vecLight>; vertexShaderConstant[21]=<vecFog>;
// time VertexShaderConstant[41]=<vecSkill41>;
vertexShaderConstant[95]=(0.0f,0.0f,0.0f,0.0f); ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////// // Pixel Shader Constants
// distortion (pertrubation factors) PixelShaderConstant[1]={0.3f, 0.2f, 0.0f, 0.0f}; PixelShaderConstant[2]={0.1f, 0.3f, 0.0f, 0.0f}; PixelShaderConstant[3]={0.1f, 0.1f, 0.0f, 0.0f};
// hight-based bias and scale PixelShaderConstant[4]={0.5f, 0.1f, 0.0f, 0.0f};
///////////////////////////////////////////////////////////
vertexShader= decl { stream 0; float v0[3]; //position float v3[3]; //normal float v7[2]; //uv } asm { vs.1.1
// Transform position m4x4 oPos, v0, c0
m3x3 r0,v3,c4 // transform normal to world space dp3 r0.w,r0,r0 // renormalize it rsq r0.w,r0.w mul r0,r0,r0.w
dp3 r0,r0,-c17 // normal.light -> lighting constant mul r0.xyz,r0,c18 // modulate against material diffuse color add oD0.xyz,r0,c19 // add environment light
mov r1.w,c21.w // r1.w=1 dp4 r0,v0,c10 // distance to camera position add r0,r0,-c21.x // distance-fog_start mad r0.x,-r0.x,c21.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start)) max oFog.x,r0.x,c95.w // clamp with custom max value
// Pass base texture coordinates mov oT0, v7
// Time mov r0, c41.x
// Compute texture coordinates for 1st noise texture mul r1, r0, c11 frc r1.xy, r1 mad oT1, v7, c14.xyxy, r1.xyxy
// Time mov r0, c41.y
// Compute texture coordinates for 2nd noise texture mul r1, r0, c12 frc r1.xy, r1 mad oT2, v7, c15.xyxy, r1.xyxy // Time mov r0, -c41.x
// Compute texture coordinates for 3rd noise texture mul r1, r0, c13 frc r1.xy, r1 mad oT3, v7, c16.xyxy, r1.xyxy
};
pixelShader= asm { ps.1.4
// Pass base texture coordinates texcrd r0.rgb, t0
// Fetch noise texld r1, t1 texld r2, t2 texld r3, t3
// noise0 * disamount0 mul r1.rgb, c1, r1_bx2
// noise1 * disamount1 + noise0 * disamount0 mad r1.rgb, c2, r2_bx2, r1
// noise2 * disamount2 + noise1 * disamount1 + noise0 * disamount0 mad r1.rgb, c3, r3_bx2, r1
// Scale and bias y coord of base map based on height +mad r0.a, 1-r0.g, c4.x, c4.y
// Multiply distortion by scaled biased y coord mad r1.rgb, r1, r0.a, r0
phase
// Perturb texld r0, r1
};
} // end of pass } // end of technique ";// end of effect } // end of material
starter mat_riverwater_init
{ // Need to create MipMaps for the mtlSkins bmap_to_mipmap(mat_riverwater.skin1); bmap_to_mipmap(mat_riverwater.skin2); }
|
|
|
Re: Probleme mit Wassershader
[Re: Sebe]
#31679
08/08/04 19:39
08/08/04 19:39
|
Joined: Jul 2002
Posts: 446 Switzerland
Mr Wurm
Senior Member
|
Senior Member
Joined: Jul 2002
Posts: 446
Switzerland
|
Kennt irgendwer das problem, oder sogar die Lösung?
- Mr Wurm
|
|
|
Re: Probleme mit Wassershader
[Re: Mr Wurm]
#31680
08/16/04 10:09
08/16/04 10:09
|
Joined: Jul 2004
Posts: 1,710
MMike
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,710
|
Why i can't see the effect? I just see a black block(the shader) and a bump on it(maybe the bump skin) Does my card support it??
A6 test level screenshot
Halo shader shot
Geforce Fx 5600 256MB? last driver :6.7
And why in other games like halo , shader works perfect the water shader and other shaders, ?
Last edited by Unknot; 08/16/04 10:47.
|
|
|
Re: Probleme mit Wassershader
[Re: MMike]
#31683
08/16/04 23:41
08/16/04 23:41
|
Joined: Dec 2003
Posts: 1,097 Maryland, USA
Steempipe
Serious User
|
Serious User
Joined: Dec 2003
Posts: 1,097
Maryland, USA
|
Try this version water and you *may* see other than black. Good luck! web page If I recall, I have alpha channels in the riverwater textures.... long time ago so I may be wrong. What happens when you use those textures on your block?? -EMU??? Don't know, never looked into it.
|
|
|
|