Page 2 of 18

Posted: Mon Aug 20, 2007 10:31 am
by elvman
[*] Refraction is supported
[*] setClipPlane can be disabled, but the result can be a little bit cracky (you will have to wait for Irrlicht 1.4).
[*] I haven't seen the problem with skyboxes (I will check it out). It would be much better if Irrlicht supported CubeMaps!

Posted: Mon Aug 20, 2007 3:23 pm
by andrei25ni
The code is not compiling under 1.3.1 :

Code: Select all

18 cpp\RealisticWater.cpp no matching function for call to `irr::scene::ISceneManager::addHillPlaneMesh(const char[15], irr::core::dimension2d<irr::f32>&, irr::core::dimension2d<irr::u32>)' 

312 cpp\main.cpp `Water' undeclared (first use this function)
312 cpp\main.cpp `width' undeclared (first use this function) 
312 cpp\main.cpp `height' undeclared (first use this function) 
312 cpp\main.cpp `VideoDriver' undeclared (first use this function)
312 cpp\main.cpp `Irrlicht' undeclared (first use this function)    
:roll:

Posted: Mon Aug 20, 2007 7:58 pm
by elvman
In irrlicht 1.3.1 you will have to change the line 18 in .cpp file to this:

Code: Select all

scene::IAnimatedMesh* WaterMesh=SceneManager->addHillPlaneMesh("realisticwater",Size,core::dimension2d<s32>(1,1));
312 cpp\main.cpp `Water' undeclared (first use this function)
312 cpp\main.cpp `width' undeclared (first use this function)
312 cpp\main.cpp `height' undeclared (first use this function)
312 cpp\main.cpp `VideoDriver' undeclared (first use this function)
312 cpp\main.cpp `Irrlicht' undeclared (first use this function)
You can do it like this:

Code: Select all

RealisticWaterSceneNode* Water=new RealisticWaterSceneNode(SceneManager, 256.0f, 256.0f,		VideoDriver->getTexture("data/waterbump.png"),Irrlicht->getTimer());
VideoDriver is the pointer to your IVideoDriver and Irrlicht is the pointer to your IrrlichtDevice.

Posted: Mon Aug 20, 2007 10:02 pm
by krama757
So here is what it looks like to me:
Image

Here is the code I used:

Code: Select all

 
RealisticWaterSceneNode* pWater;

pWater = new RealisticWaterSceneNode(irrSceneMan, 2100.0f, 2100.0f, irrDriver->getTexture("data/textures/env/waterbump.png"),irrDevice->getTimer());


Posted: Mon Aug 20, 2007 10:46 pm
by elvman
It looks like your backbuffer is smaller than the RTT of the water. You will have to do it like this:

Code: Select all

RealisticWaterSceneNode* pWater;

pWater = new RealisticWaterSceneNode(irrSceneMan, 2100.0f, 2100.0f, irrDriver->getTexture("data/textures/env/waterbump.png"),irrDevice->getTimer(),core::dimension2di(256,256));

Posted: Mon Aug 20, 2007 11:07 pm
by krama757
Hmm, nope, using that exact code I got the same result as the image. Also, now using this code gives me an error in IUnknown.h

Code: Select all

bool drop()
		{
			_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0) // someone is doing bad reference counting.

			--ReferenceCounter;
			if (!ReferenceCounter)
			{
				delete this;
				return true;
			}

			return false;
		}

Posted: Tue Aug 21, 2007 2:13 am
by christianclavet
Hi Elvman.

I was able to successfully implement your codes into my demo!
I've had only a texture problem (a file as DDS extension.) Converted it as a PNG file.

Here some screenshots of the implementation (Developping with DEVCPP with IRRLICHT 1.3.1)
Image
Image

I noted your nickname and your site for the water rendering in the text file accompagning my demo.

Posted: Tue Aug 21, 2007 3:13 am
by christianclavet
Just found out something weird... Refraction seem to fade on certain angles of the camera (X angles)

I've played in my demo and seen that if im checing the water in the direction of my sun (skybox); I see the refraction.

But, if I'm turning around 180 degrees, the refraction is not there anymore.

Can you check this? I'm using the FPSCamera can this have an incidence over this problem?

Posted: Tue Aug 21, 2007 8:28 am
by JP
As i said in Christian's project thread there's something iffy about the reflection in the first screenshot there; where the sky is reflecting instead of the bottom of the little hill.. any ideas Elvman? I suppose that could be to do with the clipping planes maybe...

Posted: Tue Aug 21, 2007 8:30 am
by krama757
Yep most definately. If you far enough upward the water below you stops refracting. But I did manage to implement it :)

Image

Posted: Tue Aug 21, 2007 9:47 am
by elvman
The first srceenshot got problems with clip planes, but that is already fixed. I will try to fix all other problems today.

Posted: Tue Aug 21, 2007 3:50 pm
by andrei25ni
Hey elvman, thank you very much for your quick response.
But I still can't get it to compile, I get :

Code: Select all

RealisticWater.o(.text+0x0):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::RealisticWaterSceneNode(irr::scene::ISceneManager*, float, float, irr::video::ITexture*, irr::ITimer*, irr::core::dimension2d<int>, irr::scene::ISceneNode*, int)'
main.o(.text+0x100):main.cpp: first defined here
RealisticWater.o(.text+0xa80):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::RealisticWaterSceneNode(irr::scene::ISceneManager*, float, float, irr::video::ITexture*, irr::ITimer*, irr::core::dimension2d<int>, irr::scene::ISceneNode*, int)'
main.o(.text+0xb80):main.cpp: first defined here

RealisticWater.o(.text+0x1508):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::~RealisticWaterSceneNode()'
main.o(.text+0x1608):main.cpp: first defined here
RealisticWater.o(.text+0x1722):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::~RealisticWaterSceneNode()'
main.o(.text+0x1822):main.cpp: first defined here
RealisticWater.o(.text+0x193a):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::~RealisticWaterSceneNode()'
main.o(.text+0x1a3a):main.cpp: first defined here
RealisticWater.o(.text+0x1b52):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::OnRegisterSceneNode()'
main.o(.text+0x1c52):main.cpp: first defined here
RealisticWater.o(.text+0x1ba2):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::OnAnimate(unsigned int)'
main.o(.text+0x1ca2):main.cpp: first defined here
RealisticWater.o(.text+0x1ef0):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::render()'
main.o(.text+0x1ff0):main.cpp: first defined here
RealisticWater.o(.text+0x1ef6):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::getBoundingBox() const'
main.o(.text+0x1ff6):main.cpp: first defined here
RealisticWater.o(.text+0x1f1c):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::OnSetConstants(irr::video::IMaterialRendererServices*, int)'

main.o(.text+0x201c):main.cpp: first defined here
RealisticWater.o(.text+0x2318):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::setWindForce(float)'
main.o(.text+0x2418):main.cpp: first defined here

RealisticWater.o(.text+0x232a):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::setWindDirection(irr::core::vector2d<float>)'
main.o(.text+0x242a):main.cpp: first defined here
RealisticWater.o(.text+0x2356):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::setWaveHeight(float)'
main.o(.text+0x2456):main.cpp: first defined here
RealisticWater.o(.text+0x2368):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::setWaterColor(irr::video::SColorf)'
main.o(.text+0x2468):main.cpp: first defined here

RealisticWater.o(.text+0x238e):RealisticWater.cpp: multiple definition of `RealisticWaterSceneNode::setColorBlendFactor(float)'
main.o(.text+0x248e):main.cpp: first defined here
[/size]

My header from main.cpp looks like this :

Code: Select all

#include <irrlicht.h>

#include <iostream>
#include <audiere.h>

#include <irrXML.h>
#include "windows.h"
#include <string>

using namespace irr;
using namespace io;
using namespace scene;
using namespace core;
using namespace video;
using namespace gui;
using namespace std;
using namespace audiere;
#include "RealisticWater.cpp"

#pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib, "audiere.lib")
I have no ideea what to search for ,in order to fix.

Cheers.

Posted: Tue Aug 21, 2007 3:54 pm
by hybrid
You shouldn't include .cpp files :?

Posted: Tue Aug 21, 2007 6:20 pm
by fmx
elvman
you've done a great job with this!
Thanks a lot!


andrei25ni

Code: Select all

#include "RealisticWater.cpp" 
as hybrid says, this line of code looks really strange...
I can't really help you any more than this, because I haven't tried to compile it for myself yet :(

Posted: Tue Aug 21, 2007 7:01 pm
by andrei25ni
Thanks alot hybrid, that did it.
It now compiles.
That's what happens when a modeler tries to do code... :shock:

Sorry to elvman for bumping his topic.

Cheers.