Blender instances "patch" for the unofficial exporter

Blender (Export script developed by yoyoz; Integrated Plugin developed by JimStar)
Post Reply
User avatar
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Hi.

Here's a small tool to export instance transforms from out of Blender as .cvs file. This is an separate addon that attaches itself to the unofficial Lionel's Blender exporter GUI. You must have the Octane exporter engine enabled, because it reads some values from it. Upon enabling (it's located in the render group - to be close to the exporter) it creates a "Instances" panel in the Render settings, with a button that will export instance transforms for the currently selected emitter object to a .cvs file located in the exporter folder (same place that .obj / .ocs go) with the name of the dupli-emitter or PS system.

Latest version: (see changes here)
octinstances_v021.zip
(3.64 KiB) Downloaded 497 times
Previous version: For changelog & description, see this post
octinstances_v019.zip
(3.72 KiB) Downloaded 585 times
Example scene - hair PS grass (original files courtesy by Roubal)
you'll have to correct the paths in Blender and re-browse .obj in Octane
GrassParticles-Setup.zip
(461.04 KiB) Downloaded 565 times
Terminology:
  • * emitter = object that has PS or duplication with dupliverts / faces
    * dupli object = object that is the particle visualization
    * mesh dupli = object that has Alt+D shared mesh
The procedure: you first export your scene (together with the emitter object, if you choose so), then you export the dupli object mesh to a separate .obj (its highly recommended to use Write dupli objects to file option instead) and than with the emitter selected you hit the export instance transforms button. This last will create a .cvs file in you project folder (for PS emitters the file takes the name of the particle system, for dupli objects the name of the emitter object). You then combine everything together in Octane (see last screencap for node setup) - the .cvs file is loaded into the scatter node.

Features:
  • * It exports dupliverts / duplifaces
    * It exports multiple hair / emitter PS but with limitations
    * It exports transforms of objects that share the same mesh
    * The transforms are saved in a .csv file in your project folder (.csv files take the name of the emitter or PS for each PS)
    * It exports the dupli object data to .obj/.mtl in your project folder
Limitations
  • * Only object visualization is supported (no groups)
Guidelines:
  • * The emitter must be the selected object when exporting
    * PS Render panel -> Rotation must be enabled
    * You can translate, rotate & scale the emitter or the dupli object
    * If you translate the dupli object, you must use the Write dupli objects to file option, when exporting the instance transforms
    * In the PS Rotation panel the Initial rotations that work are: Object Z, Global Z, Velocity/hair & Normal
Best way to produce grass-like PS setup:
  • * Rotate your grass dupli object 90 around Y (so that it's "up" looks along +X)
    * Set Rotation -> Initial rotation to Normal, tweak the other params to decline the particle from the normal and randomize it's rotation around the normal
    * Set Physics -> Size to 1.0 and Random size to your liking
    * Use Velocity -> Normal to grow the particle along emitter normal
Screenshots:
Hair particle system
Hair particle system
Dupliverts instantiated objects
Dupliverts instantiated objects
Grass done with hair PS
Grass done with hair PS
Usable for real projects too
Usable for real projects too
You should test it and report your findings. If you find any major problems / bugs (not mentioned above) provide as much info (settings screenshots) as possible, ideally with a .blend test scene
Last edited by matej on Mon Apr 07, 2014 3:33 pm, edited 17 times in total.
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
radiant
Licensed Customer
Posts: 699
Joined: Mon Apr 05, 2010 12:00 pm
Location: Adelaide, Australia
Contact:

I think iv done everything correctly, I'm getting this error
Attachments
error.png
Win8 Pro 64bit ULT|Intel Core i7 3930K|3.20 GHz|32 GB RAM|GTX 590|UD5 2011 socket||2x TB HD||Master Cooler HAF X||Blender 2.6||Maya 2012||Octane|
User avatar
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Hm, dunno. Must be some locale thing. I've updated the download with those parts commented, cause they are really not important. Try it now.
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
Inciner
Licensed Customer
Posts: 57
Joined: Mon Oct 18, 2010 4:55 am
Location: Russia, Spb

Love you
Яussian engineer (AutoCAD+LISP/Blender 2.69/3dsmax/Mypaint/GIMP) | win7x64 + GT525m DELL || win8x64 16Gb RAM 2x GTX 770
User avatar
n1k
Posts: 401
Joined: Mon Jan 11, 2010 7:55 pm
Contact:

Hi matej. I tried your script and it works nicely:) Excellent work. Can you please tell me if is it possible to achieve random Z rotation with you script? That would be very usefull for trees and vegetation.

Cheers,
n1k
[email protected], 8gb RAM, Gainward GF 460 GTX 2048mb,Win7 64bit.

http://continuum3d.blogspot.com/
User avatar
pixelrush
Licensed Customer
Posts: 1618
Joined: Mon Jan 11, 2010 7:11 pm
Location: Nelson, New Zealand

Thanks man 8-)
i7-3820 @4.3Ghz | 24gb | Win7pro-64
GTS 250 display + 2 x GTX 780 cuda| driver 331.65
Octane v1.55
User avatar
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

n1k wrote:Hi matej. I tried your script and it works nicely:) Excellent work. Can you please tell me if is it possible to achieve random Z rotation with you script? That would be very usefull for trees and vegetation.
Yes, though the setup is a bit contrived. The script just tries to match the transforms from Blender as best as possible, so the trick lies in Blender. To achieve particle rotation around their local Z you must first rotate the source visualization object around Y (look at the teapot at the coordinate center - the one that has its rear up) and set the initial rotation to Object Z (Global Z, Velocity/Hair or Normal can also work) in the rotation panel of the particle settings. Then tweak phase & random. Dunno why exactly you need to rotate the source object, but this is how it works. :) If anyone knows a simpler solution, please share.
rotationZ.jpg
I noticed that if the emitter is rotated, the individual particle rotations are a bit off (but translation & scaling of the emitter works right). Well, the script is still rudimentary and particle rotations are a bit tricky matter.
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
ROUBAL
Licensed Customer
Posts: 2199
Joined: Mon Jan 25, 2010 5:25 pm
Location: FRANCE
Contact:

Hi, I just discover the news ! I have just tested it with Dupliverted objects. Wow ! Thank you very much !

At first glance, I wasn't sure to understand well, but in fact it is very easy to use ! At least with Duplivert !

My initial misunderstanding came from the fact that an octane object is an obj that can be made of many Blender objects, so I had the fear that duplivert could not be usable with complex "objects".

In fact, all you need to setup the scene is to use a simple template object that will not be exported ! It is great, as many models are made of a bunch of objects (like my current Routemaster bus).

I found that the simplest way to place instanced objects from within Blender is to use Duplivert from faces, and create faces that you rotate as you want where you want to place trees or other instanced objects... It works fine !

You just have to take care of normals that must point upward ! In my first test, some objects were oriented in wrong directions, due to normals pointing downward.

Great for manual placement of architecture assets, vehicles, trees, street lamps and else !

I have not yet tested with particles, but is is 4:10 AM, and I have to sleep ! ;)

@n1k : I put a screen shot of Blender for you :
Just create a mesh made of separate faces that will support your Dupliverted trees, and rotate the faces to place the trees at your convenience. If the scen contains many heavy objects, just use a simple object as template to speed up the process in the 3D view, like my red bus template which is almost a cube.

A BIG THANK YOU Matej ! :)
Attachments
FacesDuplivert.jpg
DuplivertedBuses.jpg
French Blender user - CPU : intel Quad QX9650 at 3GHz - 8GB of RAM - Windows 7 Pro 64 bits. Display GPU : GeForce GTX 480 (2 Samsung 2443BW-1920x1600 monitors). External GPUs : two EVGA GTX 580 3GB in a Cubix GPU-Xpander Pro 2. NVidia Driver : 368.22.
User avatar
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

hehe, 2012 London Olympics traffic jam :)

@Roubal, nice to see that the script is usable for you! I too thought about the procedure you described. When I was thinking about how could Alt+D mesh duplicates be properly exported as instances. This is really tricky to do, as every such object would need to have the exact same modifier stack with the exact same settings - and all this would need to be verified from code. A simpler solution is to use duplifaces, as you described. The only probable major drawback is that it cant be easily animated (but for simpler movements on the same plane, shape-keying the emitter faces could possibly work?).

EDIT:
So, yeah, if you need a group of instances exactly placed around your scene, the best way right now is to use duplifaces. The object Z will be aligned with the face normal, so you can position the face anyhow. In case of duplifaces/verts, transforming the emitter does not produce any errors - all the instances are placed correctly:
duplifaces.jpg
In case of high-poly instances like trees and buses :) manual placement is (still) an option, for grass and similar small & random stuff, you would use hair PS.
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
steveps3
Licensed Customer
Posts: 1118
Joined: Sat Aug 21, 2010 4:07 pm
Location: England

Can't get it to work. Do you have to make the particle system real or something like that?

So just to clarify

Add a cube
Add a sphere
add a particle system to the sphere with the cube as the particle object.

render the scene
press the export button

nothing.. I don't get any csv file.
(HW) Intel i7 2600k, 16GB DDR3, MSI 560GTX ti (2GB) x 3
(SW) Octane (1.50) Blender (2.70) (exporter 2.02)
(OS) Windows 7(64)
Post Reply

Return to “Blender”