Can somebody explain how to implement volume rendering and scattering? I've been told that this is the easiest and most effective method to render things like smoke, milk and fog.

Scratchapixel has a great article about it here but the lesson on implementation is unavailable.

I understand what Ray Marching is because of this answer from a while back but similiar to my previous problem I have no idea how to implement it.

To make it clear and narrow this question down so it is easier to answer here are my main problems:

  1. Can someone provide some pseudo code or code of a basic Volume Rendering and Ray Marching loop with Absorption & Scattering coefficients, Phase Function and a Density function?
  2. How is Ray Marching used alongside Path Tracing?
  3. Is this the best way to render sub surface scattering?
  • $\begingroup$ Subsurface scattering won't necessarily require ray marching if it is in a homogeneous medium. Are you specifically looking to model inhomogeneous media (fire and smoke) rather than homogeneous media (milk or glass)? $\endgroup$ – trichoplax Jun 11 '17 at 0:25
  • $\begingroup$ Are you trying to do real time or offline rendering? SSS is a surface based algorithm that uses what's called a BSSRDF. Usually the implementation only accepts the data of a few layers past the surface. Usually just a few extra texture maps. Volume rendering can do the job of SSS but it models the entire inside of a volume. Often it does this with a 3d texture (uniform grid). But sometimes it's done with other datasets like tetrahedral grids. TLDR: Volume rendering isn't used for SSS although the concepts of emission, absorption, in/out scattering are the same. $\endgroup$ – Andrew Wilson Jun 16 '17 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.