Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've got some neat effects with path tracing:

scattering

I want to add in an ability to do subsurface scattering, but I'm unsure of the general algorithm. With path tracing, it's:

foreach pixel:
    trace( ray into scene )
        color = 0
        if( ray hits an object )
            if( that object is emissive )
                color += object.emissive_color
            if( that object is translucent )
                color += trace( object.refracted ray into scene )
            if( that object is specular )
                color += trace( object.specularly-reflected ray into scene )
            if( that object is diffuse )
                color += trace( object.random-direction reflection ray into scene )

        return color

That's the rough outline. Where does subsurface scattering go and how can I integrate it?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

A common approach to subsurface scattering in offline rendering is the so-called "dipole approximation", which is described in the paper A Practical Model for Subsurface Light Transport by Henrik Wann Jensen and others. Unfortunately, I can't do much more than point you at the paper, as I haven't studied it enough to understand it in detail. Googling for "dipole subsurface scattering" will also find you a few more links.

Jensen also has a page with some more images and links to other papers on the subject here.

Finally, it's also possible to simulate subsurface scattering with a brute force Monte Carlo approach, using either path tracing or photon mapping, as long as your renderer supports volumetrics. You pretty much just make a volume that has an extremely high scattering coefficient (orders of magnitude more than you'd use for smoke/haze/etc.) This is very slow though, even by Monte Carlo standards.

share|improve this answer
    
Yes, I came across this paper. It looks interesting, but I was actually interested in the Monte Carlo approach (the actual raycasting physics, without the dipole precompute). "Volumetric raytracing" is the answer I was looking for, it seems! –  bobobobo Jul 23 '12 at 20:08
    
@bobobobo Ahh, I see. "Single scattering" and "multiple scattering" are also good keywords to search for. If you don't have it already, PBR is also a great reference on volumetric raytracing as well as all other aspects of raytracing. –  Nathan Reed Jul 23 '12 at 20:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.