Principled Volume Node

Hello everyone,

I’m a recent blender user, and so to the Blender community and forums. In the Blender channels some users told me to ask this question here, so I hope I’m doing right.

I’ve been looking to improve my volume rendering equation as the one Blender uses in the Principled Volume Node. Therefore, I’ve tried to search the code and see how it is done, but I couldn’t find anything.

More precisely, my question is:
Does anyone know the approximation of the equation used in Blender for the volume rendering algorithm? To be more concrete, how does it look the code behind the Principled Volume node?

Cheers,

Víctor

There’s various levels here, the shader, the closures and the volume integration algorithms.

For a high level overview of what the shader does, see:
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/kernel/shaders/node_principled_volume.osl

Thanks to reply :smiley:

I’ve already seen this code, but I was expecting the part of the loop. If it is done with ray casting I suppose that the color is computed by the sum of the colors at each step in each pixel.

I guess you’re looking for this then:
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/kernel/kernel_volume.h

Actually yes, I’ve tried to unserstand something but I couldn’t get a lot. I could find the ray loop, but not how they comute the final color at each step, and how they interact between the scattering and absorption color result.

How about the theory behind the model? Does Blender uses the optical model approach called “multi scattering”?

Sorry to bother you so much.

I suggest to look at the “Production Volume Rendering” SIGGRAPH course or the volume rendering chapters in PBRT.

In Cycles there can be scattering on surfaces or in volumes, it’s all part of the same path tracing algorithm. Volume multiple scattering is automatically supported, there’s no specific code for that, it’s just the natural result of path tracing with multiple bounces.

Ok, thank you so much. I’ll give it a look.