PDA

View Full Version : Instance help please



Snosrap
04-17-2015, 09:56 AM
I'd like to control the placement of instances dynamically in relation to camera position and also include backface culling of the instances in the mix. Is that possible? In the past I have used a front projection map to generate instances only in areas where the camera is pointing, but now I want to take it one step further and not generate instances on polys that are opposing the camera. Possible?

Kevbarnes
04-17-2015, 12:21 PM
In the past I have used a front projection map to generate instances only in areas where the camera is pointing,

Hi Snosrap .... would you mind explaining the front projection set up,
I'm just working on a scene with a crowd instances on poly cards so no backface culling is needed. Does this technique improve performance ?

jeric_synergy
04-17-2015, 12:28 PM
Snosrap, that's a real interesting question.... you're not worried about reflection, or shadows being cast into the camera view?

Snosrap
04-17-2015, 09:34 PM
Hi Snosrap .... would you mind explaining the front projection set up,
I'm just working on a scene with a crowd instances on poly cards so no backface culling is needed. Does this technique improve performance ?

Sure. Go to the Weight on the Instance panel and select the Texture editor. In the texture editor select image - select "Front" as the "Projecton" and then grab a plain white image. This will limit generation of instances to the camera view only. Yes I did it for performance as I had over a million instances that were animated via a soundtrack and I had to see all of them as I keyframed my camera positions.

Snosrap
04-17-2015, 09:39 PM
Snosrap, that's a real interesting question.... you're not worried about reflection, or shadows being cast into the camera view?

Yep - that's not an issue. It's a product shot and my camera "sees" the whole object so the Front projection method would generate instances on the complete object, so if I can get it to cull the back faces it will give me the performance I'm looking for.

Kevbarnes
04-18-2015, 09:38 AM
white image. This will limit generation of instances to the camera view only.

Hi Snosrap
Thanks for that - I have tried setting up a scene based on what you mention about the white image

Not sure if this is working as it should be?
The instances on the null instance generator is indicating 2500 instances
How do I know if the frontface set-up is working?

Here is what I have

127908
Cheers Kev

Snosrap
04-18-2015, 10:16 AM
Hi Snosrap
Thanks for that - I have tried setting up a scene based on what you mention about the white image

Not sure if this is working as it should be?
The instances on the null instance generator is indicating 2500 instances
How do I know if the frontface set-up is working?

Here is what I have

127908
Cheers Kev

You'll definitely see it when it's working. Be sure to turn the "Weight" to 0% on the instance generator, otherwise the 100% overrides anything in the Texture channel. Also change the "Width and Height Tile" to "Reset" on your front projection map, otherwise the image will just repeat forever and never cull the instances.

Kevbarnes
04-18-2015, 12:37 PM
You'll definitely see it when it's working.

Hi Snosrap
Many thanks, yes I've got it working now (see attached)
I'm getting instances mirrored across the camera position.
127910
This only occurs when the camera is within the instance array, so pulling camera back brings all instances in the array
within the camera bounds.
The generator is still reading 2500 instances?

To get a search-light affect of camera 'seeing' the crowd then don't use 'Fixed Projection' setting
also, the instances tend to 'pop' into existance within the camera feild so I would need to
increase the camera width aspect to render wider than required and then crop in post

This is great Snosrap - many thanks for detailing this - how did you come to find it, I havn't seen it
documented.

Here is an updated scene file
127909

Snosrap
04-18-2015, 06:00 PM
Hi Snosrap
Many thanks, yes I've got it working now (see attached)
I'm getting instances mirrored across the camera position.
127910
This only occurs when the camera is within the instance array, so pulling camera back brings all instances in the array
within the camera bounds.
The generator is still reading 2500 instances?

To get a search-light affect of camera 'seeing' the crowd then don't use 'Fixed Projection' setting
also, the instances tend to 'pop' into existance within the camera feild so I would need to
increase the camera width aspect to render wider than required and then crop in post

This is great Snosrap - many thanks for detailing this - how did you come to find it, I havn't seen it
documented.

Here is an updated scene file
127909

Great! Yeah I wouldn't know why it mirrors like that. Must be something about the way LW handles its cameras. All 2500 instances are available, just not being read in. Yep the popping in has to be dealt with and I handled it as you did. For a scene as light as yours this really isn't needed I wouldn't think.

Kevbarnes
04-19-2015, 04:10 AM
For a scene as light as yours this really isn't needed I wouldn't think.

Yes I would agree, the scene was just a test to discuss your front Projection method.
The actual scene I have has about 30,000 people in a tiered sports race stadium, then I added 15,000,000 blades of grass - it worked but LW was unstable and would crash :stumped:
so I have removed grass blades - but I might put them back in now using this technique. I'll post up some wip if work will let me.

thanks again,

sorry I couldn't be much help to you for backface culling - I don't know of any setting or node that reduces the polygon count based on the normal within Layout
you could try removing the back facing polys in modeler(with respect to Camera) and then constraining the object to target the camera in layout then add the instances.
you could subdivide the mesh on a 'per polygon' basis, graduated from the front to back (facing camera), which might help.
check out the dpont nodes, he might have something. or possibly a boolean shader

Cheers Kev