Physical units on Volume Scatter and Volume Absorption

Hi, I am using Blender and shading nodes for scientific rendering, and I can’t find out if the Density socket in the Volume Scatter and Volume Absorption nodes represents something physical like particles per cubic meter or something different. I am digging through the source code here with no luck, nothing makes me think that it is physically based. Which is strange, are some other densities around Blender are clearly marked with their corresponding units. Does someone here know the answer, or maybe where could I look in the source code? Thanks in advance.

2 Likes

It’s the same unit as this:

4 Likes

this is fascinating, and I’ve been looking for this answer, as well. I think it would be worth it to make this clear, in Blender itself, or at least the documentation.

on another note, the math here is a little confusing- does this mean that a density value of 10 is more than ten times as dense as 1? It may be worth it to record a number of values for reference, such as air which is supposedly an extinction coefficient of 0.012km⁻¹. does that mean accurate air should have a density of at least .000012 in the shader editor, or am I reading these things wrong?

This depends on what you mean by "ten times as dense as 1".

Let’s say we have a beam of light with a radiant intensity of 1 W/sr.
If that beam of light travels through a cube with side lengths of 1m and a Volume Absorption shader or a Volume Scatter shader with an Anisotropy value of -1 with an attenuation coefficient, or in Blender terms a density, of 1 (it’s actually 1/m but the units aren’t shown in Blender) this beam of light will have a radiant intensity of 1/e W/sr or about 0.368 W/sr.

If this same cube now had a density 2 that same beam would be attenuated by a factor of e*e or e^2 after traveling through the cube meaning it would have a radiant intensity of 1/e^2 W/sr or about 0.135 W/sr.

As you can see the increase in attenuation is exponential rather than linear, meaning that in your case a density of 10 would mean that that same beam would be attenuated by a factor e^10 (which is about 22026) instead of 10*e (which is about 27).

You can test this yourself in Blender by using a mesh light with an emission shader behind a cube with a volume shader.

aaand that answers my confusion. no wonder depending on how I considered it I got a different answer. it depends on your frame of reference- if you consider the density the effect on light or the value attributed to density. in blender they’re the same, effectively because it’s just both halves of a calculation, the input and output.

but reading that, it’s clear the answer is “if you increase the “density” value by 10, it will be ten times as dense a material, but a material with ten times the density value will affect light more than 10 times as much.”

I do think exposing that light values are in irradiance and volumes work on attenuation should be at the very least in tooltips.

The Density in the Volume Scatter and Volume Absorption nodes in Blender does not represent something physical in the sense that it does not correspond to a specific unit of measure, such as number of particles per cubic meter. Instead, Density in Blender is a relative coefficient that determines how much a material scatters or absorbs light.

I’ve been pretty curious about this myself, though my main confusion has been about how the absorption coefficient or scattering coefficient is being determined (for the Absorption and Scattering Volume nodes respectively).

The best I could come up with after digging through of some of Blender’s header files is that it’s something like mua = -ln(λ;R,G,B), where λ is the “wavelength” of the absorption coefficient (represented as the RGB channel’s value [0,1] instead of a function of wavelength).

I’m not positive that’s actually what is happening though. Trying to reverse-engineer it within Blender’s shader nodes, I had mixed results. I’d love to hear insight about what’s happening under the hood, if anyone knows.

Another important thing to add here, is that the Attenuation coefficient or Density as implemented in measures how much of the incoming light interacts with the volume.

The Wikipedia article linked by brecht is written in a way such that it suggests that it measures the amount of light being absorbed after passing through 1m of volume however this is incorrect in all cases except when you use a Volume Absorption shader with the volume Color set to (0, 0, 0).

In all other cases the amount of incoming light passing 1m of the volume will be greater than 1/e^Density.

This is particularly the case with the Volume Scatter shader where light that interacts with the volume might get into the forward direction thus also contributing to the amount of light being transmitted.

With another words, it looks like the Volume Absorption Shader will decrease the intensity of light that travels through it by exp(-l d (1-c)), where l is the distance traveled in the medium, d is the density parameter value, and c is the color value of that color channel.

The scattering coefficient is density * color and the absorption coefficient is density * (1 - color), so that when you add them up density is the attenuation coefficient.

For e.g. smoke, the attenuation coefficient is proportional to the number of particles per unit volume. In the general case, the physics is more complicated.

2 Likes

From Physical units on Volume Scatter and Volume Absorption we know that the physical unit describing the Density input of the Volume shaders is the Attenuation coefficient - Wikipedia.

This leaves only the question of what physical unit is describing the Anisotropy input.
I had a look at blender/gpu_shader_material_volume_principled.glsl at main - blender - Blender Projects however it doesn’t seem to be documented there.

@brecht as the one who developed the volume shaders in Cycles you surely know right?

We don’t need multiple topics for this.

It’s the anisotropy in the Henyey-Greenstein scattering function.

1 Like

Thanks brecht. I had one other follow-up question that I had meant to ask the other day. Are the coefficients being calculated relative to scene units? i.e. would a unit scale of 0.01 in Metric, a density of 1, and a value of 0.5 for the R,G,B channels respectively result in an absorption coefficient of mua=0.5cm^(-1), or is it being normalized/interpolated to some other unit?

I’ve been curious of the prospects of translating physical units into Blender lately but it can be hard to delineate what uses them and what doesn’t. The same goes for subsurface radius (though that might be out of the scope of this topic).