PDA

View Full Version : How do you fade out instances?



4dartist
01-04-2019, 04:22 PM
I have a machine with tons of parts that are instanced in a rectangular array. Think of 1000s of sewing needles in a row. As my camera flies in for a closer look I want all the instances to fade out over 100 frames. Is that possible? My worse case nightmare is doing it via transparency channel because then I have to create separate object files so they have unique surfaces. I tried animating the Object Dissolve on the objects being instanced, but it creates a render issue where basically it renders clear and everything behind it clear. So I'm guessing Object Dissolve + Instancing isn't a thing.

I'm at a loss for what to do aside from creating separate surfaces and animating transparency on a surface level instead of at the object level.

Thank you for any advice.

MonroePoteet
01-04-2019, 05:52 PM
What version of LW? Can you post an image showing what you mean by "it creates a render issue where basically it renders clear and everything behind it clear." I'm not able to reproduce anything similar in either LW2015 or LW2018.0.7.

mTp

Sensei
01-04-2019, 05:55 PM
I tried quickly in LW 2018.0.7:
opened Instance Generator,
Nodes tab,
toggled Use Nodes on,
Edit Nodes.
Set Weight 0% or Weight 100%. And instance disappeared or appeared.

Used Instance ID Index as input to Gradient (animated key), in Step mode all keys, output from it to Weight. Instances appeared/disappeared one by one..

4dartist
01-04-2019, 06:45 PM
Hey Monroe and Sensei.

Monroe, I can't share screenshots of my work because of NDA. I made a scene with some spheres and sort of was able to create the same issue. Sphere object. Null with two sets of instances on it. The instances are set to overlap a little. I placed a regular sphere behind all the 100% Dissolved instances. There is a rendering gap in the sphere in the background. ( I know these conditions aren't idea with the instances intersecting but I think in my model there may be polygons that share the same space, like a tube with another tube inside and the walls are at the same spot. All these tubes being instances, etc.). Have a look at the screen shots with green. You'll see green showing through the sphere in the back.

Sensei, I tried your idea and couldn't get it to work, do you know what I am missing? I attached a screenshot of my setup. Does this work as a fade? like 50% weight?

Ben

MonroePoteet
01-04-2019, 08:25 PM
No, I can't reproduce this in LW2018.0.7. Attached is the test scene trying to reproduce what you indicated. I put the Scale=0.0 node into the Instancer(s) node, but I'm not sure why that's there - shrinks all the Instances down to invisible, but isn't a true dissolve (what I'd expect over the 100 frames you mentioned inthe original post).

I put a Dissolve Envelope on the Sphere_DullGrey (1), and it works as I expect - no transparency artifacts, all instances for both Instancers fade as expected (no TimeOffset). If you disconnect / delete the Scalar Constant node into the Scale on the Instancer, you can see the dissolve.

I disconnected the Scale node to show the Instances dissolve for the renders and MOV file included here:

143790 143791

143792 143793

MOV File: 143789

Perhaps a characteristic of the sphere's Surface?

mTp

Sensei
01-05-2019, 04:25 AM
Sensei, I tried your idea and couldn't get it to work, do you know what I am missing? I attached a screenshot of my setup. Does this work as a fade? like 50% weight?

You connected to Scale, not to Weight.

Weight can be controlled in the main panel, as I showed in below screen-shots, and instances appears/disappears:

143796

143795

143794

Sensei
01-05-2019, 04:55 AM
Weight parameter with Texture set to Gradient, with Distance to Object, to Null.
The all instances around null are disappearing when distance is smaller than 3 meters:

143798

143797

Move frame slider back and forth to update viewport after movement of null..

MonroePoteet
01-05-2019, 08:59 AM
The Weight parameter on the Instancer will cause instances to pop in our out, but not to "fade away over 100 frames", but perhaps I'm misinterpreting what you mean by "fade away". The Weight parameter is basically what percentage of the "available instancer positions" will be occupied by a particular geometry. So, if you set up an instancer to produce 100 instances (say a 10x10 rectangular array), add four separate geometries to the instancer, and set each of their Weights to 25, each geometry will occupy 25% of the available 100 positions.

Increasing the Weight of a particular geometry will cause more instances of that geometry to "pop in", and reducing Weight will cause them to "pop out". That doesn't sound like what you want, but I could be misinterpreting your intent.

For some really nice instancer work, check out Mark Warner's 8BIT tutorial:

https://www.youtube.com/watch?v=S91xZ0POhy0

Might give some ideas of where you can go with your animation. It's truly sad that the Dissolve channel isn't respected by the Time Offset!

mTp

MonroePoteet
01-05-2019, 01:09 PM
Attached is a sample scene which might work for what you need. It basically sets the Transparency of the instanced Object's Surface based upon the distance to the nearest Particle in a particle trail left behind by an Emitter. So, wherever the Emitter goes, the instances become transparent.

143806 143807

143808 143809

143810

MOV File: 143811

In the sample scene, I moved the Emitter along a meandering path which makes the Instances disappear in a particular order. The Emitter path can be anything, of course, including a straight line. It's important, though, that the Emitter doesn't move TOO fast past each instance position so that a Particle is dropped close to each instance. Otherwise, the Scalar Layer Gradient in the Surface's node network will have to be expanded for the minimum distance of the Nearest Particle to each Instance.

The basic Emitter setup is to produce one Particle per frame with an Emitter size of (0,0,0,) so they're emitted right where the Emitter is, have a 0.0 Lifespan so they don't vanish, set the Parent Motion to 0.0 so they don't follow along after the Emitter.

143800 143801

143802 143803

Then, the setup for the instanced Object's Surface uses the Instance Info and Particle Instance nodes to deterime each Instance's distance from the Nearest Particle, and sets the Transparency to 1.5 (to ensure it's invisible!) within a short distance of that particle.

143815

The Surface has the Index of Refraction at 1.0, the Transmittance Color as pure white, and the Transmittance Distance at 10 to ensure when the Surface goes transparent, the instance is actually invisible.

NOTE: it seems that LW2018.0.7 has a bug where the Emitter for the Particle Info node isn't saved with the Surface. You'll have to set the source of the Particles for the scene to work correctly!

If all you want is a linear disappearance of the instances, you could also control the Surface Transparency with a moving B&W Image layer with Edge type, such as this:

143812

mTp

P.S. A Bug Report has been submitted on the issue of the Emitter name not being saved with the Surface's Particle Info node

MonroePoteet
01-05-2019, 02:15 PM
Here's another sample scene which causes an array of instanced small blue balls to go transparent as a Null moves across them left-to-right. This is the same concept as the moving B&W Image above, but just uses a node network to set the Surface's Transparency.

143817 143818

143819 143820

143821

The Surface's node network subtracts the Instance's position from the moving Null's position, feeds the result into a Scalar Layer Gradient which produces the desired Transparency. Since the Gradient's value is constant off the ends, the balls are fully visible before the Null passes, and fully invisible afterwards.

mTp