Geometry Instancing, Collada and World Builder
by Tony Tobianski · in Artist Corner · 01/16/2012 (10:08 am) · 1 replies
Let's say I have a component/object that is reusable in some level architecture. If I'm in Blender and I use references to that object, can/will the Collada exporter recognize that references to the same object are being used, rather than physical copies? I guess the real basic question is, in cases where architectural components have a high frequency of reuse, does one have to set their sights on creating these components for export separately, then actually construct the architecture in Torque's World Editor?... Or, can they be created as references in the modelling software, then recognized as such in Collada, and thus interpreted this way (as references to the same object) in Torque?
About the author
Married web developer, that loves music and game development as hobbies
Associate Chris Robertson
To share geometry between multiple objects you would need to export each instantiable piece of geometry as a separate DAE then place it in Torque.
If you are comfortable with TorqueScript, you could probably use it to place the objects for you automatically based on a separate DAE that has a node to position each geometry instance.
eg.
1. Export each instantiable piece of geometry from Blender as a separate DAE.
2. Export your entire level from Blender without geometry. Most exporters can exclude geometry from the DAE, not sure about Blender.
3. Use TorqueScript and the TSShapeConstructor object to open the level DAE file, then iterate through its nodes and instantiate the appropriate geometry DAE at the correct world location.
As an example of the above, look at the 'loadColladaLights' function (engine/ts/collada/colladaLights.cpp) which instantiates Light objects at nodes within a DAE file. This was done using C++, but you could probably do something similar with TorqueScript and TSShapeConstructor.