PDA

View Full Version : Instance question



Snosrap
11-06-2014, 10:16 PM
Is there a way to control the number of instances being generated only within the camera view? Say I have a field of grass with an animated camera, I'd like to only generate instances within that FOV. Basically I need to do something along those lines because my machine cannot handle the number of instances I need. It would be neat if you could control instances within a user defined distance to a null or something along those lines. Maybe it's possible, but I'm not figuring out.

Thanks for any suggestions.

Kaptive
11-07-2014, 12:33 AM
I think the problem with what you're suggesting comes with instance placement. As soon as you move the camera it would have to recalculate positions of each instance again. This would probably have the effect of making all the instances jump around from frame to frame (if what you're asking were possible). By the way, I'm not saying I have the definitive answer on this, just sharing my experience. Would love to know if someone has a solution, but I've never seen anything like you are asking, and I use instancing a lot.

Could I ask what it is you are instancing? Is there any way in which you can make a low poly version or even use the old school "clipped image on a plane" technique? I've used similar for grass at a distance and it can look great with far less overheads.

Wickedpup
11-07-2014, 02:12 AM
Not sure if View Frustum Culling is available or doable with instances in Lightwave. I know Carbon Scatter has this, and Modo (for Fur material and models, replicators I don't know).
Another feature request for LW12 I guess....

Ztreem
11-07-2014, 02:42 AM
Here's a easy setup with a simple texture map. you can use gradients and nodes or whatever...
125363

Ztreem
11-07-2014, 02:51 AM
the scene file

tyrot
11-07-2014, 02:54 AM
ztreem - cool workflow..:)

Sensei
11-07-2014, 09:37 AM
Data needed to store single instance is very small. Basically position (3 vectors), scale (3 vectors), rotation (3 vectors), which can/should be converted to matrix 4x4 or 3x3. So in total it's something like 4/8*(4*4+3*3)=100/200 bytes per instance or so..

bazsa73
11-07-2014, 01:27 PM
Data needed to store single instance is very small. Basically position (3 vectors), scale (3 vectors), rotation (3 vectors), which can/should be converted to matrix 4x4 or 3x3. So in total it's something like 4/8*(4*4+3*3)=100/200 bytes per instance or so..

theoretically, but folks around these forums have reported that above a certain limit instancing gets bogged down

Sensei
11-07-2014, 02:02 PM
Because instances are generated at the beginning of each frame.
Also if instancing engine is using array, it must be continuous piece of memory.
When it's fragmented by other things, allocating function will fail. You can have 16 GB memory, but due to previous allocations and not freeing (or freeing in wrong order), it might be shattered to pieces.

Snosrap
11-07-2014, 07:05 PM
Thanks guys! My issue came up at work with a product shot. The carpet looked great without any issues from a normal viewing distance, but when marketing requested a closeup of the bun foot it didn't hold up. That's when I resorted to instances to add some "fibers" to the carpet. I ended up just applying the instances to a group of polygons around the foot but it would have been nice to have them dynamically linked to the camera position for freedom of camera placement.

125376

Sensei
11-08-2014, 07:26 AM
BTW, remember that you can make more complex geometry that's source of instances. Couple fibers in same object. Quantity of instances will remain the same.

Slartibartfast
11-08-2014, 07:53 AM
125381125382

As Ztreem but with a front projected weightmap image :-)

Ztreem
11-08-2014, 10:08 AM
125381125382

As Ztreem but with a front projected weightmap image :-)

That's even better, I have to test that one.

Slartibartfast
11-08-2014, 11:10 AM
Yeah, just use an entierly white image

Snosrap
11-08-2014, 06:13 PM
125381125382

As Ztreem but with a front projected weightmap image :-)

Thanks Slartibartfast! That's a great solution.