Realistic water node

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!

Re: Realistic water node

Postby Vectrotek » Thu Sep 29, 2016 7:47 pm

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!
User avatar
Vectrotek
Competition winner
 
Posts: 1077
Joined: Sat May 02, 2015 5:05 pm
Location: South Africa

Re: Realistic water node

Postby The_Glitch » Thu Sep 29, 2016 8:10 pm

Don't get windows 10 it's crap.
User avatar
The_Glitch
Competition winner
 
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Postby Vectrotek » Thu Sep 29, 2016 8:13 pm

You reckon?
User avatar
Vectrotek
Competition winner
 
Posts: 1077
Joined: Sat May 02, 2015 5:05 pm
Location: South Africa

Re: Realistic water node

Postby Vectrotek » Thu Sep 29, 2016 8:15 pm

Windows 7? Obviously.. Thanks!
User avatar
Vectrotek
Competition winner
 
Posts: 1077
Joined: Sat May 02, 2015 5:05 pm
Location: South Africa

Re: Realistic water node

Postby rustyk » Tue Jan 03, 2017 7:03 am

@Vectrotek

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

thanks.
rustyk
 
Posts: 25
Joined: Sat Jan 10, 2015 4:03 pm

Re: Realistic water node

Postby Vectrotek » Tue Jan 03, 2017 2:01 pm

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..
User avatar
Vectrotek
Competition winner
 
Posts: 1077
Joined: Sat May 02, 2015 5:05 pm
Location: South Africa

Re: Realistic water node

Postby Seven » Sat Aug 26, 2017 12:51 pm

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?

cpp 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
    }
}
Seven
 
Posts: 888
Joined: Mon Nov 14, 2005 2:03 pm

Previous

Return to Advanced Help

Who is online

Users browsing this forum: No registered users and 1 guest