rouncer at June 23rd, 2009 17:01 — #1
Ive got an idea of how I could implement sub surface scattering realtime but it would only work on a modern more powerful video card.
do a diffuse render of the front of the model and back of the model.
then do a lit and shadow render of the front of and back of the model.
then do a viewspace coordinate render of the front and back of the model.
then do a trasmittive render of the front of the model only.
then you can take all these things and produce the final image with an expensive screen blur.
the screen blur is take target pixel, calculate approximate scatter distance, sample around the pixel modulate with the diffuse render, take light from the light render and collect it in a blurred sum, the strength of each + calculated by taking the viewspace distances between the pixels, not forgetting to finally modulate the colour with the object itself, and where the light came from. it actually modulates twice, light beginning and light end.
if you keep the transmittive property of the scattering substances down, it should run a lot quicker... the blendier the object the more blurring it has to do and the slower it goes... so who knows if it will be just fast enough to get to skin blur radius, which is actually quite tight.
What do you think, u reckon it would work?
starstutter at June 23rd, 2009 23:47 — #2
Seems like a good idea, but only if the quality was really worth it. The cost, even on newer cards, would be quite a penalty. For something like wax, I could see it being worth it, but the scattering in skin simply isn't "deep" enough to warrant something like that.
The method I use is sort of similar to what you described in that last part. I use deferred shading so rendering an object again (or once per light) is impractical. Therefore, I fill the g-buffer and store the material information. Then I perform lighting like I normally would for any object on the SSS surface.
After all the light accumulation and before the light application to the scene, I read from the material buffer and use that to mark the stencil buffer on the pixels that need subsurface scattering. Then, during the light application pass (blending it with the scene), I did what you discribed, which is a screen-space blur on only the places marked with the previously mentioned stencil pass. Note that I apply the diffuse textures after I blur the light.
Finally, I apply the blurred SSS light with the sharp regular light for the rest of the screen. I do a gentle blending with the unaltered sharp light on the SSS surfaces to keep their edges from getting too fuzzy.
EDIT: btw, it should also be noted that I keep the specular in the a channel of the illumination buffer and do not blur this with the rest of the light.
Its not a full proof method, but for the fairly cheap cost I think it gives pretty good results (this is running at 78 fps on an 8800 ultra):
rouncer at June 24th, 2009 07:15 — #3
Thats quite impressive what you have there, but I think sss matters for skin.
Thanks for sharing your method with me, Its definitely good for 78 fps!!
Im looking for a real good effect, even if my computer goes a bit choppy.
notice the red in the ear, and red on the shadowed area of the neck and cheek.
Im planning on getting that because its very important by blending red into the outer ring of the blur and passing red from the
back of the model to the front of the model.
You should be able to implement that in your model if you wanted.
The blurring over of the pores is only half the effect, you have to simulate all the red also.
(note: this is NOT my own work)