Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
0 registered members (), 730 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Ocean Water Shader #24659
03/25/04 20:31
03/25/04 20:31
Joined: Mar 2004
Posts: 102
T
Taros Offline OP
Member
Taros  Offline OP
Member
T

Joined: Mar 2004
Posts: 102
Well, here is a ocean water shader that Steempipe and I converted (but Steempipe did most of the work :P). Okay here are the pics:

Picture 1
Picture 2
The Shader

Constants and what they do:

Vertex Shader Constants
v0 - Vertex Position
v3 - Vertex Normal
v7 - Vertex Texture Data u,v
v8 - Vertex Tangent (v direction)
v5 - Wave Height Scale

c0 - { 0.0, 0.5, 1.0, 2.0}
c1 - { 4.0, .5pi, pi, 2pi}
c2 - {1, -1/3!, 1/5!, -1/7! } //for sin
c3 - {1/2!, -1/4!, 1/6!, -1/8! } //for cos
c4-7 - Composite World-View-Projection Matrix
c8 - ModelSpace Camera Position
c9 - ModelSpace Light Position
c10 - {fixup factor for taylor series imprecision, }
c11 - {waveHeight0, waveHeight1, waveHeight2, waveHeight3}
c12 - {waveOffset0, waveOffset1, waveOffset2, waveOffset3}
c13 - {waveSpeed0, waveSpeed1, waveSpeed2, waveSpeed3}
c14 - {waveDirX0, waveDirX1, waveDirX2, waveDirX3}
c15 - {waveDirY0, waveDirY1, waveDirY2, waveDirY3}
c16 - { time, sin(time)}
c17 - {basetexcoord distortion x0, y0, x1, y1}
c18 - World Martix

Enjoy!

PS: If the link doesn't work right click on them, properties, copy the url and paste it to your browser

EDIT: Fixed some broken links


Re: Ocean Water Shader [Re: Taros] #24660
03/25/04 20:51
03/25/04 20:51
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
good work! but how do you set up v5 for the wave height, say how do you change it?


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Ocean Water Shader [Re: Taros] #24661
03/25/04 21:24
03/25/04 21:24
Joined: Jun 2003
Posts: 1,017
Germany
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

Joined: Jun 2003
Posts: 1,017
Germany
Hey!
Great work! The screenshots look very nice
Unfortunately I can't see the sahder in action because it needs ps 1.4 so... is there possibly any way to convert it to 1.3? This would be very very useful, as maybe everyone has a directx 8 graphics card when my project (and many others running at the moment, too) is finished, but not necessarily an ATI one with ps 1.4! And as great as the shader looks like, it would be quite unfortunate to have to switch off the shader with geforce 4 ord geforce 3 cards wouldn't it?


Formerly known as The Matrix - ICQ 170408644 I've been here for much longer than most people think. So where's my "Expert" status?
Re: Ocean Water Shader [Re: Thomas_Nitschke] #24662
03/25/04 21:57
03/25/04 21:57
Joined: Mar 2004
Posts: 102
T
Taros Offline OP
Member
Taros  Offline OP
Member
T

Joined: Mar 2004
Posts: 102
@ello

The wave height is controled by the c11 vertex shader constant so if you want to change the wave height change the values to something like
vertexshaderconstant[11]={16, 15, 14, 16}; for some weird results
v5... really don't know i guess the vertex shader does that Did i mention that this is a conversion of Ati's shader

Also, the wave appearance and scale is controled by the bumpmap. And if there is some strange shader behavior like a corner of a model being cut of or distorted you must use a model with more vertices (i used a plain old quad for the picture).

@The Matrix

Yeah, i know it's a shame. I'll try to convert it to ps1.3 or lower but who knows when that will be (i'm a shader n00b ) and most of this shader is done by trial and error and Steempipe's help



Re: Ocean Water Shader [Re: Taros] #24663
03/25/04 22:26
03/25/04 22:26
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Is this shader not the same as this: Ocean Water Shader. But your shader is also cool.

Re: Ocean Water Shader [Re: oliver2s] #24664
03/26/04 00:18
03/26/04 00:18
Joined: Mar 2004
Posts: 102
T
Taros Offline OP
Member
Taros  Offline OP
Member
T

Joined: Mar 2004
Posts: 102
Hehe this is great

We have a two almost indentical shaders. I downloaded and converted mine from the ati developers page.

I could have just used yours

Re: Ocean Water Shader [Re: Taros] #24665
03/26/04 04:10
03/26/04 04:10
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
In Antwort auf:

I could have just used yours




But now you have more experience in shaderprogramming (or converting).


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