[C++] Reflective Water (conversion from .NET)
Here's a [297KB] video showing the problem at water height -
http://irrlicht.spintz.com/movies/WaterShader2.wmv
And here's a longer video [4.75MB] showing the little demo I've put together showing off the water shader. In this demo( towards the end ) you can see some fragments pop up.
http://irrlicht.spintz.com/movies/WaterShader3.wmv
It looks very good and I'm going to press on looking at how to fix the fragments and look at some of the other water info people have posted recently to spice it up some more.
http://irrlicht.spintz.com/movies/WaterShader2.wmv
And here's a longer video [4.75MB] showing the little demo I've put together showing off the water shader. In this demo( towards the end ) you can see some fragments pop up.
http://irrlicht.spintz.com/movies/WaterShader3.wmv
It looks very good and I'm going to press on looking at how to fix the fragments and look at some of the other water info people have posted recently to spice it up some more.
![Image](http://www.3demon.net/media/logos/logo.png)
That's pretty weird but I'm really looking forward to see a fix. For now I'll try your new shaders and see the difference (because a video is never enough) and I'll try to fix the GLSL shader.
For the second bug, I fixed it on my scene node by adding a clamp shader. This is a really ugly shader but since Irrlicht does not support clip planes, I had to do that. This bug is due to the fact that nothing under the water height should be drawn on the refraction texture.
EDIT : Okay, I took your HLSL shader and my GLSL shader, the GLSL works perfectly (with no stretching texture bug) and the HLSL works quite better since the only bug there is is this texture stretching bug when you are at the water height.
Here are the shaders :
http://irrlichtnetcp.svn.sourceforge.ne ... iew=markup
For the second bug, I fixed it on my scene node by adding a clamp shader. This is a really ugly shader but since Irrlicht does not support clip planes, I had to do that. This bug is due to the fact that nothing under the water height should be drawn on the refraction texture.
EDIT : Okay, I took your HLSL shader and my GLSL shader, the GLSL works perfectly (with no stretching texture bug) and the HLSL works quite better since the only bug there is is this texture stretching bug when you are at the water height.
Here are the shaders :
http://irrlichtnetcp.svn.sourceforge.ne ... iew=markup
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
I didn't keep the "clamp shader" when I converted the code (thanks again to DeusXL) as I intended to put in a better solution. I've been kinda sidetracked this week with throwing crates around Quake3 levels and watching them bounce and tumble around (Irrlicht+Newton physics).
What's needed is a clip plane. DeusXL has mentioned this in a separate topic and one reply said Irrlicht didn't support it, which is almost true. It may not be nice, but I was going to use IVideoDriver::getExposedData() to get the driver, set a user clip plane, render the reflected geometry then reset the user clip plane.
![Cool 8)](./images/smilies/icon_cool.gif)
What's needed is a clip plane. DeusXL has mentioned this in a separate topic and one reply said Irrlicht didn't support it, which is almost true. It may not be nice, but I was going to use IVideoDriver::getExposedData() to get the driver, set a user clip plane, render the reflected geometry then reset the user clip plane.
These "half float" precisions are denoted by 'half' while full float precisions are denoted simply by 'float'. We're not using half's anywhere, so don't think that's the problem. The user clip plane I believe could be the problem with the artifacts you see in the larger video I posted. They only appear to be close to the camera maybe because of some screwy Z-ordering, but they are most likely far away on the water plane. I'm going to add user clip planes to IrrSpintz and see if that fixes the problem.omaremad wrote:I think i read somewhere that dx has half percision floats and full precision, maybe thats why the glsl isnt buggy. The dx compiler might be deaulting to low aquracy.
![Image](http://www.3demon.net/media/logos/logo.png)
I know there is a lack of halves but some vendors cheat and still do stuff in less percision to get more speed.
I think there are certain tricks that can be applied to the shader compilers in the drivers. Nvidia made a driver that made 3dmark process allot less pixels than it should do thus doing it faster and getting fake scores.
I think there are certain tricks that can be applied to the shader compilers in the drivers. Nvidia made a driver that made 3dmark process allot less pixels than it should do thus doing it faster and getting fake scores.
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
I enabled clip planes. Fixes the artifact problem in OpenGL and DX. However, I'm having a problem with clip planes, in DX.
I'm setting the clip plane to 0,0,0 with a normal of 0,1,0. In DX, this also clips the skybox, which I cant figure out why( clip planes are all new to me ). Anyone have any clue why that would happen? It doesn't happen in OpenGL.
I'm setting the clip plane to 0,0,0 with a normal of 0,1,0. In DX, this also clips the skybox, which I cant figure out why( clip planes are all new to me ). Anyone have any clue why that would happen? It doesn't happen in OpenGL.
![Image](http://www.3demon.net/media/logos/logo.png)
Maybe clip planes in ogl dont work on things that have depth testing disabled, while in dx they work all the time. Try enabling the clip plane right after the skybox is drawn (cscenemanger.cpp)
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
sio2 : Yeah, I know that about DX and clip planes, it really sucks.
omaremad : I was thinking that as well. That's probably the only way to do it. I was hoping for a way without doing that. For our purposes it would work, but if you wanted to just set a clip plane and leave it for multiple frames, this would end up being a waste, as you'd have to keep setting/unsetting it constantly.
I've also found a bug with the clip planes in OpenGL I need to fix as well, it's as if the clip plane being transformed by view space or something. I'll get a screenshot/movie of that up sometime this week.
omaremad : I was thinking that as well. That's probably the only way to do it. I was hoping for a way without doing that. For our purposes it would work, but if you wanted to just set a clip plane and leave it for multiple frames, this would end up being a waste, as you'd have to keep setting/unsetting it constantly.
I've also found a bug with the clip planes in OpenGL I need to fix as well, it's as if the clip plane being transformed by view space or something. I'll get a screenshot/movie of that up sometime this week.
![Image](http://www.3demon.net/media/logos/logo.png)
Nice shader, thanks to all who contribute. With pertubation we even had a nice ocean shader, but this on should be already good for indoor pools and very calm lakes. Got the stuff working from page one and packed it with the media file and codeblocks project file into a 7z compressed package.
Works out of the box that way, if you use codeblocks and mingw. This is for all the more "artist" oriented people or those with less time.
Grab it here:
http://fileho.com/download/8f1b09649110/water.7z.html
ca. 3MB, fast server
Works out of the box that way, if you use codeblocks and mingw. This is for all the more "artist" oriented people or those with less time.
Grab it here:
http://fileho.com/download/8f1b09649110/water.7z.html
ca. 3MB, fast server
-
- Posts: 299
- Joined: Mon Nov 27, 2006 6:52 pm
- Location: GERMANY
- Contact:
Hey Spintz or sio2, I hope you read that....
I've got an issue with the reflective water. The images should explain better than words...
![Image](http://www.masterhawk-studios.de/upload/probimages/refwater001.jpg)
![Image](http://www.masterhawk-studios.de/upload/probimages/refwater002.jpg)
![Image](http://www.masterhawk-studios.de/upload/probimages/refwater003.jpg)
On the last pic you see what I'm supposed to see all the time. But the right reflection only appear when the camera angle is like on the last pic. A little too high(like on pic 1 + 2) and the reflection is gone....
Is there anything I can do?
I've got an issue with the reflective water. The images should explain better than words...
![Image](http://www.masterhawk-studios.de/upload/probimages/refwater001.jpg)
![Image](http://www.masterhawk-studios.de/upload/probimages/refwater002.jpg)
![Image](http://www.masterhawk-studios.de/upload/probimages/refwater003.jpg)
On the last pic you see what I'm supposed to see all the time. But the right reflection only appear when the camera angle is like on the last pic. A little too high(like on pic 1 + 2) and the reflection is gone....
Is there anything I can do?
Last edited by Masterhawk on Fri Jul 20, 2007 8:48 am, edited 1 time in total.