Is it possible to invert the SSS shader effect?

I need to achieve the effect of inverted SSS (the opposite to the one pictured below), where most of the scattering is inside the object, not outside. Tried using Color-->Invert and Math nodes. Tried using a negative values of SSS node also. Wonder if it's even possible to do in Blender?

• I'm not sure I understand the question. In the regular SSS scattering happens inside the object (sub = below the surface). What exactly do you want to invert? Also the tried solution look unclear to me: you can use math nodes in a lot of different ways. How did you use them? Can you add a diagram of what kind of light path you would like to fake - or an example of a real world or videogame material that has these features? Commented Aug 15, 2017 at 6:10
• You may be right, that I haven't described my problem well, but I am not a nodes expert- that's the reason. It's funny how you didn't understand what I am looking for and @yann understood it well. So, to clarify: I am looking for a method to achieve the result yann did, but not in a compositor. I want to achieve it in cycles material nodes. Commented Aug 15, 2017 at 19:14
• @PaulGonet Do you mean something like the red channel in this answer blender.stackexchange.com/a/80541/29586? - where the scattering is zero close to the source and increases the deeper the scattering (up to an upper limit). You could use a similar method to generate whaterever scattering profile you require for each of the channels. Commented Aug 15, 2017 at 19:47

This is similar in many ways to this answer - although I've realised that some of the maths in that answer were incorrect (I'll update it when I get the chance).

The Subsurface Scatter shader only provides very limited control of the profile of the scattering. It can be adjusted by Red, Green, Blue channels but otherwise the scattered light is at a maximum closest to the point of incident light and grows fainter further away along the surface. For a 'reaslistic' material (eg, skin), red light would tend to scatter further than green and green further than blue, following a profile similar to the following :

For an 'inverted' scatter I would expect this profile to have to be 'flipped' so that incident light would be mostly scattered far from the point it was incident on the surface, falling off to zero as we move closer to the point of incidence - something like this scatter profile :

This isn't possible with a single SSS shader, but multiple shaders can be combined to generate this effect. However, due to the limited nature of the shader, the material will need to be manually 'tuned' dependent on the amount and distribution of incident light to avoid 'negative' values of light from being emitted from the surface (which can have unexpected effects on your render).

Firstly a note about the SSS shader - it is only an approximation to actual scattering in the real world. Using a Volumetric Scatter shader would be able to produce a more accurate scatter but is orders of magnitude more computationally intensive as it has to trace each individual ray through the material. The SSS shader produces an excellent compromise between 'real' subsurface scattering and render time.

The SSS shader effectively works by sampling the incident light over the whole surface of the material (equivalent to baking to a UV mapped image texture) and then 'spreading' those values over the surface based on the Scale and Radius settings. This means that using a 'large' value for the Scale and/or Radius will produce an evenly shaded surface with the intensity effectively an average for the whole surface. By combining two SSS shaders - one set to a large scale and the other set to our desired (inverse) scattering parameters - we can subtract our desired (inverted) scattering from a 'baseline', to produce our inverse scattering. Combining shaders in this way can be achieved as follows :

The shaders are combined via the Add node. This would normally 'add' the results of both shaders together. However, note the Subtract vector maths node connected to the Color input of the second shader. The Subtract node subtracts the RGB color from the vector 0,0,0 resulting in a "negative" color. When this is subsequently "added" to the first shader the inverted sign will result in a "subtract" rather than "add".

One problem with this is that that the 'baseline' scatter (that with a high radius to produce an 'even' surface) is much darker than the actual scatter (since the light is spread over more area of the mesh) and this will result in negative values in the render. To avoid this we need to increase the intensity of light emitted from the 'baseline' to match the maximum scatter from the second shader - this way at the 'brightest' point (for traditional SSS) the result will be zero with the scattered light increasing as the distance from the illuminated part of the surface increases. This can be achieved as shown :

Varying the Combine XYZ values fed into the Multiply node will "scale up" the color fed into the first SSS shader. This will result in its output being similarly amplified. By selecting suitable high values we can cancel out those negative values.

Due to the nature of the SSS shader, this must be adjusted 'by hand' for each situation (there is no (easy) way to predict the required value - since the scattered light is dependent on the Scale/Radius and also the actual incident light) to avoid negative values from the combined shaders - but negative light shows as black in a normal render so is difficult to view. To assist with this we can use a trick with a Transparent shader to make these negative values visible when viewed through a transparent plane :

(Note that the Subtract vector maths node has the first vector set to 0,0,0)

Positive values viewed through the material will show black while negative values will render in their 'true' colors. This material can be used to identify such negative values and the shader can be adjusted to avoid them - adjust each of the Red, Green, Blue channels individually until the negative values are no longer present.

In the final material, Combine XYZ nodes can be used to allow the different shader properties to be manipulated.

The final material can produce the following result for a back-lit cube :

I'm not sure if this still is not the specific effect you were looking for but it is strictly 'inverse scattering'. Hopefully this is interesting and useful in some way regardless.

Blend file attached

• I've realised that this is close but not quite right - the maths is resulting in negative values which it shouldn't. I'm working on it and will post an edit when done. Commented Aug 16, 2017 at 17:55
• OK, I've reproduced your nodes setup and it isn't really the effect I want. Waiting for an update. BTW How did you gain the knowledge of such advanced nodes operations? Is there a course to learn such things or it is just a mathematics/physics thinking implemented to blender nodes system (at which I suck badly :))? Commented Aug 17, 2017 at 21:04
• @PaulGonet Updated answer. Not sure it's still quite the effect you want but hopefully it will be of some use. I'm not aware of any such Blender Cycles node course (although if one exists that would be pretty awesome) - mostly trial and error along with a long time interest in maths and physics and many years (decades) of programming experience. Commented Aug 23, 2017 at 23:48

Following on from what Yvain commented: "negative SSS" is basically an opaque material. If the surface is opaque, you can't see through any face to see if the volume gets lighter. If what you're after isn't a surface texture, it's probably a volume texture. And if you want something lighter in the middle of a volume than the volume's outer walls, you either need an Emission or Volume Scatter node in the Volume of your material Output, or a rough Glass surface shader with a light in the volume.

• Thanks! You've presented a very smart way to fake the inverted SSS. SInce @Rich Sedman presented more physically correct solution the bounty goes to him. Tried to start a new 150 rep bounty and give it to you but it seems I can't do it (it must be higher than the previous one). To show my appreciation I'll upvote some of your questions. Thnx again! Commented Aug 25, 2017 at 15:21
• Thx for the appreciation, but no need to upvote things I've done for points - this is all about knowledge, and if it's useful, it's useful. Just be aware that everything in CG - modeling, rigs, physics, materials, compositing and beyond - is ALL simulation. Everything in CG is about faking a look - nothing is real. When you accept that you just have to figure out how much time you have to spend on your project to achieve the desired appearance, and if people will care HOW you've done it, rather than what's meant to be appreciated. Commented Aug 26, 2017 at 21:50

I'm not entirely sure if this way is worth an answer, this is going to be quite dirty. You cold invert the SSS in post, using the compositor.

1. In your material, set the ID to 1
2. In the scene tab, activate the Material ID pass, render your image, swap your node-editor to compositing and set up the following nodetree: Multiply the image with ID[0] to stamp out the original SSS, invert your image and multiply it with ID1 to remain with the inverted SSS on black background. Add this to the other branch
3. To go back to your original colors, add some color correction.

There are several problems with this "solution":

• the ID-mask seem to have bad anti-aliasing (is this a bug?)
• the bright parts can't take part in the path-tracing, so there is a quite ugly contrast to the deep shadow behind the cube
• noise is more likely to show up

• Thank you very much! +1 from me for your effort. This is the exact effect I want to achieve but in the material nodes, not in the compositor. Thnx once more! Commented Aug 15, 2017 at 18:54
• You should be able to remove the initial image by subtracting the SSS passes (combine the direct/indirect and color passes, but subtract before inverting). This should avoid any AA issues with the ID pass. In fact, you shouldn't need the ID at all unless you have other SSS objects you don't want inverted. Commented Aug 16, 2017 at 2:45

Here is an idea.