Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 1
Page 2 of 4 1 2 3 4
Re: Probleme mit Wassershader [Re: Steempipe] #31686
08/17/04 22:04
08/17/04 22:04
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
This is the Images...
But... Alpha channel? they don't have !
water :

water Bump:



The files are all TGA but with Bmp is the same..
And the water don't move ! is is static! has no waves! but i can see the bump!

I'm useing a block (wmb) to attach the action with the shader Above!

Re: Probleme mit Wassershader [Re: MMike] #31687
08/18/04 03:24
08/18/04 03:24
Joined: May 2004
Posts: 43
J
JeremyB Offline
Newbie
JeremyB  Offline
Newbie
J

Joined: May 2004
Posts: 43
I am having the same problem I think. I am using a 32 bit 256x256 targa for the water cahnnel and a 24 bit 256x256 bmp dot3 image for the noise channel. It looks really nice and I can see the ripples of the water, but it is not animated. It looks like something needs to be done with the entities skill41 to cause the animation to happen? I have tried setting it equal to time and incrementing it by time and very small increments in a loop in the entities action. This causes the noise texture to sort of spastically jump, but does not give the smooth animation as you would expect to see. I think I am on the right track here, but a little help would be appreciated . Thanks!

Re: Probleme mit Wassershader [Re: JeremyB] #31688
08/18/04 04:07
08/18/04 04:07
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Okay.... My "water.tga" is this:


The color and the noise is in the RGB channel, but it is also using the tex in the alpha channel to do some scaling of the noise. Also, without it you will not get your transparency to work.

I used a flat terrain to render the effect to.

Depending on the size/scale of your model, you will need to adjust some areas.

First the vertex shader:

For the scaling and the scroll, you only need to concern yourself with the X and Y's.
ex; VertexShaderConstant[11]={X, Y, Z, W}; //First noise texture

<<------The scroll speed of the textures.

If you have a small model then try smaller numbers?? I forget exactly.

Note: The (3) noise textures are derived from the water color texture RGB channels.

// scroll speed - change as needed with model scaling
VertexShaderConstant[11]={0.0f, 1.0f, 0.0f, 0.0f}; //First noise texture
VertexShaderConstant[12]={0.0f, -1.2f, 0.0f, 0.0f}; //Second noise texture
VertexShaderConstant[13]={1.0f, 1.5f, 0.0f, 0.0f}; //Third noise texture


The scale of the (3) noise textures:

// scale - change according to model scaleing
VertexShaderConstant[14]={2.0f, 2.0f, 0.0f, 0.0f}; //First noise tex
VertexShaderConstant[15]={3.0f, 3.0f, 0.0f, 0.0f}; //Second noise tex
VertexShaderConstant[16]={4.0f, 4.0f, 0.0f, 0.0f}; //Third noise tex.

In the action, the part that more or less seeds the vertex shader,
VertexShaderConstant[41]=<vecSkill41>;

Is indeed controlled by this in the action:
again, you may need to dick with it depending on the size of your model.

////////////////////////////////////////////////
var ShaderCount;
var ShaderCount2;


while(1)
{


my.skill41=float(ShaderCount);
my.skill42=float(ShaderCount2);
my.skill43=float(0);
my.skill44=float(0);

ShaderCount += 0.0015;
ShaderCount2 -= 0.0013;

..................................


The junk that you may need to change in the Action for the mesh deforming is, and here we go again, based on the model size:

///////////////////////////////
// I override the skills
my.activate_dist = 3000; //Distance from the player for deformation to start.
my.direction = 3;
my.wave_speed = 1.500;
my.skew_value = 0;

// Depending on the scale of the model the wave size will need adjusting.
// For instance, ff you scale the model up huge, then decrease wave size

my.wave_size = 0.06; //random(0.06)-0.06;
my.crests_per_unit = 10;

////////////////////////////////////////////

So really, depending on the model size you will need to tinker. Just plug some numbers ans see what happens. It will take tweaking because many factors.

Eric

Re: Probleme mit Wassershader [Re: Steempipe] #31689
08/18/04 04:20
08/18/04 04:20
Joined: May 2004
Posts: 43
J
JeremyB Offline
Newbie
JeremyB  Offline
Newbie
J

Joined: May 2004
Posts: 43
Ha ha! That is excellent! Thank you it works perfectly. What a beautiful effect. I was only updating skill41. I am new to GS, so let me see if I get this straight.

VertexShaderConstant[41]=<vecSkill41>;

So c41 now points to skill41. So when you use c41.x later does that just offset the pointer to point to skill42? And why set skill43 and 44 to 0? I don't see how they are used in the shader.

Also, when you say you override the skills for the following variables:
activate_dist
direction
wave_speed
skew_value
wave_size
crests_per_unit

does that correspond to skill1-6?

Thank you for all of your patient and generous help!

Re: Probleme mit Wassershader [Re: JeremyB] #31690
08/18/04 04:40
08/18/04 04:40
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Skill41-44 are what we are given by Conitec to interact with the vectors in a vertexshader.

vector vecSkill41; // vector(X, Y, Z, W)

vertexShaderConstant(41)= <vecSkill41>;

my.skill41=float(ShaderCount); //X
my.skill42=float(ShaderCount2); //Y
my.skill43=float(0); //Z
my.skill44=float(0); //W

c41.x is saying to use the x component of the vector. c41.y is saying to use the y component of the vector.

Here we are sending the X of c41 to a register for use in multiplying.
// Time
mov r0, c41.x

So, if we send 13.2 thru <my.skill41> and 16.4 thru <my.skill42> then

vertexShaderConstant(41)= <vecSkill41>;

would look like this to the effect:

vertexShaderConstant(41)= {13.2f, 16.4f, 0, 0};


Your right, c43 and c44 are not used here. They were during expirimenting but not at final. Guess they carried over.


If you define things, the wave skills that I over-rode, would be used in the skills box. I just edit the text and run as I was working on this and had no need to really use the skills properties box. But yes, you are right.

Eric

Re: Probleme mit Wassershader [Re: Steempipe] #31691
08/18/04 15:33
08/18/04 15:33
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
Man i'm not getting it to work..!

Can someone post the sample code to just paste there to see if it workS?

I assign different skin values, and nothing...

Where i define the skills?? And I have this;:

action River {

var ShaderCount;
var ShaderCount2;
while(1){

my.skill41=float(ShaderCount);
my.skill42=float(ShaderCount2);
my.skill43=float(0);
my.skill44=float(0);

ShaderCount += 0.0015;
ShaderCount2 -= 0.0013;





My.skill1=5;// activation dsic
My.skill2= 2; //directions
My.skill3=2; //wave speed
My.skill4= 3; //skwel value
My.skill5=20; //wave size
my.skill6= 2; //crests_per_unit
my.material=mat_riverwater;


wait(1);
}






But the effect look abit weird.. like waves too small
}



And It has no transparency!..How can this be done?

Last edited by Unknot; 08/18/04 16:26.
Re: Probleme mit Wassershader [Re: MMike] #31692
08/18/04 22:29
08/18/04 22:29
Joined: May 2004
Posts: 164
Germany
D
DARKLORD Offline
Member
DARKLORD  Offline
Member
D

Joined: May 2004
Posts: 164
Germany
Könnten wir nochmal zum eigentlichen Problem zurückkehren (Modells werden mit Shader unter Wasser nicht angezeigt)?
Ich habe nähmlich auch dieses Problem und wäre dankbar für eine Lösung.

Re: Probleme mit Wassershader [Re: MMike] #31693
08/19/04 00:12
08/19/04 00:12
Joined: May 2004
Posts: 43
J
JeremyB Offline
Newbie
JeremyB  Offline
Newbie
J

Joined: May 2004
Posts: 43
First, this part:

My.skill1=5;// activation dsic
My.skill2= 2; //directions
My.skill3=2; //wave speed
My.skill4= 3; //skwel value
My.skill5=20; //wave size
my.skill6= 2; //crests_per_unit
my.material=mat_riverwater;

should not be in the loop. The material only needs to be assigned once, before you go into the loop, and the other values as well. You can adjust the size of the waves in the shader by changing the following values. I think if you want to use the skills to affect the values, you will have to change the shader to use them. Right now it seems they are hardcoded. Change the following line to affect the wave size:

// 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};

You only need to change x and y. The smaller the number, the larger the waves.

Re: Probleme mit Wassershader [Re: JeremyB] #31694
08/19/04 04:12
08/19/04 04:12
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710

What those number do?

Like I will give this Variable for bettter understand:
VertexShaderConstant[14]={x, y, A, B};

" VertexShaderConstant[14]={2.0f, 2.0f, 0.0f, 0.0f}; "
What does the A and B does?

Re: Probleme mit Wassershader [Re: MMike] #31695
08/19/04 04:28
08/19/04 04:28
Joined: May 2004
Posts: 43
J
JeremyB Offline
Newbie
JeremyB  Offline
Newbie
J

Joined: May 2004
Posts: 43
As far as I can tell, the script uses the noise texture as three separate "layers". You can get a nice effect by using a different scale and speed for each layer. So:

// 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};

Think of 14 as layer 1, 15 layer 2, and 16 layer 3. You want to use a different scale in each layer to get a more interesting effect. I am using:

VertexShaderConstant[14]={0.1f, 0.1f, 0.0f, 0.0f};
VertexShaderConstant[15]={0.2f, 0.2f, 0.0f, 0.0f};
VertexShaderConstant[16]={0.3f, 0.3f, 0.0f, 0.0f};

How did I get the numbers? Just by messing with them. There is no formula, just find some that look nice.
I also modified my action to make the animation time based instead of frame based:

var ShaderCount;
var ShaderCount2;
action water_shader
{
bmap_to_mipmap(mtl_water.skin1);
bmap_to_mipmap(mtl_water.skin2);
my.material = mtl_water;

while(1)
{
my.skill41=float(ShaderCount);
my.skill42=float(ShaderCount2);

ShaderCount += time;//0.0015;
ShaderCount2 -= time;//0.0013;
wait(1);
}
}

And then I can set the speed here:

// scroll speed - change as needed with model scaling
VertexShaderConstant[11]={0.0001f, 0.001f, 0.0f, 0.0f};
VertexShaderConstant[12]={0.001f, -0.002f, 0.0f, 0.0f};
VertexShaderConstant[13]={0.002f, 0.003f, 0.0f, 0.0f};

And it runs the same rate no matter the what the frame rate is. Again, it is just by trial and error that you will discover the values that work for you. Try a really big number and really small number and see the effect. Just remember that you have really four layers that are interacting to create the final effect (3 layers for the noise and 1 for the base texture).

Page 2 of 4 1 2 3 4

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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