Ways of splitscreen with water scene node [SOLVED]

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!
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

worse i dont have split screen and i cant see the water
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

zillion42 wrote: see the (very old) example from sio2 'dynamic reflection' to learn about bad frame rates...
I downloaded the source to the demo and compiled it as-is with Irrlicht 1.5: frame rate 460 fps.

I then used setHardwareMappingHint() to put the meshes in a static buffer: frame rate 1104fps.

Code changes:

Code: Select all

	// Room scene - no floor
	IAnimatedMesh* giMesh = smgr->getMesh("./data/giroom_no_floor.b3d");
	//ISceneNode* giNode = smgr->addOctTreeSceneNode(giMesh->getMesh(0));
	IMesh *pMesh = giMesh->getMesh(0);
	pMesh->setHardwareMappingHint(irr::scene::EHM_STATIC);
	ISceneNode* giNode = smgr->addMeshSceneNode(pMesh);
	giNode->setMaterialFlag(EMF_LIGHTING, false);

	// Floor only - this will be hold the reflections
	IAnimatedMesh* giFloorMesh = smgr->getMesh("./data/giroom_floor.b3d");
	pMesh = giFloorMesh->getMesh(0);
	pMesh->setHardwareMappingHint(irr::scene::EHM_STATIC);
	ISceneNode* giFloor = smgr->addMeshSceneNode(pMesh);
	giFloor->setMaterialFlag(EMF_LIGHTING, false);
	giFloor->setVisible(false);
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

well, finally I get to speak to you in person... No in fact the framerate wasn't bad at all, the framerate of the reflection seemed to be bad... Or at least the symptoms were that the reflection generally lagged behind and wasn't properly alligned, you can even see that when looking at the picture from your website... look at the chair reflection...
Image
another issue: When turning on AA the reflection of quite a few objects simply disappears... any clue about that...
edit: I helped myself and made quite a similar shader based on the waterscene node... I borrowed your room for testing... :oops:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32135
Image
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

hmmm... very interesting static meshes!

but the on animate function doesn't seem to work. And I run on OpenGL, so im trying to translate your shaders into GLSL for floor.

P.S. Sio2 what are your computer specs???
EDIT: static mesh flag does not boost my fps.
Last edited by devsh on Sat Feb 14, 2009 5:45 pm, edited 2 times in total.
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I started to play around with the shader for water and added a reflectivity factor. I.e the bigger it is the more of the reflection you see (original is 0.25). But When I go over 1 with the reflectivity factor, i start to get this really fun effect that i'd call "Radio-active water" this is basically the colours becoming over saturated.
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I still cant get the water scene node to work by calling OnAnimate() without having put : ISceneNode(smgr->getRootSceneNode(),

EDIT: WAIT DO I HAVE TO OVERRIDE THE RENDER METHOD???

P.S. I wont be here for a week, but please dont stop posting, maybe i will finally get somewhere.

EDIT: I doesnt even work when i render it using the mesh buffer. Maybe the shader material flag is beyond repair???
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I tried everything, disabling shader, disabling RTT. And it JUST WONT DRAW ITSELF by just using OnAnimate.

what to do now??

EDIT: OnAnimate doesn't draw it!!
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

devsh wrote:EDIT: static mesh flag does not boost my fps.
1. if you're using octree nodes then the setHardwareMappingHint won't have an effect, since they are dynamic meshes. Look at my snippet - I changed the octree mesh to a standard mesh. did you test to see where your meshes ended up?
2. grab my reflections demo and change the code as per my above post. See what frame rate difference you get. You should get a big boost regardless of video card.
devsh wrote:I tried everything, disabling shader, disabling RTT. And it JUST WONT DRAW ITSELF by just using OnAnimate.

what to do now??
Debug it and fix it. Have you traced it through the debugger with a debug build of Irrlicht?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

devsh wrote:I tried everything, disabling shader, disabling RTT. And it JUST WONT DRAW ITSELF by just using OnAnimate.

what to do now??

EDIT: OnAnimate doesn't draw it!!
Uh, yeah. OnAnimate() doesn't draw anything. That is what render() is for.

Travis
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

i know but i always have to override render (pure function or summink) and so render is

void render() {}

i tried making the driver drawMeshBuffer in the render function, but that doesnt work either.

What should i put there??
Pyritie
Posts: 120
Joined: Fri Jan 16, 2009 12:59 pm
Contact:

Post by Pyritie »

Lol, there's your problem then.
Hive Workshop | deviantART

I've moved to Ogre.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Maybe you're forgetting to set the world transform? Or returning an invalid bbox?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I think i got it
Water->OnAnimate();
Water->OnRegisterSceneNode();
Water->render();

but there is a slight proble, since render() is a pure virtual function it has been overriden by elvman and its empty.

ok sorry for n00by question

i have a pointer to the mesh (which is a hillplane mesh) that is under private data.

so in the render function what do i call??

P.S. if I call drawmeshbuffer and i feed in WaterMesh->getMeshBuffer() will it draw the texture on it too??
Post Reply