Thread: [Plib-users] Newbie question
Brought to you by:
sjbaker
From: Marco B. <F1...@so...> - 2002-10-11 00:18:09
|
Hi! I started using PLIB two days ago and I'm porting my space combat game from the Panard Vision to PLIB because of many reasons. I like very much PLIB, but I can't still understand something. Ok my big problem now is this... My game is a space sim, so I have to draw the Sun and the other planets, but they MUST NOT be culled! They must be seen from any distance, so no frustum has to be applied. How do I get this effect? I tried with ssgEntity::setTraversalMask(0) but the Sun is not drawn at all! Have I use some callback? Please help! Thanks in advance! Bye Bye Marco |
From: Steve B. <sjb...@ai...> - 2002-10-11 06:50:17
|
Marco Bancale wrote: > I started using PLIB two days ago and I'm porting my space combat > game from the Panard Vision to PLIB because of many reasons. > I like very much PLIB, but I can't still understand something. > > Ok my big problem now is this... > My game is a space sim, so I have to draw the Sun and the other > planets, but they MUST NOT be culled! They must be seen from > any distance, so no frustum has to be applied. I don't understand why you need any kind of special handling. Just set the far clip plane out to a gazillion miles and draw sun and planets as appropriately sized spheres at the right distance. So long as the eyepoint doesn't ever get too far from the origin relative to the sizes of the objects that you are actually interacting with, all should be well. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |
From: Marco B. <F1...@so...> - 2002-10-11 11:17:04
|
Steve Baker wrote: > > I don't understand why you need any kind of special handling. > > Just set the far clip plane out to a gazillion miles and draw > sun and planets as appropriately sized spheres at the right > distance. So long as the eyepoint doesn't ever get too far > from the origin relative to the sizes of the objects that you > are actually interacting with, all should be well. > Hi Steve! Sure, changing the far plane was my first idea, but in that way all the objects would not be culled (by the far plane) anymore! Isn't it? So, if I have 100 spaceships around the solar system, I should see all of them... always. I think this is not much optimized :). Am I wrong? Thanks for the quick reply. Bye Bye Marco |
From: David M. <da...@me...> - 2002-10-11 11:39:27
|
Marco Bancale writes: > Sure, changing the far plane was my first idea, but in that way > all the objects would not be culled (by the far plane) anymore! > Isn't it? So, if I have 100 spaceships around the solar system, > I should see all of them... always. I think this is not much > optimized :). You can put the planets in a separate scene graph: ssgSetNearFar(1, 100000); ssgCullAndDraw(ships_root); ssgSetNearFar(1000, 100000000000000); ssgCullAndDraw(planets_root); The problem is that when the ships get close to planets or the sun, they might not be drawn properly (i.e. the planet will block the ship when it shouldn't). As long as you have only 100 ships, you can just put each one under an ssgRangeSelector to make sure it's not draw when it's too far away. With ssgRangeSelector, you can use the same near/far plane for everything and avoid the z-buffer strangeness. All the best, David -- David Megginson, da...@me..., http://www.megginson.com/ |
From: Steve B. <sjb...@ai...> - 2002-10-11 12:01:38
|
David Megginson wrote: > Marco Bancale writes: > > > Sure, changing the far plane was my first idea, but in that way > > all the objects would not be culled (by the far plane) anymore! > > Isn't it? So, if I have 100 spaceships around the solar system, > > I should see all of them... always. I think this is not much > > optimized :). > > You can put the planets in a separate scene graph: > > ssgSetNearFar(1, 100000); > ssgCullAndDraw(ships_root); > ssgSetNearFar(1000, 100000000000000); > ssgCullAndDraw(planets_root); > > The problem is that when the ships get close to planets or the sun, > they might not be drawn properly (i.e. the planet will block the ship > when it shouldn't). That won't work...the values written into the Z buffer when rendering the ships would be meaningless after you'd changed the near/far planes for drawing the planets - so it would be quite possible for a planet that's a million miles away to occlude a ship that's just one mile away. There are some Z tricks you can play to avoid that (in principle) - but this way isn't one of them. You could draw the planets first, then clear the Z buffer, then draw the ships...but then a ship would never be occluded by a planet - no matter what. > As long as you have only 100 ships, you can just put each one under an > ssgRangeSelector to make sure it's not draw when it's too far away. > With ssgRangeSelector, you can use the same near/far plane for > everything and avoid the z-buffer strangeness. Yes - that's the 'right' answer. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |
From: Steve B. <sjb...@ai...> - 2002-10-11 11:56:49
|
Marco Bancale wrote: > Sure, changing the far plane was my first idea, but in that way > all the objects would not be culled (by the far plane) anymore! That's desirably though. > Isn't it? So, if I have 100 spaceships around the solar system, > I should see all of them... always. I think this is not much > optimized :). You should use the level-of-detail mechanism to control the complexity of those spaceship models as a function of range. If you make the lowest level of detail be just a single GL_POINT and turn even that off beyond (say) 50 kilometers, you should have exactly what you need. > Am I wrong? I hope so! ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |