Water Demo - Now OpenGL and DX supported

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Ok I converted the shaders to HLSL and added a Direct3D9 version. Anyone having problems previously with the shaders should try the Direct3D9 driver. Same download link.

(Also, Direct3D9 version is a little faster. Infact it is doing 20fps on the Radeon 200M with caustics enabled!)
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Ok I added option for refraction, although it may cause some visual artifacts if enabled. Same download link. Heres a piccy:

Image
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Wow that's looking much better with refractions. I need to get the water reflections fixed in my PS3 game as at the moment the refractions don't work properly (so i disabled them) and the reflections i can't get displaying right either, it's a right nightmare!
Image Image Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

The refraction part is very easy, you just read the DUDVMap then

reflectionCoord.x += DUDVMap.x / (X) - (1 / (X * 2));
reflectionCoord.y += DUDVMap.y / (X) - (1 / (X * 2));

You gotta remember since the DUDV map is the derivative of the normal map this means that it shows the slope of surface. The slope of the surface basically means which direction the entire surface is going to be pointing and hence which direction it will refract.

This is just my method however I havent actually seen any source code that utilizes DUDV maps so it may be totally wrong. But I think it looks ok enough that I will not have to do any studying up on it :P

Cheers I hope that helps.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Hmm, don't think any of the attempts i've been using have used derivatives at all...

It's been very annoying and detracts from the quality of the game massively as you would imagine as the water looks all wrong and it's stopping me from showing it to anyone as it looks cack... And i'd like to show it to ther person responsible for PSN to see if i can get it on there when it's finished, obviously that would be a very good thing for me!

Do you think you'd be able to help me out with it at all? I also need to get clipplanes working (opengl) because at the moment things below the waterline are being reflected when they shouldnt be!
Image Image Image
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Yes, it does look much better with refractions.

Wow BlindSide, this is turning into to quite a good shader.

I have some(possible n00bish) requests(if you want/can/have the time):

* Modifying the vertices of the mesh to create waves
* Adding wind support for the waves
* Adding shore-like shallowness, and transparency(don't know how to explain this)
TheQuestion = 2B || !2B
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

All of those are already there. Except for maybe wind, im not sure what thats supposed to do.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Wow! Nice Blindside. It work now in both OPENGL and DX. :D

The only thing that seem different is the nice border on the terrain in DX that doesnt seem to be there. I've tested will all options enabled.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yes there are some slight differences between DX and OpenGL versions.

OpenGL:
- Light green lining just above water edge on terrain.

DirectX:
- Caustics fade slowly from top shore level down to sea floor.
- Vertices are animated up and down not just sideways. (Similar to the water in the Irrlicht Special FX example included with Irrlicht, this is the reason I removed the greenlining and made caustics fade, so that it does not look weird when water moves up/down).

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I didn't notice any vertex movement on the water.. for me it was just a flat surface that had a normal map on it... (this was with DX9 and answering yes to every question)

I think a lot of the problems i had with my shader was that i was animating the vertices of the water plane with sin functions and though i had the correct normals it messed up the reflections, probably because i was hacking apart a shader that assumed a flat plane or something...
Image Image Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Look at the shore, its easiest to notice it moving up and down there.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah i see it now, very nice!
Image Image Image
porcus
Posts: 149
Joined: Sun May 27, 2007 6:24 pm
Location: Germany

Post by porcus »

Wooooow! Thats really great!
Any chance to get the code ?
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

looks great, congrats.

i'd add more tweaks to it, though. like adding a sine wave function to modulate the water, making a wave effect at closer distance, probably a scene at the beach.

anyway, i thought it wasn't there.
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

That was the coolest thing i have ever seen! Good Job! :D
multum in parvo
Post Reply