PDA

View Full Version : Instancing an object with instancing



bradcarvey
08-04-2012, 09:34 AM
I am creating an orange grove. I have a tree. I add oranges to the tree using instances. I then create a null. I add a instanced rectangular array of the orange tree to the null object.

I end up with a grove of orange trees without oranges. The orange instances don't appear to get seen when I instance the tree.

Am I doing something wrong?

Can I freeze the instances, so the oranges are not being instanced and will be seen by the instancing of the tree?

Brad Carvey

3DGFXStudios
08-04-2012, 09:49 AM
Yes you are doing something wrong. Seem like you are trying to instance instances or copy which is impossible. What I would do is place the oranges in modeler and instance the whole tree with the oranges in one go. You can also apply the instance generator to every single tree.

You can freeze instance with a py script found in the scripts dir.

bradcarvey
08-04-2012, 01:09 PM
I was hoping that if you instanced an object that had instances would appear on the instances of the object. In this case I need 1,000 orange trees. I use instancing to create 1,000 trees in a grid. I want to add a few hundred oranges to each of the trees. Ideally, I would only have one orange loaded into the scene and instance all 200,000 oranges. Or I would have 200 oranges and instance that 1,000 times.

You can also apply the instance generator to every single tree.

This is what I am trying to do. Every single tree is an instance. I don't know how to apply an instance to an instance, one at a time.

What I would do is place the oranges in modeler and instance the whole tree with the oranges in one go.

There is only one orange, the rest are instances. How do I place the orange instances in modeler?
Do I use a python script to create them and then load the geometry into modeler?

Brad Carvey

cagey5
08-04-2012, 01:18 PM
You can do this with DPonts instancing plug-in. i.e. you can instance objects that have instances on them.

http://dpont.pagesperso-orange.fr/plugins/DP_Instance.html

I suspect that this will be built into the standard version sooner rather than later too.

jeric_synergy
08-04-2012, 01:19 PM
Nothing in the UI nor the dox implies to me* that you can use Layout Instancing as a modeling tool at all: i.e. AFAICT, export can't happen.

::sigh:: That's like the second feature I would have asked the dev to implement. Geeze.



*that doesn't mean one can't. But I certainly can't.

dblincoe
08-04-2012, 01:23 PM
I was hoping that if you instanced an object that had instances would appear on the instances of the object. In this case I need 1,000 orange trees. I use instancing to create 1,000 trees in a grid. I want to add a few hundred oranges to each of the trees. Ideally, I would only have one orange loaded into the scene and instance all 200,000 oranges. Or I would have 200 oranges and instance that 1,000 times.

You can also apply the instance generator to every single tree.

This is what I am trying to do. Every single tree is an instance. I don't know how to apply an instance to an instance, one at a time.

What I would do is place the oranges in modeler and instance the whole tree with the oranges in one go.

There is only one orange, the rest are instances. How do I place the orange instances in modeler?
Do I use a python script to create them and then load the geometry into modeler?

Brad Carvey

Open the tree and orange in modeler and copy the orange to different locations on the tree. Save them as the same object or in layout tell the instancer to also instance children.

Then when the tree is instanced in Layout the oranges will instance with the tree.

You could also create an object to use as proxy geometry (spheres that are jittered will work) that approximate the size and location of the vegetation of the tree and use that as a second instance generator to randomize the location of the oranges. You can hide the proxy image and the oranges will still be instanced.

bradcarvey
08-04-2012, 03:30 PM
I don't want to manually place a few hundred oranges.
I am back working on this and will see what I can do. Maybe I can use the script that Space Monkey mentioned.

Brad Carvey

dblincoe
08-04-2012, 04:06 PM
You don't have to with method two (using a proxy of the trees) see the attached scene.
model has a tree, orange and the proxy that will locate the oranges

scene has an instancer that clones the trees
and a instancer on the (proxy object) that locates the oranges.

dblincoe
08-04-2012, 04:08 PM
You might have to fuss a little with shapes of the proxy object and how the instances are cloned on it to tighten up where the oranges are.

cagey5
08-04-2012, 05:20 PM
I don't want to manually place a few hundred oranges.
I am back working on this and will see what I can do. Maybe I can use the script that Space Monkey mentioned.

Brad Carvey

Or you could just instance the instances as you originally intended... Just saying.

UnCommonGrafx
08-04-2012, 05:22 PM
Brad on the boards...

Wow, long time no see you around.

Man, lots of the ... um, elder statesmen of LW are popping up. Cool to see.

bradcarvey
08-04-2012, 05:34 PM
The plugin to freeze instances, is a python script, called "Python Bake Instance". The plugin worked and created 200 oranges (orange (1) ... orange (200)). Unfortunately, these are seen as clones of the orange, and I can't save them.

Brad Carvey

dwburman
08-04-2012, 05:42 PM
Denis' DP_Instancer uses LW's native instancing engine and can include instances placed on instances. You just need to use DP Instancer for both the fruit instancer and the tree instancer, and make sure "Include Instances" is checked.

bradcarvey
08-04-2012, 05:45 PM
Been a long time since I posted something. With all the new features in LW11 and consulting work I am doing at Sandia National Labs, I haven't had much time to work with the new stuff. So, I was looking for some fast feedback.
I assumed that you could instance an object that had instances. I figured I was doing something wrong and someone would tell me how to do it.

bradcarvey
08-04-2012, 05:54 PM
Thanks Dana, I downloaded the DP instancer and will try that.

I will also look at the oranges scene that DBLINCOE posted.

I may have to go to dinner, but I will try this out this evening and let everyone know how it goes.

Exception
08-04-2012, 05:54 PM
You can instance an object that has instances, but the native LightWave implementation doesn't work. You have to use Denis Pontonnier's "DP Instancer" (not "DP Instance") in order to do it (it's free, link below). DP Instancer is like a different user interface for instancing, and it has more options.

DP Instancer is a better tool to use anyway, until Newtek updates the native interface.

http://dpont.pagesperso-orange.fr/plugins/DP_Instance.html
So take care to download Dp Instancer (bottom of page), and not DP Instance.

Nicolas Jordan
08-04-2012, 05:55 PM
Denis' DP_Instancer uses LW's native instancing engine and can include instances placed on instances. You just need to use DP Instancer for both the fruit instancer and the tree instancer, and make sure "Include Instances" is checked.

:agree: That is probably the way to go.

jeric_synergy
08-04-2012, 06:07 PM
The plugin to freeze instances, is a python script, called "Python Bake Instance". The plugin worked and created 200 oranges (orange (1) ... orange (200)). Unfortunately, these are seen as clones of the orange, and I can't save them.

Brad Carvey
I should probably read down first, but I think someone (Mike Green?) had an lscript to SAVE CLONED TRANSFORMED that would to what's needed here.

bradcarvey
08-04-2012, 07:48 PM
I tried the orange scene. Clever, but won't work for my application. The placement of the oranges is controlled by points and a weight map to generate more oranges near the ends of branches.

I will try the DP Instance plugin.

Brad Carvey

Scazzino
08-04-2012, 07:51 PM
I'd just use DP_Instancer. It lets you use LW's native instances and do recursive instancing. I just posted a test where I did recursive instancing of a camera flyby through 1.5 million walking characters that were all recursively instanced. Here's the latest blog entry (http://TheAutitonArchives.com/turning-loose-1-5-million-autiton-sleepwalkers/). Scroll down and play the video animation test to see them all walking. :thumbsup:

jwiede
08-04-2012, 08:09 PM
I should probably read down first, but I think someone (Mike Green?) had an lscript to SAVE CLONED TRANSFORMED that would to what's needed here.
The workflows should be much cleaner, with geometry either replicated (Modeler -- produces either objects or a single multi-part object, all savable, etc.), or instanced (Layout -- produces instances with either individual or common XYZHPB/etc. info). Given the current separated apps situ, "baking" instances to geometry would simply manifest as Modeler importing Layout's instancing info and converting to replicated geometry.

bradcarvey
08-04-2012, 09:07 PM
DP Instancer works. Very easy to set up. Seemed like my first guess at settings, worked perfectly.

The instances of the tree and oranges are twice the size of the original.

I am using a weight map to control the density/distribution of the oranges, so more oranges appear near the tips of the branches. This seems to be working, without even reading the docs.

Brad Carvey

bradcarvey
08-04-2012, 09:26 PM
The temp ground object had been sized, so the tree instances were sized with the ground.

The oranges don't always show up in VPR, other then that, it's doing what I need.

Brad Carvey

AbstractTech3D
08-04-2012, 10:30 PM
The plugin to freeze instances, is a python script, called "Python Bake Instance". The plugin worked and created 200 oranges (orange (1) ... orange (200)). Unfortunately, these are seen as clones of the orange, and I can't save them.

Brad Carvey

There is another way - From memory, I think it is to save your baked instances scene as an FBX. Then reload it into layout selecting the option that sends all objects to a single layer (presuming that'd be what you want to do). Then of course you could save it out as an LWO. (An extension of that idea might be used to form an Python script which could generate a baked animated object sequence or MDD from animated instances… but that's for another discussion.)

But yes I have previously also used DP Kit to successfully generate instances of instances. I'd say that's the easier way to go.