Ever wondered how many render cycles you lost to render "less-than-one-pixel-characters-in-the-far-far-background-of-your-shot" using a full resolution mesh? Too many for sure! Those little guys have wasted too much of your time and it's your turn to rule now: use level of details!
So, how can you deal with LOD characters in Golaem Crowd? First, you need different LOD of a same character (obvious, isn't it?): try to keep mesh names, shaders, uvs... identical amongst the different versions. Here is an example of 2 lods of the CrowdCharacter (provided for free with Golaem Crowd) generated in 5 min with the Smooth Mesh tool of Maya.
The two characters are then stored in two separate fbx files and referenced in the Crowd Asset Manager as two new Geometry Files:
And now it's up to you to decide when / why / where you'd like to use either one or the other thanks to the Geometry behavior and a bunch of triggers. Here's an example based on camera distance.
1/ Configure an EntityType, open its Behavior Editor and create a new Container called LOD. We'll use it to manage the LOD affectattion.
2/ Enter the container and create two Geometry behaviors . Configure one behavior to reference the low definition character and the other with the high definition one (in the Asset Manager, select the corresponding Geometry File and click on the "Assign" button. The Geometry behavior is designed to switch / play FBX files whenever you'd like during a simulation. It can also be used to replay secondary animations (baked cloth, facial, blenshapes, spiders...).
3/ Now, let's use the Alternative operator to choose one way or the other depending on the distance. The Alternative operator acts as a "IF condition is true, THEN do this, ELSE do that". You can easily control the behavior of an Alternative operator by selecting it and looking at its Attribute Editor. Notice that the first arrow coming out of the Alternative operator corresponds to the ELSE case and all the next ones will be associated to a trigger (see the little dots included in the arrows).
4/ In the image above, with the default configuration, we have : IF trueTrigger is true THEN use lowDefinition geometry ELSE use highDefinition geometry. Which means that all the characters will have the low definition geometry. Let's change this to make it relative to the distance of each character with the camera. Create a new Trigger node from the Crowd Shelf , rename it distanceToCamera and map a camera node to its Distance trigger: Following the same mechanism, you can add as many Geometry behavior as you want and deal with a lot of different levels of detail.
5/ Finally change the trigger used in the Alternative Operator (from the default trueTrigger to the new distanceToCamera trigger) and you're done! Now you can add your regular behaviors in parrallel with the LOD container and let Golaem Crowd load the correct geometry for you at render time!
6/ Don't forget to save this LOD Container as a template (right click on the Container and "Save as template...") to add it to your custom behaviors and use it in further shots / scenes.
Switching LOD during the Simulation
As you may have noticed, the LOD Behavior explained above will make each character pick a Geometry File at the beginning of the simulation and will keep it, even if his distance to the camera changes. This is because the Alternative trigger will only be evaluated once. Even if this can be changed by creating a Behavior loop, it is clearly not a good idea... Changing a geometry of an object on-the-fly can really mess up the rendering engine : how to compute deformation motion blur between two topologies, how to deal with the visual popping... But it's up to you :)
Here's how the render looks like with Arnold in Maya after exporting the simulation and adding a proxy to the scene:
And to give you an idea of which geometry has been used where (red are low def characters and green are high def)
Not bad isn't it ? Thanks to LOD, the scene polygon count felt from 3millions to 1.6millions and render times reduced by more than 30% for this simple image!!
As always, any question or improvement suggestion are welcome.