terrain LOD problem with camera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
zenoid
Posts: 40
Joined: Wed Jul 20, 2005 1:16 pm
Location: france
Contact:

terrain LOD problem with camera

Post by zenoid »

quickly ; my app merge newton and irrlicht, got a vehicle on a terrain. All the scene is prepared before entering the rendering loop. 3 cameras are set up there ; cockpit cam, fps cam and a mayacam. Then the vehicle is created and the cockpit cam is attached to it. What I see is that there is a LOD problem using only the cockpit cam (can switch bethween cam at run time). It seems that the reference camera position for the LOD rendering stayed at the origin of the terrain(not the point of view) and if I move the vehicle far away, I sometime drive under the ground and the landscape is ugly(low lod). But the vehicle still collide coerently with the terrain. Don't know if it's clear there...

anyone noticed that ?
THX.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

not sure why that would happen. The camera that's used for culling in the terrain node is whatever is returned by smgr->getActiveCamera(). I'd look into that, and make sure the camera you're using is active, maybe there's a bug there.
Image
Fred

Post by Fred »

Sounds like you're using the wrong camera.
zenoid
Posts: 40
Joined: Wed Jul 20, 2005 1:16 pm
Location: france
Contact:

Post by zenoid »

I've read my code again and did not find something wrong but anyway I'am not an experienced C++ coder.

To help you Spintz, my heightmap is scaled 400 times on both x&y axes. I've tried other cam class found and this furum and all show the same pb as soon as attach those one to the vehicle. (vehicle : parent node + 2 billboard for the cam pos and cam dir).

did you find anything ?
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

I wasn't looking for anything. I was suggesting you look to make sure the proper camera is being used by the TerrainNode to do cullling.

I'll try and setup an example with multiple cameras and test that out.
Image
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

in file CTerrainSceneNode.cpp change line 232 from:
core::vector3df cameraPosition = SceneManager->getActiveCamera()->getPosition ( );
to
core::vector3df cameraPosition = SceneManager->getActiveCamera()->getAbsolutePosition ( );

The problem with your code is that you set your camera as child, and in that case getPosition() returns the offset from the parent not the position in global space... getAbsolutePosition will help IMHO.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Nice puh, never noticed that one!
Image
zenoid
Posts: 40
Joined: Wed Jul 20, 2005 1:16 pm
Location: france
Contact:

Post by zenoid »

thx all for your help.

This forum is a very good help.
Post Reply