Volumetric, way to keep the background transparent?


Hi,
I would like to have a transparent background with the pixels of my light only visible.

For the plane, I selected it to show you it’s there, because it is otherwise deactivated in Ray visibility → camera unchecked.

Background is transparent before I activate volume scatter in the world’s node, but once Volume is enabled, the background is not transparent anymore.

Post processing in Gimp gives awful result.

The end goal is to create a png image with the rays only.
How may I do it?

Thanks,

In your World nodes, use a Light Path node, Camera Path, as the input for a Mix shader. One input is a Transparent BSDF, the other input is whatever. Maybe an RGB node set to black. Does this help?

I don’t have a transparent shader in the world nodes.
I use Blender 3.3.1.

Is the setup on the right the overall idea?

Enabling transparent option for film should work for EEVEE.
But for Cycles, you have to limit size of volume.
Setting volumetric effects in world nodes is a bad habit, taken before volume objects were supported.

Just place a big cube with a volume shader in your scene to have a background that can be transparent with Cycles.

1 Like

Viewport view (properly transparent):

The camera and light are now inside that cube:

Thanks,

I followed your recommendations and, yes, in the viewport, I have a transparent background.

But, in the render, I still have the black background. I save in png. But alpha is all white, confirmed in the display channel.
I tried to play with the alpha of the volumetric cube, added a transparent shader as well… still no luck.

I am not proficient with Blender, please bear with me.

Are you rendering as a PNG or an EXR? Light data like what you’re looking for doesn’t fit into a 0-1 range so if you a compressed format, your alpha will indeed be all white. Use a 32 bit EXR to capture this data

Both won’t give me the expected result
test.blend (1.1 MB)

I upload my blend, I don’t understand what’s wrong with my setup.
May you please have a look?

Transparent shader is not needed. But if you add one, set its color to White. Black for such shader means an opaque shader.

Density is just too high. If you set it to 0.01, you should obtain transparency.
Bigger the cube is, more you have to lower density.

If you want more dense volumetric rays, you could replace cube by cones representing exactly the shape you want.
You can use a procedural texture using light position as mapping coordinates to vary density.