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?
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.
To set up the material, disconnect the second SSS node from the Add shader so that the output is purely the first SSS shader. Set the associated Combine XYZ nodes to 1,1,1. Increase the Scale until a uniform color covers the mesh (too high and it will darken to black) and adjust the RGB color as desired. Reconnect the second SSS shader and set the Combine XYZ for the Radius to the desired scatter. If desired you can adjust the relative strengths of the scatter by adjusting the other Combine XYZ node. Once reasonably happy, view the mesh through the Transparent shader set to view 'negative' color values and adjust the first SSS shader (multiply) Combine XYZ values to reduce the negative values to (almost) zero. If desired you can adjust the second shader's (multiply) Combine XYZ values to fine tune the scatter.
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.
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.
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.
- In your material, set the ID to 1
- 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 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
- 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
This is sort of a foolish idea, if you want your material to scatter ligth inside but holding light outside, then it makes an opaque material... But we understand what you mean so shown by the other answers. Personnally I would use a translucent mat mixed with an sss with a ray depth as factor.