Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/26/24 12:45
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,160 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 9 1 2 3 4 5 6 7 8 9
Re: Realtime water reflections shader [Re: XNASorcerer] #40468
02/05/05 23:19
02/05/05 23:19
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
You can set transparency if the skin texture of the water model has a alpha channel (in which the alpha is set).

Why does WED crashs?

Re: Realtime water reflections shader [Re: oliver2s] #40469
02/06/05 00:02
02/06/05 00:02
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline OP
Expert
XNASorcerer  Offline OP
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
If I use your level, the code works, but if I try to use your code in any other level, Wed crashs and it doesn't give any information.
The steps that I did to use your code:
* Make a new level.
* Open Map Properties and set the script to water_shader.wdl.
* Put water model inside and give it the water action.
* Run the level and Wed crashs.


OBS.: The engine is crashing, not Wed. Sorry!

Last edited by Sorcerer; 02/06/05 00:55.
Re: Realtime water reflections shader [Re: XNASorcerer] #40470
02/06/05 22:30
02/06/05 22:30
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline OP
Expert
XNASorcerer  Offline OP
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Yes, finally. Just when I was going to my bed, I decide to give it just one more try. It is working now. But it gives me some limitation. For instance, you use a called model floor.mdl as water. He only has 4 vertexes and two faces. And I need to use a terrain with 2025 vertexes. With my terrain, the effect is realy terrible.

This is with your floor.mdl:


This is with my terrain:


Last edited by Sorcerer; 02/06/05 22:38.
Re: Realtime water reflections shader [Re: XNASorcerer] #40471
02/06/05 22:51
02/06/05 22:51
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
This happens if your terrain has no 3rd skin.
1# skin: render-to-texture texture
2# skin: not used
3# skin: normalmap

Re: Realtime water reflections shader [Re: oliver2s] #40472
02/06/05 23:21
02/06/05 23:21
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline OP
Expert
XNASorcerer  Offline OP
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Thank you. That's the reason, because it works now.
And the reason that I coudn't use it before is: This shader needs blocks in the level. And all my blocks is map entities. So, with a big hollowed block with the sky flag on in my level, the shader started to work.

Re: Realtime water reflections shader [Re: oliver2s] #40473
02/06/05 23:27
02/06/05 23:27
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline OP
Expert
XNASorcerer  Offline OP
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
The skin texture of the water model has a alpha channel. Now how can make it look a litle bit transparent?

Re: Realtime water reflections shader [Re: XNASorcerer] #40474
02/06/05 23:35
02/06/05 23:35
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
I thought with a alphachannel it would work, but it doesn't. There must be something changed in the shader.

Re: Realtime water reflections shader [Re: oliver2s] #40475
02/06/05 23:48
02/06/05 23:48
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline OP
Expert
XNASorcerer  Offline OP
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
With the other shader that Iwas using, the one that only reflects the sky cubes(Steempipe's), I could set alpha transparency with this:

Code:
 
AlphaBlendEnable = True;
ZwriteEnable = True;
ZEnable = True;

// Main point is that pixelShaderConstant 'W' will control the alpha tranparency. The XYZ will adjust some coloring.

PixelShaderConstant[0] = {0.80,0.80,0.92,0.88}; // x, y, z, w



,before "VertexShader = compile vs_1_1 WaterBump_VS();"

Re: Realtime water reflections shader [Re: XNASorcerer] #40476
02/07/05 01:25
02/07/05 01:25
Joined: May 2004
Posts: 66
Brazil
key_46 Offline
Junior Member
key_46  Offline
Junior Member

Joined: May 2004
Posts: 66
Brazil
This Water Reflection impressed me, can you release the code?


ADPA Ataque Dos Pôneis Assassinos! Atack Of Killer Ponys! ADPA(R) all rights reserved
Re: Realtime water reflections shader [Re: key_46] #40477
02/07/05 02:58
02/07/05 02:58
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
to adjust the transparency try something like this fake fresnel term i devised:
put this in your vertex shader output struct:
float4 fresnel: COLOR0;

put this in the vertex shader:
float3 PositionWorld = mul(Pos, matWorld);
float dist=distance(PositionWorld, vecViewPos);

if (dist<=300)
{
Out.fresnel.xyzw=dist*0.005;
}

if (dist>300)
{
Out.fresnel.xyzw=1.0;
}

put this in the pixel shader input
float4 fresnel:COLOR0

then in the pixel shader at the end:

float4 final=reflection;

float3 watercolor=(0.58,0.65,0.63); //adjust this change water coloring

final.rgb*=watercolor;

final.w=(1*fresnel)*0.8;

this adjusts transparency based on view distance-but your water terrain needs a lot of faces. You said yours did so it should work. There are better ways to do this, like a real fresnel term, but this works for my purposes.

also, in the technique part of the fx file put these lines before you compile the shaders:
zwriteenable=false;
zenable=true;
alphablendenable=true;


Page 4 of 9 1 2 3 4 5 6 7 8 9

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