Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 1
Page 1 of 4 1 2 3 4
Probleme mit Wassershader #31676
08/04/04 20:37
08/04/04 20:37
Joined: Nov 2003
Posts: 1,380
Switzerland; Zurich
S
Sebe Offline OP
Serious User
Sebe  Offline OP
Serious User
S

Joined: Nov 2003
Posts: 1,380
Switzerland; Zurich
Ich habe folgendes Problem mit terrainbasierenden Wassershadern:

In meinem Level befindet sich ein relativ grosses Meer, bestehend aus einer 1x1 hmp, welche mit Steempipes Rivershader ausgestattet ist. Um den Meeresgrund besser aussehen zu lassen, habe ich kleine Muschelmodels und Algensprites auf den Boden gesetzt. Doch da trat das Problem auf: Die Muscheln waren durch den transparenten Shader (tga) gut sichtbar, verschwanden jedoch, sobald ich mit der Kamera näher als ca. 300 Quants herankam. Warum?

Um herauszufinden, ob es am transparenten TGA der HMP liegt, habe ich dieselbe HMP mit dem auch beim Shader verwendetem transparenten TGA ausgestattet und einfach ohne Shader getestet. Und hier ging es wunderbar; die Models/Sprites unter der HMP waren sichtbar.

Vielleicht weiss einer der Shader-Gurus hier Rat?

Re: Probleme mit Wassershader [Re: Sebe] #31677
08/05/04 09:06
08/05/04 09:06
Joined: Jul 2002
Posts: 5,181
Austria
Blattsalat Offline
Senior Expert
Blattsalat  Offline
Senior Expert

Joined: Jul 2002
Posts: 5,181
Austria
poste mal den shader code hier den du benutzt...steempipe hat schon etliche versionen von shadern geschrieben

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
S
Sebe Offline OP
Serious User
Sebe  Offline OP
Serious User
S

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 Offline
Senior Member
Mr Wurm  Offline
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 Offline
Serious User
MMike  Offline
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] #31681
08/16/04 18:29
08/16/04 18:29
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
I'm sure the card suppoorts it... otherwise you would have had "effect not supported".

Is this using the stock textures from the demo of the shader?? If not, it may be more of a scaling and texture issue.

Many games have multiple effects for fallback to support a wide array of cards. Also, they (the coders) have more flexibility in how they program the effects as they are not limited to the same functions we are right now. They have more control over texture coordinates, the streams, and also multipasses, among other things.

Re: Probleme mit Wassershader [Re: Steempipe] #31682
08/16/04 21:54
08/16/04 21:54
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
for example the shaders of water that i download at ur werbsite don't work on my card! i just see the water as black!

And i used my textures for apply the shader above

And BTW what does the line command -emu does?? i read on manual...

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 Offline
Serious User
Steempipe  Offline
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.

Re: Probleme mit Wassershader [Re: Steempipe] #31684
08/17/04 10:21
08/17/04 10:21
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
it works perfect..so why i see the black thing? in other kinds of shaders?

Re: Probleme mit Wassershader [Re: MMike] #31685
08/17/04 18:11
08/17/04 18:11
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Post, or email me (in my profile), the textures you are using. If posting, show the alpha, too.

Page 1 of 4 1 2 3 4

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1