Page 1 of 18

Realistic water scene node

Posted: Fri Aug 17, 2007 5:34 pm
by elvman
Water scene node with reflections and refractions.

Screenshot:
Image

Download:
GitHub

Usage on Windows:

Code: Select all

water = new RealisticWaterSceneNode(SceneManager, width, height);
Usage on OSX:

Code: Select all

std::string resourcePath()
{
    NSString* path = [[NSBundle mainBundle]resourcePath];
    
    return [path cStringUsingEncoding:NSASCIIStringEncoding];
}
 
water = new RealisticWaterSceneNode(SceneManager, width, height, resourcePath().c_str());
 
Future plans:
Support fog in HLSL
Tessellated look
Caustics
Light support
Optimization in render count

License
Realistic water scene node is released under BSD license. It means that you can use Realistic water scene node in any commercial or noncommercial product, but you (the licensee) must mention my name in the credits of your product and the credits must stay in the source code of the Realistic water scene node.

Posted: Fri Aug 17, 2007 6:10 pm
by christianclavet
Hi!

Cool. Just what I needed to put in my demo!

Do you have a quick example to how to use your code?

From what I saw from the source code It need the shader v2, but you have made the code for DirectX9 and OpenGl. That's very good.

Posted: Fri Aug 17, 2007 10:01 pm
by JP
I think that's the most beautiful irrlicht project i've ever seen! Well done! I think i'll have to take a sneaky peak at your code as the water in my project isn't working quite right.. the reflections and refractions are a bit messed up probably due to me having limited shader knowledge and having nicked the shaders from PS3 tutorials :lol:

Posted: Sat Aug 18, 2007 6:11 am
by Virion
It would be great if irr developers can add this into the engine core.

Posted: Sat Aug 18, 2007 6:45 am
by arras
Looks realy good ...keep it up :)

Posted: Sat Aug 18, 2007 7:00 am
by elvman
Corrected some problems with reflection.

Posted: Sat Aug 18, 2007 7:08 am
by BlindSide
Hey good job, looks like your skill with shaders is improving! :D

Posted: Sat Aug 18, 2007 9:13 am
by elvman
Added OpenGL support (at least tried) and made some minor changes.
There is a problem with OpenGL render targets: it logs the following string to a log: "FBO has one or several image attachments with different dimensions
FBO error", I looked up for this error and found out, that this is OpenGL's GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT error. I tried changing the dimensions of the render target, but had no success. Can anybody test this on your computer and post the results here, please?

Posted: Sat Aug 18, 2007 5:19 pm
by BlindSide
Hey wait a second, is DDS already supported in irrlicht? :? Thats good to hear :D (Seems to me I keep learning of new features in your threads :P )

PS: Have you thought about moving all the update() stuff over to onprerender() (I think thats what its called they may have changed the name) considering that you are already inheriting the scene node interface? This will help it integrate more smoothly with Irrlicht if need be.

Posted: Sat Aug 18, 2007 9:16 pm
by christianclavet
Excellent! Thanks for the example! I'll try this.

Thanks.

Posted: Sat Aug 18, 2007 10:42 pm
by benny53
so does this have refraction as well?

ps: I can't test until my new computer arrives with my 8600gts... so thats why I'm asking here.

Posted: Sun Aug 19, 2007 12:24 am
by Monochrome
holy poop, this is made of win and god \o/

Posted: Sun Aug 19, 2007 6:09 pm
by elvman
Released a new version. The first post was edited.
  • Removed the update function (everything is now done in OnAnimate function).
  • Added the water color (setWaterColor, setColorBlendFactor) so the water now looks more realistic
Screenshot:
Image

P.S. Why does OnAnimate starts with a capital letter? Shouldn't it be onAnimate?

Posted: Sun Aug 19, 2007 11:21 pm
by benny53
@ elvman - does this have refraction?

Posted: Mon Aug 20, 2007 1:13 am
by krama757
Damn this looks beautiful! Elvman I'm going to try to implement this into my game. Thanks a bunch for the code!

There are some problems though. Firstly, we dont have a "setClipPlane()" function in irrlicht 1.3.1. Also, reflection in the water shows the borders between the skybox planes. Any plans on fixing these errors?