> From: Shawn Kendall <[EMAIL PROTECTED]>
> Subject: Re: [java3d] Shape3D nodes won't compile()
>
> However....
> I believe there is a serious problem with the design of how you use compile.
> ...
> The problem is that once the optimizations are completed, the user can not
access
> the new Shape3Ds.
That is correct. A compiled scene graph can only be accessed in the ways
specified by the capability bits. This is to allow compile() to make internal
changes to the scene graph while allowing the application to make the changes it
needs.
Note that it is only the current implementation of compile() which has the
extreme restrictions on the cap bits. Future versions of J3D will do a better
job of optimizing the data, with or without compilation.
What you really want is to specify your scene graph and have J3D display it as
quickly as possible. The internal details should be irrelevant.
The restrictions on how to the the very best performance are limitations of the
current implementation. The interface is right and future implementations of
J3D will leverage the interface more completely.
> Is there any way to do this? Will I be stuck writting my on optimization
methods
> that replicate compile without
> restricting access to the nodes?
Well, you won't ever be able to get access to the optimized data produced by
compile (or just the normal J3D runtime code) and you don't want to. That stuff
is internal to the J3D implementation and may depend on the underlying graphics
API and other stuff your application shouldn't have to worry about. As I said,
the current restrictions are artifacts of the current implementation.
There are things you can do with the current release:
If you know that several shapes share the same attributes, then you can combine
them into larger shapes yourself. You may want use the Geometry utilities for
this. Using the Stripifier may result in primitives with longer triangle strips.
If you can break your model into static pieces, you could compile each of the
pieces and then have the rest of your scene not be compiled.
I know of one ISV which is keeping two copies of their data, a compiled graph
for fast display and a second graph for picking and highlighting. They start
with one scene graph clone it, and then compile one and set cap bits on the
other. This is not an optimal solution, but they find that the compiled graph
is about 4x faster (this for MCAD data).
Just keep in mind that these techniques will be less necessary as the J3D
implementation gets more mature.
Doug Gehringer
Sun Microsystems