Water Demo - Now OpenGL and DX supported
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!)
(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
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Ok I added option for refraction, although it may cause some visual artifacts if enabled. Same download link. Heres a piccy:
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
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
Cheers I hope that helps.
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
Cheers I hope that helps.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
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!
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!
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)
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
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
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
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
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
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
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...
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...
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
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net