Jump to content

Creating shader with Physical SSS


jim c

Recommended Posts

If you're creating a shader from scratch, what's the right way to hook up the Physical SSS shader to your diffuse color?

Do you basically have this:

Cf = diffCol + specCol + physSSSCol

Or do you do something different?

I tried looking at the Mantra Surface material, but it's so huge and complicated I ultimately got lost trying to figure out what was going on.

Link to comment
Share on other sites

Actually this seems a little weird - the physicalSSS has a color output, but the surface shader seems to ignore that in favor of adding the multi and single scatter outputs together. I'm sure there's a good reason for this, just not sure I understand what it is.

Link to comment
Share on other sites

You are correct. The SSS component is simply added to the other components of the shader. The surface model uses the single and multi scatter to produce the appropriate AOVs that you can output.

As the Physical SSS VOP does not generate a BSDF you need to create a Ce export parameter which acts as the emission component in PBR.

-dennis

Link to comment
Share on other sites

Are you going to use the shader with micropoly or pbr? We created our own material from scratch to replicate the mantra surface material but without all the confusing bits and bobs and specifically for pbr. One of the things to be aware of is that you need to remove the sss contribution from the bsdf if you want correct energy conservation. At least that's how I read what going on in the mantra surface material. If you look for the fakealbedo multiply node inside /shop/mantrasurface1/surfaceModel you'll see what I'm talking about. It's a little convoluted and difficult to explain so I'll post an example when I get home.

Mike

EDIT: I've attached a stripped down material that would be used with pbr. Hope it helps

stripped_down_material.otl

Edited by mikelyndon
Link to comment
Share on other sites

One of the things to be aware of is that you need to remove the sss contribution from the bsdf if you want correct energy conservation. At least that's how I read what going on in the mantra surface material. If you look for the fakealbedo multiply node inside /shop/mantrasurface1/surfaceModel you'll see what I'm talking about.

Hey Mike, what exactly do you mean by this? The example you posted also uses the fakealbedo for energy conservation just like the Mantra Surface Material. Other than that the MSM only uses it for the direct reflectivity export. But you are right, it is a convoluted mess and really hard to read and understand what's really going on.

Do you have some rendertime comparisons of your stripped down shader and the original MSM? I'm thinking about doing the same for our next project and would like to know if the effort is worth it.

Would you mind sharing some more info?

-dennis

Link to comment
Share on other sites

Hi Dennis,

The way I understand it is this - When creating a shader for pbr you generally add together your diffuse, specular and refraction bsdf and pass that through the conserve energy node so that pbr can ensure the shader doesn't reflect more light than it receives. The physicalSSS doesn't output a bsdf so instead we have to export the result to Ce which is then added to the result from the other contributions. This means that the final result can possibly reflect more light than was received. To compensate for this the fakealbedo uses a pbrDiffuse multiplied by the sss intensity and colour and added to the diff, spec, etc and then run through the conserve energy. This way the conserve energy can take into account the sss. The conserveenergy2 node creates a scale factor that is used to multiply against the result of diff, spec and refraction and is also multiplied against the sss colour and intensity. This ensures that when diff, spec, refraction and sss are added together for the final result the reflected light doesn't exceed the amount of light received.

So without these calculations if you have a light with an intensity of 1 and both diff and sss have an intensity of 1 you could possible receive twice as much light reflected from the surface. I hope that all makes sense.

I don't have any render time comparisons but the main reason for the stripped down shader was usability. When the MSM was first released in 11 it went through a lot of iterations while still in beta and even in production builds. I believe there was a lot of talk from the community concerning "old school" shading techniques and parameters and the newer ideas for physically correct renderers. The MSM is a combination of those two schools of thought and so they can sometimes be confusing if not properly understood. I wanted a simpler, cleaner interface for myself and other artists to use specifically for pbr.

Hope that helps.

Mike

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

Sorry for bringing out this topic from the dead ! :)

 

Thanks for the very useful info Guys !

I am currently trying to understand this PhysicalSSS mess but there are still confusing area.

 

How can i convert the color outpout of the physicalSSS to a BSDF Type ?

Basically i don't want to do an add operation but instead a Mix operation beetween refraction / sss / diffuse , but to use a mix i need a proper type.

 

Is it possible to convert the outpout type of physicalSSS from a vector type to a bsdf type that i will be able to mix later with other BSDF ?

 

Thanks for your time guys !

 

Cheers

 

E

Link to comment
Share on other sites

no, but you can always mix them separately, if you use the same blending value you will conserve energy

 

so you have SSS which is color (later used in Ce) - say colorA

and other layer(s) which is BSDF - bsdfB

and mask - weight

 

if you create black color - colorB - to represent emission of other layer

and black bsdf (pbr diffuse * 0) - bsdfA

 

then you can mix those BSDFs and Colors with the same weight

like

Ce = lerp(colorA, colorB, weight);

F = lerp(bsdfA, bsdfB, weight);

Edited by anim
Link to comment
Share on other sites

Many thanks for your help Tomas ! :)

 

Things start to enlighten ... the room is not fully bright yet but i start to get the idea ...

 

This PhysicalSSS stuff is kinda weird and not very elegant imo ... i would be curious to know why they haven't replicate the same concept of all the other bsdf ... there must be a good reason ?

 

I would be curious to know if you have any idea on perf quality ratio beetween ptc base sss and ray-traced sss ?

Does ptc is really faster in all case ?

 

I would have also one other question for you Tomas ... do you think it would be possible to get a physical attenuation distance instead of the attenuation density ?

I would like to have my sss depth measure in cm instead of an arbitrary density ?

 

Would it be possible to replicate this concept for absorption ? instead of using an attenuation density i would like to have a physical value in cm ?

 

sorry for bothering you with all those question ! :)

 

Thanks again for your help !

 

Cheers

 

E

Edited by sebkaine
Link to comment
Share on other sites

well after some test, i get it work smoothly ! The mantra sss is absolutely stunning, i think it's one of the easiest / cleanest sss i have meet,

the ray-traced mode is really fast , and i finally decide to use a normalize value for the scattering depth which is at the end more user friendly ... :)

 

sorry for hijacking this threads a little ! :)

Link to comment
Share on other sites

well for the engine i have use the most i would say

- Prman

- Mental Ray

- Maxwell

 

i have also test a little

- arnold

- vray

with no expertise with them

 

Mantra is the only one i know  that can offer you inside one shader the speed of ptc and the quality of ray traced sss inside the same shader and the ability to switch at any time.

- prman separate RIS and REYES so you have to choose one of those world but can't get both at the same time

- maxwell sss is tricky to control at first with the relation beetween transmittance / scattering / attenuation / coeff and slow but give stunning outpout

- well Mental Ray is Mental Ray good but old :)

- i don't like arnold sss so much but my reason are very non objective and while i do believe that skin looks too waxy / candle like with it, it look that i am alone in this category ... so i prefer to avoid argument about arnold sss as debate at work are always punchy when abording the subject ... and i don't want to make any enemies on a public forum  :)

- in vray sss is very good but my problem with the engine is more related to the flicking fight you have to do, if you're not using brute force. and if you do use brute force only Maxwell or Mantra are better option imo ...

 

What is also great is the translucent mode with diffuse PBR, it gives very good result so that give you 3 options for your sss

- ptc base

- raytrace

- translucence

and you can switch beetween those 3 inside one shader

 

but my pov is one of an FX guy not a true skilled render artist !

 

Cheers

 

E

Edited by sebkaine
Link to comment
Share on other sites

well after some test, i get it work smoothly ! The mantra sss is absolutely stunning, i think it's one of the easiest / cleanest sss i have meet,

the ray-traced mode is really fast , and i finally decide to use a normalize value for the scattering depth which is at the end more user friendly ... :)

 

sorry for hijacking this threads a little ! :)

Hey how were you able to get it to work? I dont really know where to begin with shaders but ive found all the other examples of pbr sss here and none of them seem to work right. Getting errors on that stripped down one in the thread, a different one just comes out as pure white.. Only one that sorta works is attached but doesnt have pbr spec and I dont see how to even begin putting that in.

 

If you have time can you go into more detail about how you set it up or a file or something? 

PhysicalSSS_Setup.hipnc

Link to comment
Share on other sites

  • 1 month later...

well after some test, i get it work smoothly ! The mantra sss is absolutely stunning, i think it's one of the easiest / cleanest sss i have meet,

the ray-traced mode is really fast , and i finally decide to use a normalize value for the scattering depth which is at the end more user friendly ... :)

 

sorry for hijacking this threads a little ! :)

care to share a hip file? fumbling around with attenuation density does not give me any satisfaction...

Link to comment
Share on other sites

Hi sebastian as soon as i am back from hollidays i will post a hip.

but this is just hacking, no clever elegant tricks ...

There are still certain things that i haven't understand at 100 %.

I am also waiting to get my hand on H15 to see if they have unify things with a proper bsdf outpout for sss.

In order to clean the mess created by the fake albedo cheats!

Cheers

E

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...