Page 6 of 15

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 8:50 am
by matej
I've updated the script & edited the guidelines. Some of the old limitations dont apply anymore, re-read and download from first post.

0.1.7 changelog:

* The PS dupli object needs no longer to be located at world origin. Besides rotating & scaling, you can now move it around or parent it & move it around.

IMPORTANT: In case you move the dupli object, you must use the automatic mesh write (Write dupli objects to file option) and not do it manually, because the auto way corrects the original mesh at world origin, while if you just exported normally it will be placed transformed (and all the instances will inherit its translation). It's highly recommended to always use the auto mesh write option when you change the dupli object.

* The scaling correction now works for all "native unit size" options
* The script informs the user by printing info in the top Blender textfield if some error happens. Always first look into the console output for possible info if something unexpected happens.

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 11:08 am
by ROUBAL
Thank you very much Matej ! I have just tested on dupli face. fine ! I am very excited by the possibilities offered by your script ! I am eager to test it on a real project like my London city scene !

I have no skills at all in programming, but I have renamed the label of the instances panel to display the version of the script... to avoid using old versions by accident. I have searched with the Find feature, and this label name shouldn't be used anywhere else in the script.

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 11:54 am
by steveps3
I'll have to wait until I get home from work in order to try it but it is sounding really good.

Here is a little test that I did last night. 1.5 billion verts, very good.

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 12:19 pm
by ROUBAL
Nice ! Now, I bet that well see gentle furry monsters here and there ! :D

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 5:49 pm
by matej
0.1.8 Update (download at first post)

* Added support for Alt+D duplicated mesh objects.

Now you can Alt+D duplicate your objects and if you export transforms when you have one (any-one) of those objects selected, it will export the transforms of all the objects that share that mesh (in simpler words: Alt+D your objects, select one of them, hit export :)).

You must note that its impossible to represent a group of mesh-linked objects with instances, if the objects have different modifiers / same modifiers with different parameters / same modifiers differently stacked... anything that results in a different mesh if you apply all the modifiers. Octane only works with finally transformed (modifier applied) raw mesh data, so even if those object share the same identical mesh in Blender, they are different when exported to Octane.

Thus the script assumes all the objects have the same modifier stack and does not do any verifying on this, so it's up to the user to pay attention to this rule. You can of course transform (scale / rotate / translate) your objects at will. When you hit "export transforms", the script will take the active selected object and its modifiers as the base mesh for all the others. The filenames (.csv/.obj/.mtl) will get the name of the mesh datablock (because is unique), so pay attention to name your datablocks accordingly, or else you'll end up with confusing "Cube.001" stuff. (it's always good practice to nicely name your objects :)) Also pay attention to not export them together with the rest of the scene, else they will appear twice in Octane.

So, if you have a bunch of rigid objects (Octane instances are meant to be just basic uniform transforms, nothing advanced), you can now export them as instances and do anything to them that doesn't affect their final mesh, like animating etc... Should work greatly for trees, cars, furniture & similar hi-poly stuff that you would place around manually. No need to use duplifaces anymore.
A stack of Alt+D duplicated teapots, exported as instances
A stack of Alt+D duplicated teapots, exported as instances

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 7:03 pm
by ROUBAL
Great news ! It will help a lot for many things.

However, I like a lot the Dupli Face method. It is very handy for repeated stone pillars on balconies, wrough iron grids elements... everything that can be placed in row or follow a path.

A question : could the script be extended to objects placed using the Array modifier ? It is very used in urban architecture to repeat parts of buildings or city props.

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 7:06 pm
by necko77
Thank you Matej...thank you for your time

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 8:06 pm
by matej
ROUBAL wrote: A question : could the script be extended to objects placed using the Array modifier ? It is very used in urban architecture to repeat parts of buildings or city props.
Possibly it could be done, if the Python API exposes individual transforms of each array instance. Though an object can have an arbitrary number of array modifiers (the code cant assume it has only one), the array modif. can be anywhere in the stack (do I discard all the modifiers that follow, when exporting the base mesh, or do I keep them), and at this point I would probably need to extend the GUI with more buttons (say an object has the Array modifier but is also a mesh-dupli, and the user wants to export just the array instances). As you can see this can become messy pretty fast. I'll look into it but I dont make promises :)

Though in case of urban stuff (say pillars), when you are done with modeling, it's easier to apply the array and then manually change the mesh datablock to the same one for all objects. This way you can rotate the said pillars, or otherwise arbitrarily transform the objects (parent them for group transform) and still get the benefits of instances. While with array you are more "locked in place".
necko77 wrote:Thank you Matej...thank you for your time
No problem ;)
I would probably have done this script anyway (we could wait for Otoy indefinitely), so I might as well share it...

Re: Blender instances "patch" for the unofficial exporter

Posted: Tue Jul 31, 2012 8:30 pm
by ROUBAL
Thanks Matej ! Yes, you are right. Applying Arrays and converting objects into instance before using the script is the best solution ! No need for extra work on the script for that !

Great work ! ;)

Below, an example of very interesting possibilities : textures and materials variations using Instances.

It may seem obvious for most of you, but as I am not used to these features as well as I rarely used nodes in Octane, I have just discovered that by just renaming an obj node, customized versions of an object like a vehicle are possible.

It is easy to change colors and textures. You can make a texture with several ID plates for example for each car, or even change the stickers on the cars using one geometry only.

I would have never thought that instances could be so polyvalent !

It is my best day for a while ! :)

Re: Blender instances "patch" for the unofficial exporter

Posted: Wed Aug 01, 2012 6:08 am
by matej
@Roubal, you can use the material map node, for varying materials of the same .obj mesh, but different scatter group. Material map will override the material you plug-in into the .obj node:
matmap2.jpg
In reality node systems are more intuitive, easier to follow & more powerful than "classic" approach to shading. You'll be missing some functionality if you don't learn nodes.

btw, in the last update I forgot to put render-ability checking for mesh-dupli objects. So right now all of the transforms get exported, even if the object is not visible for rendering or not on active layers. Will correct in the next update.