> From: "Casteel, Don" <[EMAIL PROTECTED]>
>
> Can someone explain what the compile() method really accomplishes? Does it
> improve performance? What can I expect to happen if I don't use it? Is there
> some rule of thumb for when it should and shouldn't be used?
Here is a little doc I wrote up about compile() a couple weeks back. The short
answer is that compile() can help a few kinds of scene graphs (mainly MCAD
data), but only if you tweak your scene graph a bit to allow it to work. For
most applications compile() is not a big win.
Doug Gehringer
Sun Microsystems
Implementation Note: Making compile() make your scene graph faster
Quick Summary:
Compiling scene graphs can make certain kinds of scene graphs render much
more quickly. To take advantage of compile() your scene graph must: have
lots of Shape3Ds which share common attributes and transforms, not have indexed
geometry, and not have any capability bits or the "pickablity" flag set.
Details:
Compilation is a great unfulfilled promise for most Java3d applications today.
The promise is much improved performance, but almost no applications are seeing
a performance benefit today. The reasons for this are two-fold: compile() only
helps certain kinds of scene graphs and the default flag settings prevent
compile() from optimizing the scene graph.
Here is how compile() works. Compile implements two optimizations to the scene
graph: attribute sorting and shape merging. Attribute sorting looks at the
attributes on the Shape3Ds and builds a list of unique appearances. It then
replaces the redundant appearances with references to the unique appearances.
This minimizes the overhead to changing appearances as the scene graph is
displayed.
No compile:
Shape Num Num Shape Triangle
Shapes Tris Rate Rate
Tetrahedron 0.5K 2K 4.6K 18K
Tetrahedron 1K 4K 4.6K 19K
Tetrahedron 2K 8K 5.0K 20K
Tetrahedron 4K 16K 5.0K 20K
Icosahedron 0.5K 10K 3.3K 65K
Icosahedron 1K 20K 3.4K 68K
Icosahedron 2K 40K 3.5K 70K
Icosahedron 4K 80K 3.6K 71K
Compile:
Shape Num Num Shape Triangle Compile
Shapes Tris Rate Rate Time
Tetrahedron 0.5K 2K 30K 125K 0.6
Tetrahedron 1K 4K 60K 250K 2.0
Tetrahedron 2K 8K 120K 500K 8.4
Tetrahedron 4K 16K 230K 920K 30.9
Icosahedron 0.5K 10K 17K 340K 0.7
Icosahedron 1K 20K 22K 440K 2.1
Icosahedron 2K 40K 29K 580K 9.9
Icosahedron 4K 80K 30K 600K 34.9
Recommendations:
Note:
This document is based on the Java3D 1.1 implementation. The 1.2
implementation will have the the same behavior, but it will probably deliver
the same performance without the same restrictions. 1.2 will deliver
implement alot of the performance optimizations of compile() without the
restrictions on pickablity, and may have a better implementation of compile()
as well.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".