I've got some neat effects with path tracing:
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?