Page 1 of 1

Rendering far away objects while keeping Z-resolution

Posted: Fri Jan 07, 2011 2:33 pm
by Gorbstein
I'm making a simple top-down view 3d space game and I want to render a distant starfield in the background.

I don't want it to be glued to the player like a skybox - I want the starfield to appear to move slowly relative to my ship movement.

(I'm not going for realism, I'm going for fun.)

I also want depth - ie: stars moving at different speeds due to their distance.

Currently I draw the stars as billboards placed randomly between 10 and 50km away. This gives a nice smooth speed when the ship is moving and a good feeling of depth to the scene.

The problem though is that I have to set the camera's farplane to 50km for these stars to be rendered at all. As you can imagine, that means I lose lots of Z-resolution and my ship models start flickering.

If I was using straight OpenGL I'd draw the stars in a seperate pass with a further far plane, before reducing it and then drawing my ships with a closer far plane.

Can I do this in Irrlicht? If not, are there any other solutions?

Posted: Fri Jan 07, 2011 2:42 pm
by bitplane
Render your starfield using a different camera and scene, with z-write disabled, then render the main scene over the top.

Posted: Fri Jan 07, 2011 2:59 pm
by Gorbstein
Aha, didn't realise i could create a new scene manager, I thought I was limited to one. I think this may solve my problem.

D

Posted: Fri Jan 07, 2011 5:44 pm
by Gorbstein
Fixed. Was looking in IrrlichtDevice for creating a new scenemanager when I should have been looking in ISceneManager.

All works now. Thanks.