Basic Kray Instancing

From Kray
Jump to: navigation, search

Note: Kray 2.0 introduces a special plugin that makes placing Kray instances much easier. See here for more info.


Kray instancing 01.jpg

In modeler use spray points to fill the area with points:

Kray instancing 02.jpg

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.

Kray instancing 03.jpg

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.

Kray instancing 04.jpg

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.

Kray instancing 05.jpg

Go to the polygon you created and rotate in z axis. The polygon normal will determine the direction of the instanced object.

Kray instancing 06.jpg

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.

Kray instancing 07.jpg

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.


Kray instancing 08.jpg

In layout, choose the powergons layer and click convert powergons.

Kray instancing 09.jpg

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.

Kray instancing 10.jpg

Rendering in my laptop core 2 duo 1.6ghz, 3gig ram was painless. 1468 instances of penguin(9549 poly) = 14061972 poly

Kray instancing 11.jpg


Useful Plugins/ Scripts

Ground Those Objects :

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 :

A Lscript which does a similar job to 'Ground Those Objects' above.

Nullify :

Replaces all selected objects will nulls.

Points2Scene :

Creates a LWS of nulls from points in modeller