Re: [Plib-users] RE: How should I use plib?
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2000-08-17 07:07:05
|
Troy Yee wrote:
> Thanks for your response Steve. I don't know how you
> managed to fit all you do into a day...
It's 2:00am...I don't manage to fit it all in!
> So one way to use plib is to develop maps/scenes/tiles using
> some package that exports to a format for which plib has a loader
> (or write a new loader which reproduces the hierarchy of the scene).
Yes.
> Would one expect this to be the most common method of getting
> a scene into one's application?
Yes - by far the most common.
> How does one add dynamic objects to the scene? Just add a
> transform node to the root?
Exactly.
I tend to organise my 3D models into 'fixed scenery' (mountains,
lakes, etc), 'positionable scenery' (houses, trees, etc) and
'moving models' (planes, cars, boats, etc).
I generally create a text file that contains the name of the
scenery file - and the names and coordinates of the positionable
scenery. That makes it easy to move things around in the scene
to get them where you need them.
For dynamic models, the program knows what it needs and where it's
going to put them - so it can deal with that stuff in software.
Then the application program parses the text file, creating an
ssgTransform for every file it loads - which can then either be
set up one-time to position (for example) a house...or updated
every iteration of the application to create moving models like
boats and planes.
> Try to find out where in the scene
> hierarchy it should be placed? Probably the former - what is the
> impact on rendering?
Not *too* bad. It depends a lot on your hardware/driver - but on
the GeForce-256, the cost of an ssgTransform is about the same
as ten additional triangles on the model.
If you are *desperate* for every last drop of performance, there
is a routine called 'ssgFlatten' that multiplies out the ssgTransforms,
makeing the polygons down in the leaf nodes beneath be permenantly
nailed to their current positions.
> I'm using ssgLoadAC(), not creating it myself. After I load the model,
> I add it to a transform node, rotate it (I hand built the model in z-is-up
> format so I have to undo the rotate that the loader does), then scale
> it from unit size to the game board size. I don't make any other changes
> after that. Do I have to force a recalculation of the BSphere in this case?
> (I thought cullAndDraw would do a recalc if it was needed).
No you don't need to recalc the sphere if you didn't create the
vertices in your own code. The loader takes care of it.
> > You should use a triangular mesh I think.
>
> Yes, I knew that but I wanted to generate something I could
> look at with a minimum of effort. Load - scale - move was
> much easier than trying to generate a mesh on the fly.
I have to confess that scaling isn't highly recommended. It
*seriously* clobbers OpenGL performance - and I suspect may
be the cause of your 'vanishing model' problems.
I've never actually tried scaling things in SSG (because it's
so seriously inefficient at the OpenGL level) - and thinking
about it, I strongly suspect there is something broken in
SSG for field-of-view culling with scaled models.
> My choice of the word 'warp' was not the best. It sounds like
> you took it to mean something like 'fly really really really fast'.
> I was actually thinking in the X-windows sense of warping a
> pointer - an instantaneous move to a new location. The idea
> here is that a user selects a new entity from which to look at
> the scene. This isn't *VERY* complex is it?
Oh - I see. No - your program just tells SSG where it wants the
camera to be every frame. I don't care whether it moves smoothly
or 'teleports' a thousand miles in one frame.
> I suspect the issue is that the new location could be quite
> far away from the current location so the tiles likely wouldn't
> be loaded. I don't imagine that the new tiles can be loaded
> quickly enough to satisfy most users or can they?
Well, SSG doesn't deal with terrain paging - you need to look at
a higher level of abstraction - which is where Terragear comes in.
In any case like that though, the need to page terrain from disk
is what keeps you from doing instantaneous 'teleports'. If you
do that, you probably want to just blank the screen for a few
seconds while the terrain pager catches up.
> I'll look at TerraGear. I suspect I'll be able to get away with
> a lot less detail - the simulation will survive with no 3D at all
> (but won't be nearly as interesting!).
Well, that's your call. TerraGear is *awfully* cute!
--
Steve Baker HomeEmail: <sjb...@ai...>
WorkEmail: <sj...@li...>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sourceforge.net
http://tuxaqfh.sourceforge.net
http://tuxkart.sourceforge.net
http://prettypoly.sourceforge.net
|