12
$\begingroup$

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? enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ 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? $\endgroup$
    – Nicola Sap
    Aug 15, 2017 at 6:10
  • $\begingroup$ 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. $\endgroup$
    – Paul Gonet
    Aug 15, 2017 at 19:14
  • $\begingroup$ @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. $\endgroup$ Aug 15, 2017 at 19:47

5 Answers 5

6
+300
$\begingroup$

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 :

graph - distribution

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 :

graph - distribution inverse

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 :

combine shaders

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 :

combine shaders with scaling

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 :

negative value viewer material

(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.

negative value viewer (animated between showing and not showing)

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

adjusted final material

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 :

result

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

$\endgroup$
3
  • $\begingroup$ 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. $\endgroup$ Aug 16, 2017 at 17:55
  • 1
    $\begingroup$ 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 :))? $\endgroup$
    – Paul Gonet
    Aug 17, 2017 at 21:04
  • $\begingroup$ @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. $\endgroup$ Aug 23, 2017 at 23:48
7
$\begingroup$

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.

Lit object

$\endgroup$
2
  • $\begingroup$ 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! $\endgroup$
    – Paul Gonet
    Aug 25, 2017 at 15:21
  • $\begingroup$ 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. $\endgroup$
    – OroNZ
    Aug 26, 2017 at 21:50
2
$\begingroup$

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.

enter image description here

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

$\endgroup$
2
  • $\begingroup$ 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! $\endgroup$
    – Paul Gonet
    Aug 15, 2017 at 18:54
  • $\begingroup$ 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. $\endgroup$
    – JtheNinja
    Aug 16, 2017 at 2:45
1
$\begingroup$

Here is an idea.

With a subsurface shader.

You can adjust opaqueness with ColorRamp's black color value.subsurface version

Also as an alternative.An emission shader version.

enter image description here

$\endgroup$
0
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Yes, you're right. I want to achieve an opaque material (please don't ask me why :)). Wonder why it is so hard to do? It'd be nice to have a node that makes it opaque. BTW I wonder how to invert other shaders (like Translucent e..g.). I know it's a strange and unrealistic idea but this is what I need for my project. $\endgroup$
    – Paul Gonet
    Aug 18, 2017 at 2:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .