Adverti horiz upsell
Subsurface Scattering: Using the Misss_Fast_Simple_Maya shader
Subsurface Scattering: Using the Misss_Fast_Simple_Maya shader
Jozvex, updated 2005-12-13 13:14:09 UTC 296,428 views  Rating:
(10 ratings)
Page 4 of 4

Ok I think that's quite enough theory for the moment. Time to do something! Here was our last render:

Oh please...stop inspiring me you wondrous looking object.....*COUGH*. Let's go for something a bit more interesting! First up, let's change the colour from pasty-tan-brown to red!:

  1. Change the 'Front SSS Color' to red!

And rendering the scene gives us?

Well, pasty-red. We'll fix the pastiness in a second. You might be wondering why I chose to change the 'Front SSS Color' rather than the 'Diffuse Color'? It's because I really just want to concentrate on the SSS effect rather than the boring old lambert shading of the outer surface.

  1. To fix the pastiness, we can turn up the 'Front SSS Weight' to something like 1.

Now we get:

Which is much redder. Oh, I'm not going for something realistic here by the way, just something to show off the dramatic effects you can get. What if we now want some back scattering effects in a different color? Let's try that.

  1. Change the 'Back SSS Color' to blue.

No effect!? Maybe it needs more weighting?

  1. Change the 'Back SSS Weight' to 3.

It must be a conspiracy against the colour blue! No, not really. In order to get any back scattering effects, you need a light shining on the back of the object! Makes sense right?

  1. Stick a point light in behind one side of your object.

That's better! Now we've got back scattering in the mix too. If you're back scattering is way too strong, you could either move your new light further away, or turn down the 'Back SSS Weight' a bit. I also unlinked the light (just using Maya's 'Lighting/Shading > Break Light Links') from the floor to remedy a hotspot that appeared. The SSS is starting to get a little grainy though don't you think?

  1. Turn up the 'Sampling' to 256. That should be plenty.
Now, do you remember back when I was explaining the settings of the Misss_fast_lmap_maya shader, I left out the description of the 'Scatter Bias' attribute? Well now is a good time to show what it does. It adjusts the SSS effect to more heavily favour either forward scattering or backward scattering. Values greater than 0 will favour forward scattering (meaing more light from the back will scatter forwards), while values less than 0 will favour backward scattering (meaing more light from the front will scatter backwards). It's a bit confusing at first:

click for larger version

At this point, I think it's about time I finished up this tutorial and left you to your own devices! Playing with values and putting maps in different places is as good a way to experiment and learn as any from here on. There are just a few more things I'll mention first though. Here's an example of rendering this object with Final Gathing, and having the 'Include Indirect Lighting' option off/on on the Misss_fast_lmap_maya node:

click for larger version

As you can see it makes a fairly big difference! I won't go into the Final Gather settings because those with Maya 6.5 can download the scene now (sorry 6.0 people but I don't have 6 anymore and it won't translate backwards properly). Another thing I said I'd talk more about is reasons to save out the lightmap to the harddrive. This again is related to indirect lighting. It's not hugely important, but if you save the map to your hard drive and then render again with the 'Writable' option on the mentalrayTexture node turned off (so that it just reads straight from the saved file without writing it again) you'll get much stronger indirect lighting effects on the surrounding objects:

click for larger version

It seems to be due to the order in which things are calculated at rendertime. The Final Gather prepass comes before the SSS effect is calculated, so most of the SSS colours are left out of the indirect lighting on other objects. If you have saved the lightmap though (by rendering it with 'Writable' turned on and a filename supplied) and then render with 'Writable' turned off, Final Gather can already see the object in it's finished SSSy state, as if it were just a textured object.

Hmm what else is there...oh! What about if you wanted to create the effect of something being 'inside' the SSS object, like bones inside a gelatin hand? All you need to do is create the objects that go inside, and apply the same SSS material to them. It treats them as 'blocking' objects that block the light:

In that render you can see that there is a sphere contained in the left cube, and a cone (though harder to see) in the right cube. All four objects share the same shader and are almost entirely weighted towards the back scatter colour.

Some extra info -

Hopefully I've convinced you that this is quite a versatile and useful shader. Are there any limitations though? Well, there's at least one. This shader is calculated in a way that makes it view dependant. Normally that shouldn't be a problem, however look what happens if I add a mirror behind my crazy test object:

Well amazingly it held up quite well, but as you can see in my poorly illustrated example, some areas displayed in the reflection didn't need to have the SSS calculated for them in order to get a nice result from the camera view. So they look wrong when seen from the back in the mirror. Another downside to view dependence is that you can't bake the shader into a texture map without these artifacts appearing either.

I'm sure some of you might be thinking, "isn't the fact that it takes 20 million steps to setup one shader a downside!?". Well, it does become second nature to setup all the lightmappy business after a few goes, but luckily there's an even better solution! Now that I've shown you how to do it yourself manually, I can point you to this script:

If you put that in your user scripts folder, it'll take priority over the default way that Maya assigns this shader. So when you assign it via the right-click menu in the viewport this script will cause all the lightmap nodes and connections to be made automatically!

And, well, that's about it guys! If you'd like to ask questions about this shader, you can post a in the forum below. So have fun! Bye!!