Realistic water scene node
Re: Realistic water scene node
Did you read my post? You need to adjust the clip plane
-
- Posts: 62
- Joined: Wed Feb 06, 2013 12:11 pm
Re: Realistic water scene node
Ok, thanks.
But how do I do that?
But how do I do that?
Re: Realistic water scene node
I will look into this. Thanks for feedback.
Re: Realistic water scene node
Code: Select all
void RealisticWaterSceneNode::OnAnimate(u32 timeMs)
{
ISceneNode::OnAnimate(timeMs);
_time = timeMs;
//fixes glitches with incomplete refraction
const f32 CLIP_PLANE_OFFSET_Y = 250.0f;//5.0f
if (IsVisible)
{
setVisible(false); //hide the water
//refraction
_videoDriver->setRenderTarget(_refractionMap, true, true); //render to refraction
//refraction clipping plane
core::plane3d<f32> refractionClipPlane(0, RelativeTranslation.Y + CLIP_PLANE_OFFSET_Y, 0, 0, -1, 0); //refraction clip plane
_videoDriver->setClipPlane(0, refractionClipPlane, true);
_sceneManager->drawAll(); //draw the scene
//reflection
_videoDriver->setRenderTarget(_reflectionMap, true, true); //render to reflection
//get current camera
scene::ICameraSceneNode* currentCamera = _sceneManager->getActiveCamera();
//set FOV anf far value from current camera
_camera->setFarValue(currentCamera->getFarValue());
_camera->setFOV(currentCamera->getFOV());
core::vector3df position = currentCamera->getAbsolutePosition();
position.Y = -position.Y + 2 * RelativeTranslation.Y; //position of the water
_camera->setPosition(position);
core::vector3df target = currentCamera->getTarget();
//invert Y position of current camera
target.Y = -target.Y + 2 * RelativeTranslation.Y;
_camera->setTarget(target);
//set the reflection camera
_sceneManager->setActiveCamera(_camera);
//reflection clipping plane
core::plane3d<f32> reflectionClipPlane(0, RelativeTranslation.Y - CLIP_PLANE_OFFSET_Y, 0, 0, 1, 0);
_videoDriver->setClipPlane(0, reflectionClipPlane, true);
_sceneManager->drawAll(); //draw the scene
//disable clip plane
_videoDriver->enableClipPlane(0, false);
//set back old render target
_videoDriver->setRenderTarget(0, false, true);
//set back the active camera
_sceneManager->setActiveCamera(currentCamera);
setVisible(true); //show it again
}
}
Re: Realistic water scene node
where can i get waterNormal.png and waterDvDv.png file from?
Hello (water)World
I hope not to be off-topic, but I realize that many people here are using elvman's Realistic Water (https://github.com/elvman/RealisticWaterSceneNode).
As a newbie, I am looking for a simple example ('Hello World style') using elvman's Realistic Water.
Please, can you suggest the corresponding source code?
As a newbie, I am looking for a simple example ('Hello World style') using elvman's Realistic Water.
Please, can you suggest the corresponding source code?
Re: Realistic water scene node
I uploaded a sample app, that runs on OSX. If it doesn't run on Windows, please let me know, I will try to fix it later.
http://elviss.lv/files/water_sample.zip
http://elviss.lv/files/water_sample.zip
Re: Realistic water scene node
What causes this:
-Diho
-Diho
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
Re: Realistic water scene node
Your image isn't appearing, but I found the redirect to the actual image for anyone interested:diho wrote:What causes this:
-Diho
http://postimg.org/image/xsvoezvqj/
I can't answer the question, though, sorry. Hard to say what's going on without knowing how you set things up.
Re: Realistic water scene node
The only code I use is:
Code: Select all
RealisticWaterSceneNode *water = new RealisticWaterSceneNode(smgr, 102400.0f, 102400.0f);
smgr->getRootSceneNode()->addChild(water);
water->setPosition(spawnPoint);
Re: Realistic water scene node
Can you try the demo app that I uploaded?
-
- Competition winner
- Posts: 523
- Joined: Tue Jan 15, 2013 6:36 pm
Re: Realistic water scene node
Has anyone gotten this to work with there main application that is using some rtt effects?
I've looked into changing some things but can't get it to render the water the plane is just black. I believe the waterscenenode does it's own render to texture method and my application does it's own which is the issue just not sure what to change in the waterscenenode as my attempts are not working.
I've looked into changing some things but can't get it to render the water the plane is just black. I believe the waterscenenode does it's own render to texture method and my application does it's own which is the issue just not sure what to change in the waterscenenode as my attempts are not working.
Re: Realistic water scene node
@All
Can anyone explain, why there: https://github.com/elnormous/RealisticW ... r.cpp#L120
In the "RealisticWaterSceneNode::OnAnimate()" we do have 2 times _sceneManager->drawAll(); : one time after refraction, and another after reflection. This reduce FPS x2.
I mean, should't it be calcualted refraction, the refletion, and only then one single "drawall()" call ?
Can anyone explain, why there: https://github.com/elnormous/RealisticW ... r.cpp#L120
In the "RealisticWaterSceneNode::OnAnimate()" we do have 2 times _sceneManager->drawAll(); : one time after refraction, and another after reflection. This reduce FPS x2.
I mean, should't it be calcualted refraction, the refletion, and only then one single "drawall()" call ?
Re: Realistic water scene node
Maybe because Irrlicht didn't have multi render targets when it was coded (wasn't in Irrlicht 1.8 I think).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Realistic water scene node
@CuteAlien
Did it mean that 1.8.4 do have multi-render targets ?
Strange.. I just comment out one single DrawAll() call (first one), and keep just second one, and do have instead of 14 FPS, 24 FPS, and everything working as before.Maybe because Irrlicht didn't have multi render targets when it was coded (wasn't in Irrlicht 1.8 I think).
Did it mean that 1.8.4 do have multi-render targets ?