Basic Kray Instancing
From Kraytracing Wiki
Modeler
In modeler use spray points to fill the area with points:
Flatten them in y axis or use ko_point fit plug-in to flatten them in an uneven terrain. I used a simple plane only.
Open the model you would like to instance and make a flat polygon roughly its size. This will prevent overlapping instance later on. Take note of the width, etc.
Now go back to the points and choose fixed weld and input the size that is roughly the models size. My penguin is roughly 70 cm. All points within this number will be welded out.
Go to the polygon you created and rotate in z axis. The polygon normal will determine the direction of the instanced object.
Now we will use point clone plus to distribute the polygon to the points. Go to Multiply>Duplicate>More>Point Clone Plus. Change the values to make random rotation of polygon normal.
You will get lots of polygon facing different direction. Now we will convert them to
powergons. Select all polygons and click Add powergons. In the Add powergons
command, type this line
AddNull (name of object)\rPosition \c\rRotation \n\rParentItem \i\rCreateKey 0\r
(name of object) – this will be name of the nulls in layout. Very Important for kray to recognize nulls! So in my case I use
AddNull penguin_lw8\rPosition \c\rRotation \n\rParentItem \i\rCreateKey 0\r
because my model to be instanced in layout is named penguin_lw8
- From newtek manual:
- The command means
- AddNull \rPosition \c\rRotation \n\rParentItem \i\rCreateKey 0. This adds a null, positions it at the center of the polygon, rotates it to match the polygon's normal, parents the null to the object, and creates a keyframe at frame 0. Now that you converted polygons to powergons, save and send to layout.
Layout
In layout, choose the powergons layer and click convert powergons.
After some processing you will have thousand of nulls with same name in the location of your powergons. Kray will now recognize these nulls as instances of your main object.
Rendering in my laptop core 2 duo 1.6ghz, 3gig ram was painless. 1468 instances of penguin(9549 poly) = 14061972 poly
Finish
Useful Plugins/ Scripts
Ground Those Objects : http://www.pepperchrome.com/Tools.html
This is a plugin which will ground nulls (and regular objects) to a mesh of your choice. Very useful for placing instances of grass, tree's and bushes to a irregular ground surface.
RestOn : http://www.kolumbus.fi/erkki.halkka/plugpak/
A Lscript which does a similar job to 'Ground Those Objects' above.
Nullify : http://www.tmproductions.com/FrameSets/FS-Products.html
Replaces all selected objects will nulls.
Points2Scene : http://www.mindspring.com/~anthonyramirez/LScript/LScript.htm
Creates a LWS of nulls from points in modeller











