I've just committed the last part of improvements to instanced objects support in LuxBlend. If you're not aware, instances are copies of the original mesh. They are objects which reference the original mesh, and any change in the original mesh will affect all of its instances. But what makes instances so much useful with Lux is that with them you can render hundreds and thousands of identical objects with very low memory footprint as only the original mesh takes some amount of memory, and each additional instance is nearly free in that respect. To make an instance, select an object in Blender and press Alt+D.
Formerly, there was several limitation. If any of instanced objects (or all or them) has used modifiers, or any of instanced objects redefined some of original mesh's materials, instancing were disabled. Also instances wasn't supported for meshlights.
And although the last limitation remains (it requires changes in the core), other two are removed. This gives you the following abilities.
First, you can export instanced geometry even if any of instanced objects has modifiers. However, there are some rules. If one part of instances uses one modifier stack (say, subsurf with 2 subdivision levels) and the second part uses another modifier stack (subsurf with 3 levels and edgesplit), then two
different mesh geometries will be exported, and instances will reference those meshes according to their modifier stacks. If all of instanced objects uses absolutely different modifiers configurations, this means there will be no benefit from instancing as all meshes will have to be exported separately. Please note: any
difference in modifiers configuration counts, even non-essential properties like Optimal Draw in subsurf. So stacks have to be absolutely identical for several instances to reference only one mesh object.
Second, now you can redefine in instanced objects any material(s) of the original mesh. When you assign materials in Blender, they are typically assigned to the mesh (or some faces of the mesh).
So if have instances of the original mesh, any change to its materials will also affect all of its instances. However, you have an ability to assign material to the object itself, redefining the material slot of an original mesh. To do that switch to the object material assignment:
If an original mesh has multiple materials assigned (to different faces), you can redefine any of them, switching only some slots to per-object assignment. Please note, however, that if you use mesh subdivision in Lux material properties, it will be disabled in case of you redefining material in instances, as otherwise you could get unexpected results.
You can find a testscene above to play with these new abilities. I'm mostly interested in heavy testing, as these changes have affected the main parts of scene export code. Please also test some tricky scenarios with motion blur, as motion blur is based on instanced geometry under the hood.
Please report any problems you encounter here or in the mantis task
. We have to stabilize these changes before 0.7 release, so I'm counting on your help. Thanks.EDIT: Added information about Lux subdivision.