Planetside Software Forums

General => Terragen Discussion => Topic started by: N-drju on January 05, 2020, 05:38:22 AM

Title: How to go about the new SSS option?
Post by: N-drju on January 05, 2020, 05:38:22 AM
And no - not the simple shape shader. ;)

I have just created a simple candle in blender and I would like to apply a sub surface scattering (SSS) to said model. What should I apply or add to the object's material to get started and tweak away?

Obviously, nothing has changed in the "default shader" alone, so where should I look first instead?
Title: Re: How to go about the new SSS option?
Post by: Dune on January 05, 2020, 11:56:12 AM
You should add a glass shader first, instead of the default. Set a small value for decay distance (1cm or so), and a nice candle color for decay color. Volume density to 1-2 or so and color to 1 or 2, depending on what comes out. Then tweak from there. You can add a color pf to color input too, for some variation. It's basically the color input of the glass shader that gets its SSS depth by that glass shader, so even an image map would work, if it's properly UV'd. This is what I know/think. Maybe someone has a fullgrown tgc for you ;)
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 05, 2020, 12:17:38 PM
Oh, no, no way. This is too nice an effect to have it done by someone else. :) I'll just try these steps and see if I can get what I want.

I wonder though if I can add other shaders above the SSS-generating glass without killing the effect...
Title: Re: How to go about the new SSS option?
Post by: WAS on January 05, 2020, 01:03:01 PM
Quote from: N-drju on January 05, 2020, 12:17:38 PMI wonder though if I can add other shaders above the SSS-generating glass without killing the effect...

Maybe if you first apply it to a surface layer and use like 0.5 coverage so it has some opacity for the SSS to work. Not sure.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 05, 2020, 03:39:14 PM
Well, I tried to put the advice into practice, but it leaves a looot of work to be done.

I also noticed that the object itself needs to be improved. Maybe this is why the effect looks so bland and is more of a luminosity than SSS...

candleSS.png
Title: Re: How to go about the new SSS option?
Post by: Oshyan on January 05, 2020, 06:41:55 PM
First question would be: is your candle model to real-world scale?  If not, either adjust it so it is, or increase the values Dune suggested.

- Oshyan
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 06, 2020, 03:48:30 AM
The candle is not up to scale, but I was aware of that and adjusted the decay settings accordingly. I leave the colour settings out though - I reckon they should not be size-dependent...?
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 06, 2020, 04:48:45 AM
Right... So I made some more tests.

I'm not satisfied at all... I can see a promise in these images if I employ my imagination... But the fact remains that SSS effect is very tough to achieve.

I have come to the conclusion that the "transparency" setting is just as important as the "decay distance" is. I have no idea though, why the candle surface is so grainy and unnatural - even with an extensive use of path tracer and "max paths per sample" setting (increased to "architecture" in the examples below.)

From left to right - candle rendered with PT (0.5 / AA3) with decreasing transparency (1 - 0.17 - 0.07) setting, "decay distance" set to 0.4 and a yellowish volume colour set to 1.

SStr1.png   SStr0.17.png   SStr0.07.png
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 06, 2020, 04:45:02 PM
I have no idea what exactly am I doing wrong, but I just can't get "SSS" to work... I made several more (lousy) tests and it seems that subsurface scattering will work only in some situations and only with some objects.

I tried to put it to work with the native sphere object and here is the terrible piece of junk that I got...

rock_poorSSS.png

Seems like a waste of electricity and time...
Title: Re: How to go about the new SSS option?
Post by: WAS on January 06, 2020, 05:00:39 PM
That's a really strong colour to really see the effects very well, and causing colour burning in the final render. I'd lower the brightness of the light by a lot.

SSS does have issues with geometry it seems. Some areas it just decides to disable base on the geometry.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 07, 2020, 02:07:18 AM
Quote from: WAS on January 06, 2020, 05:00:39 PMSSS does have issues with geometry it seems.

Certainly looks like it. I must admit that I kept wondering if an object's quality or a build style can play a role in how SSS is handled. The impression I get today after almost an entire day of testing is that these elements do influence the final result. It probably has to be a darn well-made object to handle the light interactions flawlessly... Not implying that my objects are poor - on the contrary, if I may say so myself.

With my yesterday's last breath, I have made some comparison renders with a native sphere but I used Hannes workaround SSS for that purpose. The result was so much better than the one generated by glass... ::) If I were Planetside, I'd make another note next to the SSS option that reads "Not for production"...

Speaking of Hannes, I'd might as well check if there is anything "waxy" in his collection of materials. Some of these prooved really helpful before Chirstmas.

I just don't understand how could you possibly recreate an effect like the one with the Buddha (I guess...?) statue on the main page. Anything I try with the glass shader that has to do with SSS is just rubbish. In my view, it's Planetside waving a flag, saying "See? It's possible!" without offering even a piece of advice on how it works. This is even worse than the function problems because I can describe it only as a waste of electricity and time.
Title: Re: How to go about the new SSS option?
Post by: Matt on January 07, 2020, 06:53:57 AM
For scenes that are producing a lot of noise like this, try setting the "Max paths" to the highest setting available. Don't do this by default, but with noisy SSS renders it should help.

The anti-aliasing will need to be a lot higher than 3, even with the max paths setting increased to its highest.

Displaceable objects can be quite slow to render with path tracing, and when SSS interacts with them it's even slower. If possible, use imported objects or non-displaceable built-in objects.

Slow (displaceable objects): Cube, Disc, Octahedron, Plane, Planet, Sphere.
Fast (non-displaceable objects): Card, Grass Clump, Rock, LWO Reader, OBJ Reader, TGO Reader.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 07, 2020, 11:24:57 AM
Hi Matt. Thank you for your interest in this topic.

I'm sorry to say this, but your post does not help at all. As you can see above, the very first object I wanted to try out was, in fact, an imported object in the .obj format. Counting down what object types can and should not be SSSed is of no use. Describing how to use the glass shader to reproduce SSS is. Unfortunately you never made that effort and, as I already said, the only information we get is that "You can use SSS in the Glass Shader to render a whole range of materials with subsurface scattering effects". And...? How?

If I may suggest - please do a short guide on how SSS effect should be achieved. Just like you did with the Path Tracer! ;)

This is another try of the SSS in a candle that I have made. As you can see, this has been rendered with really high settings. The effect however, is as abominable as it has ever been for me...

SSS.png
Title: Re: How to go about the new SSS option?
Post by: Matt on January 07, 2020, 12:57:32 PM
I'm surprised it's still so noisy. Can we test your TGD and object to understand why this is happening?
Title: Re: How to go about the new SSS option?
Post by: WAS on January 07, 2020, 01:47:12 PM
Quote from: Matt on January 07, 2020, 06:53:57 AMFor scenes that are producing a lot of noise like this, try setting the "Max paths" to the highest setting available. Don't do this by default, but with noisy SSS renders it should help.

The anti-aliasing will need to be a lot higher than 3, even with the max paths setting increased to its highest.

Displaceable objects can be quite slow to render with path tracing, and when SSS interacts with them it's even slower. If possible, use imported objects or non-displaceable built-in objects.

Slow (displaceable objects): Cube, Disc, Octahedron, Plane, Planet, Sphere.
Fast (non-displaceable objects): Card, Grass Clump, Rock, LWO Reader, OBJ Reader, TGO Reader.


We need waaaaaaaaaaay higher paths Matt. Full paths and AA 9-10 for a noise filled render is silly. And AA is far more a impact it seems than ramping up paths.

I just posted this too. Nothing to do with TGDs. Just how soft light works in darkness under currents paths.

The "Extreme Lighting" paths setup seems more like "normal daylight", paths rather than extreme lighting, as in a extreme lighting instance, relying on lighting alone, it's a pixel show. I noted in my other post that documentation regarding Path Tracing, in most cases they were using hundreds of paths if not well over 1000. I'm not sure how this relates to TG though.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 07, 2020, 02:29:02 PM
Quote from: Matt on January 07, 2020, 12:57:32 PMI'm surprised it's still so noisy. Can we test your TGD and object to understand why this is happening?

Of course you can! But there is not much of a .tgd in this case - just a default scene with sun lowered under the horizon.

I attach a different object which is sculpted into something that is closer to what the final candle will look like. Let's go from here, okay?

I am also confused by the fact that the light in the final picture is apparently handled in a an absurd way. Just take a look at the picture - while the waxy surface is being lit up much better than the few last times, the "burnout rim" of the candle stays completely black... And this is all just a single, uniform object...

[attach id=94442]candle.png

[/attach]montownia (gathered).tgd

swiczka.tgo
Title: Re: How to go about the new SSS option?
Post by: WAS on January 07, 2020, 02:30:13 PM
AA 10, Max Paths....

Edit: I emailed you the scene Matt. I couldn't find the candle again on Sketchfab to credit the maker so couldn't upload here.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 07, 2020, 02:32:50 PM
Still grainy, but rest assured, your effect is great!
Title: Re: How to go about the new SSS option?
Post by: WAS on January 07, 2020, 02:37:26 PM
Quote from: N-drju on January 07, 2020, 02:32:50 PMStill grainy, but rest assured, your effect is great!

If you PM me your email I'll let you have the scene too so you can inspect the SSS settings and lighting.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 07, 2020, 04:33:29 PM
Here is one more render with a "fake" sub surface scattering, Hannes - style (an object within an object). Fast, simple, effect clearly visible.

Dirty as clean. But the more reason to ask why do we need an imperfect glass shader to achieve the same? Please note that this render was path traced with AA=5 and is still less grainy than glass shader at AA=10!

fakeSSS.png
Title: Re: How to go about the new SSS option?
Post by: Matt on January 08, 2020, 04:46:24 PM
Thanks for the downloads, N-drju. I've been doing some tests with your files and discovered some things which might help.

To reduce noise, reset transparency to 1 and reduce the lightsource intensity. Transparency controls the surface transparency, not the transparency of the whole object. Before the subsurface scattering can do anything, light has to pass through the surface, so 1 is a good value for this. Increasing transparency makes the object much brighter so now you need to reduce your light intensity. Your scene had light source intensity 6 and I reduced it to 1. Now it renders with less noise.

Quote from: N-drju on January 07, 2020, 02:29:02 PMI am also confused by the fact that the light in the final picture is apparently handled in a an absurd way. Just take a look at the picture - while the waxy surface is being lit up much better than the few last times, the "burnout rim" of the candle stays completely black... And this is all just a single, uniform object...

This can be improved by changing Lighting Method in PT to "Subsurface scatter in all directions (BETA)". There will still be a sharp line where the candle transitions from the thin rim to the flat section in the middle, but it can be improved by making some more changes.

Increase the specular roughness to 0.8. This scatters the rays entering the wax. It also affects the specular reflections though, so if you need additional sheen on the outer surface you can follow this shader with another reflective shader.

To soften this edge even more, I think you'll need to create wider rim and perhaps more rounded at the bottom. I would also try to round off the edge of the rim because the razor thinness causes the edge to be too transparent. Imagine it is smokey glass that comes to a razor thin edge - this will not scatter any light (EDIT: actually this isn't so bad after making other changes to the shader).
Title: Re: How to go about the new SSS option?
Post by: Matt on January 08, 2020, 05:16:54 PM
Increasing decay distance to 3 and volume density to 10 helps to brighten the material and I think this works better.
Title: Re: How to go about the new SSS option?
Post by: WAS on January 09, 2020, 01:14:25 AM
Uhmm, what about the biggest concern evn if he (or I) got good settings, which is quality? AA10 is absurd, for a noisy render that looks that bad.

Not to be a jerk, but I also find it convenient you ignore my input (and file submitted), as well as the obvious quality concern in my scene with working SSS. This seems to be the unavoidable part, and isn't even addressed in your replies.

I even have an entire topic regarding it in support with no reply.

One thing I found helps is lowering the pixel noise threshold and sample size, but this hits render time like a ton of bricks. I really feel more paths would help this considering more lit areas being handled well, even under lower AA>
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 09, 2020, 12:07:17 PM
Hey Matt. I'm glad you researched my file, it's very kind of you.

I will sure take these tips into consideration. I must admit that transparency measure and decay is somewhat confusing. Especially when someone, like me, does not usually use such shaders extensively!

Quote from: Matt on January 08, 2020, 04:46:24 PMThere will still be a sharp line where the candle transitions from the thin rim to the flat section in the middle, but it can be improved by making some more changes.

To be frank, this is something that I have noticed not long after I uploaded the files... The way an object is modeled, is very important indeed so one needs to be careful when moddeling... Placeholder objects will render poorly.

Despite all you have said, I still believe that there is some significant, not entirely clear "magic" going on if Bastien is able to render some "wowsy" renders at apparently no cost. While all I get is a noisy render. In fact, so noisy that the final effect is not even worth trying...

I'd like you to consider the renders I have made with the fake SSS, mentioned before. I can make such renders at a fraction of the time and AA value that I would otherwise have to deal with when rendering a glass-based SSS... And the effect is quite pleasant, don't you think? These were PTed at 0.5 MPD, 6AA, 81 P/sample:


fake SSS examples.png
Title: Re: How to go about the new SSS option?
Post by: Matt on January 09, 2020, 01:10:51 PM
Quote from: WAS on January 09, 2020, 01:14:25 AMNot to be a jerk, but I also find it convenient you ignore my input (and file submitted), as well as the obvious quality concern in my scene with working SSS. This seems to be the unavoidable part, and isn't even addressed in your replies.

N-drju's scene appeared to have more problems than yours, so I thought I could do more good with his scene and I focused on that first. It took a considerable chunk of my day to work on this, and it's not the only part of my job. Terragen doesn't grow on trees. It's heartwarming to know that my efforts are appreciated.

QuoteUhmm, what about the biggest concern evn if he (or I) got good settings, which is quality? AA10 is absurd, for a noisy render that looks that bad.

I even have an entire topic regarding it in support with no reply.

I found that with N-drju's scene, after making the suggested changes the noise was quite acceptable in an AA7 render. I hoped they might translate over to your scene as well, but I have not had time to try it yet.

QuoteOne thing I found helps is lowering the pixel noise threshold and sample size, but this hits render time like a ton of bricks. I really feel more paths would help this considering more lit areas being handled well, even under lower AA>

Yes, I think more paths will help. I am considering ways to add this to the GUI in future versions.
Title: Re: How to go about the new SSS option?
Post by: Matt on January 09, 2020, 01:22:50 PM
Quote from: N-drju on January 09, 2020, 12:07:17 PMDespite all you have said, I still believe that there is some significant, not entirely clear "magic" going on if Bastien is able to render some "wowsy" renders at apparently no cost. While all I get is a noisy render. In fact, so noisy that the final effect is not even worth trying...

Resetting transparency to 1 should make a big difference to the noise. Please give it a try. But yeah, some scenes are still going to be noisy and difficult to render. I don't know for sure, but Bastien's renders probably had AA much higher than 10. I may be remembering wrong, but I think some of his renders were AA 16.

We need to write some guides to SSS, I appreciate you bringing this up.

QuoteI'd like you to consider the renders I have made with the fake SSS, mentioned before. I can make such renders at a fraction of the time and AA value that I would otherwise have to deal with when rendering a glass-based SSS... And the effect is quite pleasant, don't you think? These were PTed at 0.5 MPD, 6AA, 81 P/sample:[/font][/size]

fake SSS examples.png

Sure, it is simpler to compute, and if you're happy with these results then that's great. There are diminishing returns with some more computationally intensitve algorithms. Sometimes the results are worth the cost, sometimes they are not. In many cases there are multiple ways to achieve the same effects, and if you've got a faster way, use it.

The path tracer and SSS in Terragen are not "done", they are going to see improvements over time and hopefully we'll get much faster and cleaner renders in future. The renders you're doing are showing areas where I should focus my efforts, they've definitely got my attention and I'll do what I can to make the renderer better.
Title: Re: How to go about the new SSS option?
Post by: Matt on January 09, 2020, 01:28:42 PM
Whenever you're testing scenes where the background doesn't matter much, disabling the planet and background sphere will speed up your PT renders quite a lot. Even if you only disable them for test renders, it's worth doing it to speed up experiments.
Title: Re: How to go about the new SSS option?
Post by: WAS on January 09, 2020, 01:32:44 PM
SSS guides, especially focusing on scale (so that becomes habit to the user) would be great. I think a lot of confusion comes from scale of objects. I notice the decay distance could maybe use some refining. WHen I have an object 2m, and have a decay of 1m, things seem to act as if it was a much lower decay distance. Least to my eyes.

I think I've noticed this with just the water shader in the past. Having lets say a 5m depth pond, and a 5m decay distance doesn't seem right and you often gotta double that up.
Title: Re: How to go about the new SSS option?
Post by: Matt on January 09, 2020, 01:36:55 PM
Yes, scale is important. It's more difficult to translate materials from one object to another if the objects scales are different, but luckily there is only one parameter that you need to change to accommodate incorrect object scale, and that's the "decay distance".
Title: Re: How to go about the new SSS option?
Post by: WAS on January 09, 2020, 01:44:05 PM
Yeah, but take a simple sphere for example.

A 1m sphere, with a 1m decay distance, in relation to other engines, and just natural thought on the process, this sphere should look like a creamy piece of marble or something. But it's very dark, and doesn't let much light through at 0.25m, let alone 1m.


This may be leading people to setup up their SSS incorrectly based on their judgement from the named settings.
Title: Re: How to go about the new SSS option?
Post by: N-drju on January 09, 2020, 03:29:09 PM
I'm sure glad I could provide some food for thoughts. Use it well. ;)

Due to mainly economical and maintenance reasons, I'm afraid I won't be using the SSS option often. Like you said, faster option that can bring similar or "close enough" results is worth the effort too.

One more idea if I may?

I find Hannes' solution to SSS better, because it gives a lot of control over how the fake subsurface scattering (let's name it FSSS for short) behaves.

The transparency is one thing. But the final FSSS effect can be dramatically different just by how the two objects are located in relation to one another! This is what you see when you compare the middle candle and the rightmost candle.

Which brings me to another point. In the future, you may consider adding some sort of control that will allow a user to apply a 3D SSS map. This way, a user could, for example, control how high or deep the transparent burnout rim of the candle reaches out. I'm not sure if this is already possible. If it is, I'm sorry if I missed the option.

I really appreciate that you try to bring such miracles to this software. However, I also find "TG archeology" to, time and again, achieve results that new technologies occasionally struggle with. ;)
Title: Re: How to go about the new SSS option?
Post by: WAS on January 09, 2020, 03:44:39 PM
Quote from: N-drju on January 09, 2020, 03:29:09 PMWhich brings me to another point. In the future, you may consider adding some sort of control that will allow a user to apply a 3D SSS map. This way, a user could, for example, control how high or deep the transparent burnout rim of the candle reaches out. I'm not sure if this is already possible. If it is, I'm sorry if I missed the option.


I *think*  that can be achieved using a grayscale SSS map as the SSS density function, utilizing the UV interpretive mode.
Title: Re: How to go about the new SSS option?
Post by: WAS on January 12, 2020, 05:44:13 PM
Coming back to this with an idea. You could also do another method of fake SSS and utilize two materials. Unlit, and lit, and use a merge shader with a "transmission map" that's mapped to UV. Where you want it to be lit basically, and then transition between the two shaders, one being lit of course, with translucency. Similar to transmission maps for SSS in general (that I just posted about).