Page 8 of 8

Re: Realistic water node

Posted: Thu Sep 29, 2016 7:47 pm
by Vectrotek
Thanks The_Glitch! I'm going to have to do a MAJOR update on my Computers,
Software, Major Backups, Net connections, Everything!
Must get Windows 10, I've got a 64 bit Asus M-board, but it's old..

Cheers!

Re: Realistic water node

Posted: Thu Sep 29, 2016 8:10 pm
by The_Glitch
Don't get windows 10 it's crap.

Re: Realistic water node

Posted: Thu Sep 29, 2016 8:13 pm
by Vectrotek
You reckon?

Re: Realistic water node

Posted: Thu Sep 29, 2016 8:15 pm
by Vectrotek
Windows 7? Obviously.. Thanks!

Re: Realistic water node

Posted: Tue Jan 03, 2017 7:03 am
by rustyk
@Vectrotek

Could you upload your demo/source on other sites other than tinyupload? I'm getting malware alert and blocks from Chrome..

thanks.

Re: Realistic water node

Posted: Tue Jan 03, 2017 2:01 pm
by Vectrotek
Chrome doesn't like downloading Zip files that contain EXE files.

All you have to do is to go to Chrome Settings - Advanced Settings
and DISABLE the "Protect you and your device from dangerous sites" option
before download. (frustrating I know)

Important:
Remember to ENABLE the option again AFTER the download..

Re: Realistic water node

Posted: Sat Aug 26, 2017 12:51 pm
by Seven
trying to setup this nope to only render a portion of the screen.
attempted to use this code to no avail.

my thought was to save the current viewport, modify the viewport and then return the viewport to original.
any ideas on rendering to only a portion of the screen?

Code: Select all

 
void RealisticWaterSceneNode::OnAnimate(u32 timeMs)
{
    ISceneNode::OnAnimate(timeMs);
 
    _time = timeMs;
 
    //fixes glitches with incomplete refraction
    const f32 CLIP_PLANE_OFFSET_Y = 5.0f;
 
    if (IsVisible)
    {
        setVisible(false); //hide the water
 
 
        // seven - save the viewport, modify it and then later return it to original.
        const irr::core::rect<s32> r(100,100,150,200);
        irr::core::rect<s32> oldViewport = _videoDriver->getViewPort();
        _videoDriver->setViewPort(r);
 
 
 
        //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);
 
        //set back the active camera
        _sceneManager->setActiveCamera(currentCamera);
 
        // seven - return the viewport to the original size
        _videoDriver->setViewPort(oldViewport);
 
        setVisible(true); //show it again
    }
}