Rendering far away objects while keeping Z-resolution

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
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Rendering far away objects while keeping Z-resolution

Post 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?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Render your starfield using a different camera and scene, with z-write disabled, then render the main scene over the top.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post 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
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

Fixed. Was looking in IrrlichtDevice for creating a new scenemanager when I should have been looking in ISceneManager.

All works now. Thanks.
Post Reply