Can volume density be controlled with an animated object?

Suppose I have an animated shape-key-deforming sphere with a basic volume absorption node plugged in. Is there a way to make the density always higher at the top of the sphere as it animates, regardless of where it moves in space and how it deforms? I assume there is a way to use a gradient texture for this.

Just use the Object vector from the Texture Coorrdinate Node. This will gibe you the position in object space. Separate this vector and use the z value and some math nodes and/or a color ramp to controll the density.

1 Like

What if there is a time where the object’s origin doesn’t move, but it still deforms? Then this method won’t work, there needs to be some kind of point density at play too.

It could be that I didn’t understand you correctly. But the object vector of the texture coordinate node is the position of where the ray hits relative to the origin.
Here is an example of what i understand and how I would achieve it: Controlled Density.blend (582.8 KB)

Right and as I anticipated, the density doesn’t deform with the shape key because the position of the gradient is absolute with respect to the object origin, it merely masks because it’s using the object origin to calculate position instead of the vertices.