Improvements in instances support

Discussion related to the 'LuxBlend' Blender 2.4+ python exporter script.

Moderators: Dade, Ratow, SATtva, coordinators

Improvements in instances support

Postby SATtva » Tue Apr 20, 2010 12:46 pm

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.

instances.jpg
Single original mesh, three modifier configurations, one redefined material

instance_test.blend
Scene file
(50.25 KiB) Downloaded 92 times

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).
mat_mesh.png
Material assigned to the mesh
mat_mesh.png (7.12 KiB) Viewed 1401 times
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:
mat_obj.png
Material assigned to the object
mat_obj.png (6.85 KiB) Viewed 1401 times
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.
Linux builds packager
聞くのは一時の恥、聞かぬのは一生の恥
User avatar
SATtva
Developer
 
Posts: 7162
Joined: Tue Apr 07, 2009 12:19 pm
Location: from Siberia with love

Re: Improvements in instances support

Postby SurfingAlien » Tue Apr 20, 2010 4:04 pm

great work SATtva!
thank you
MacBookPro@2x2.4GHz/4Gb/OSX10.6.4 (Master) - P4HT@3.85GHz/2Gb/WinXP32 (Slave) - Blender 2.53 (.the.Jens.release.) | LuxRender 0.7 - SLG 1.6b2
SurfingAlien
 
Posts: 104
Joined: Fri Nov 27, 2009 11:52 am
Location: Italy

Re: Improvements in instances support

Postby ayanematrix » Sun Apr 25, 2010 11:00 am

Now that is interesting! It seems to help with the problems I was having when I first started experimenting with LuxRender when I used instanced objects that looked like arrows. Sadly, it seems that the lighting from those instanced objects are still a ways off from working the way I want them too. :lol:

So, to be sure, is this updated LuxBlend exporter part of recent builds say, in the last week or so? Also, you mention that the original mesh's material can be redefined without having to alter it's instances, or duplicates, but is there a way to add a material to each object in the instance?
Main rendering computer: Windows XP SP3 32-Bit, AMD Turion 64 1.8Ghz CPU, 1.5GB DDR memory (1.4 usable), ATI Radeon 200M chipset laptop from 2005. Pretty much ancient.
User avatar
ayanematrix
 
Posts: 64
Joined: Fri Dec 04, 2009 7:42 am
Location: TN, USA

Re: Improvements in instances support

Postby SATtva » Sun Apr 25, 2010 11:48 am

ayanematrix wrote:So, to be sure, is this updated LuxBlend exporter part of recent builds say, in the last week or so?

Um, well, I'm sure it's included in the latest Windows weekly (you're under Windows, right?). Anyway, you can just grab the latest version from the repo.

ayanematrix wrote:Also, you mention that the original mesh's material can be redefined without having to alter it's instances, or duplicates, but is there a way to add a material to each object in the instance?

Instance is itself an object. If you meant, add material to some meshes of that object, then it's not possible to add a new material per se. Instead, you have to edit the instanced object, creating several material slots for it and assigning these slots to appropriate parts of the mesh(es). You can assign any materials to these slots, even the same material, so the whole object will in effect have a single material (just in several slots). After that you can redefine any of these slots in instances. Hope this description have any sense to you. :)
Linux builds packager
聞くのは一時の恥、聞かぬのは一生の恥
User avatar
SATtva
Developer
 
Posts: 7162
Joined: Tue Apr 07, 2009 12:19 pm
Location: from Siberia with love


Return to LuxBlend (Blender Exporter)

Who is online

Users browsing this forum: No registered users and 3 guests

cron