Re: Sharing geometry

"Philippe C.D. Robert" <[email protected]> Thu, 4 Jul 2002 19:34:34 +0200
Newsgroups gmane.comp.gnu.3dkit.general
Message-ID <[email protected]>
Hi Brent,

On Thursday, July 4, 2002, at 06:56 PM, Brent Gulanowski wrote:
> Is it better to have multiple shapes sharing one geometry or multiple 
> groups sharing one shape? It appears the G3DGeometryBackend is designed 
> on a 1:1 between shape and geometry. Can multiple groups reference the 
> same shape easily enough?

The original design philosophy of the Shape aggregation was to be able 
to share geometry objects. But I believe that there is a bug which 
prevents it from working when you use view-frustum culling. I'd have to 
double check that.

<snip>

> I do see problems with shared geometry in a detailed simulation, but I 
> think that the memory savings would be worth the effort to solve them.

Yup, definitly!

> For example, frame-based animations: Different world entities may be of 
> the same type and use the same geometry, but they would not all be in 
> synch for their animations. Quake 2 character models are a typical 
> example.

For key-frame animations you could use a switch group managing n shapes. 
So you could have m switch groups, all having n shapes. Then the 
geometry nodes can be shared easily.

Of course, sharing is not possible whenever you directly modify the 
geometry.

> In my game I might have a couple dozen enemy robots with very simple 
> frame-based animations: spinning antennae, waving pincers, whatever, 
> just for looks. It would be nice to have animated textures, too, in the 
> future.

It's already there, you just transform the texture stack according to 
your needs - I have a small demo somewhere demonstrating this using 
render delegates.

>  So there would be a small set of fixed meshes, and each robot would 
> worry about when to start a particular animation sequence. Some 
> frequently occurring entities won't have any animations at all. So 
> should I make a new GraphNode for non-animated shared-shape entities, 
> and a new Group object for animated shared-shapes entities?

Depends on what you want to do. Normally you could just use group nodes, 
timed switch nodes or normal switch nodes which are controlled by your 
robot or game controller. Remember, the scene graph is supposed to be a 
data structure only, the logic should be part of some controllers 
( MVC ).

> For speed I'll probably want the various geometry objects that are part 
> of an animated sequence to return the same min/max values and avoid 
> triggering a recalculation of the bounding box every frame for every 
> object -- that would be very expensive.

In the current 3DKit the bboxes are calculated transparently unless you 
disable it, but if you use n shapes with different geometries nothing 
has to be recalculated, of course - you just draw one shape of choice 
for the frame.

cheers,

-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip