Author Topic: layered material : blending modes ?  (Read 13341 times)

2017-03-27, 11:03:59

clemwipix

  • Users
  • *
  • Posts: 3
    • View Profile
Hi all , I'm new with Corona render , and wanted to give a try building some layered materials , but I don't understand how it can works without blending mode ( adding a black glossy mat on the top for example to get the reflexion coating etc ) . is it planned to make it work with blending modes in the future ? ( normal, multiply, add etc )

and by the way , if I'm not wrong , in Octane for example , when you have a full opacity on a material , you can still see the reflexion effect .. here opacity seems to kill the reflexion so hard to get a "reflexion only" material .

thank you

2017-03-27, 11:46:25
Reply #1

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
Hello and welcome to the community!

The way the layered material works is actually very simple once you know how pathtracing renderers work. So being a bit simplifying here, in order to find a color of some point in a scene, you samle a direction and calculate how much light comes from that direction and what color is the result of this light depending on the material. If you average a lot of these samples then, you have a pretty exact idea of what the scene looks like.

Now, what the layered material does is nothing more than just randomly selecting from a set of materials when you are sampling the direction. and the amount then influences the probability with which a given material is selected.

Edit: to be more specific, let me quote the internal documentation: This material simulates stacking of multiple layers of thin materials on each another - the top material is evaluated first, and where its mask is non-white, the one material below it is evaluated, and so on, until the base material is reached
« Last Edit: 2017-03-27, 12:57:10 by houska »

2017-03-27, 12:58:18
Reply #2

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
As for your reflection-only material, try creating a new Corona material and selecting reflection and refraction channels only...

2017-03-27, 13:03:10
Reply #3

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
Also, the blending seems to work exactly as I would expect it to - look at the attached scene.

2017-03-28, 11:34:20
Reply #4

clemwipix

  • Users
  • *
  • Posts: 3
    • View Profile
Hi Houska :) . thank you for your replies .

I checked your example and that's the problem I have : your diffuse color is mixed with the black 'color' of your glossy mat so at the end you have lost your real diffuse color as you push it toward the black.
So we have to counter this by "pushing up" the diffuse color strengh to get it at the right value at the end . That's why mixing mode are importants ( mix/add/multiply etc ) .
Here some example of Blender cycles render engine : there is a 'Mix shader' (like your layer shader is working , and same for Octane etc )  but there is a 'Add shader' which offers this 'non-destructive' mode of adding B&W glossy effects over a diffuse layer as here for example : ( the 'Cycles_Reflexion added over diffuse.jpg' is the behavior I'd look for ..a non destructive way of adding layers and keeping the init color values :) ... the best behavior would be to have a strengh/amount slider on the Add mode too of course ( here the Cycles Add Shader has no strengh control so you have to make it outside this node off course)  )
« Last Edit: 2017-03-28, 11:42:22 by clemwipix »

2017-03-28, 11:44:21
Reply #5

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8856
  • Let's move this topic, shall we?
    • View Profile
    • My Models
AFAIK the problem with blending modes in layered material, that it can easily break energy conservation, and for physically correct renderer that is very undesirable thing. In 3ds max we add clear coat by making second material with black diffuse, 100% reflective without fresnel and then we blend it with main material by fallof map in fresnel mode. Don't know how much of this can be transfered into C4D though.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2017-03-28, 12:51:26
Reply #6

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
The energy conservation argument is common, but would adding clamp to the whole thing internally as the last step not help ? (or this would not avoid loss?)

The current blend method (regardless of host ap), is basically Mix node. It's just 50:50, 70:30, it layers them (even when through angle depended mask like fallof) in very basic way.

The coat method Romullus write is not very real-work 'correct' or convenient in workflow, but it works. The 'correct' is the one you write, by adding real fresneled black mat and stacking them (like game engines currently let you do), not lerping between two different materials with no actual relationship.
(Though I have to say your example does look like classic physically breaking Shellac(Add) mode, so not good either).

In future more advanced layered material is something Corona should consider, because it's possible to do way more advanced shaders in Unreal :- )
Please follow my new Instagram for latest projects, tips&tricks, short video tutorials and free models
Behance  Probably best updated portfolio of my work
lysfaere.com Please check the new stuff!

2017-03-28, 13:00:52
Reply #7

synolog

  • Active Users
  • **
  • Posts: 112
    • View Profile
I don't understand. Maybe the results are more simple without layered material. What do you want to obtain exactly?

Examples below with reflection driven by color (white) or fresnel (white/black), add mode and slider (like blender but with slider control). I think you can obtain the same using layered material with diffuse_mat in base material and reflection/black_mat in 1st layer with mix mode color(same red of diffuse) or fresnel (white/same red of diffuse).


2017-03-29, 10:43:22
Reply #8

clemwipix

  • Users
  • *
  • Posts: 3
    • View Profile
thx for your replies .

I don't understand. Maybe the results are more simple without layered material. What do you want to obtain exactly?

well , my simple example was just to show that we can't "add" effects in the current layer system in a non destructive way . Of course my example could be done in one mat , but when you'll need to build several reflexion/specular layers over the diffuse(s) layer(s) etc that's the goal . When you say we break the 'energy conservation' by adding a layer instead of mixing it .. as we can add it in a simple material , this has no sense for me sorry ( or this means that a simple material with a reflexion added inside is wrong so ?  )

Blender Cycles is a pathtracing engine if I'm not wrong too  ( sorry I'm not an expert with that so maybe I 'm saying mistakes) , and can allow building shaders by mixing and adding 'layers' ( "horisontal layers" / nodes ) .

( In fact I'm dropping Octane because of this lack of possibilities :) ( and still no hair shaders too ) . So I look arround the other render engine to see how they work and their limitations ;) . )
thx
 



2017-03-29, 11:14:52
Reply #9

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
thx for your replies .

[...]

well , my simple example was just to show that we can't "add" effects in the current layer system in a non destructive way . Of course my example could be done in one mat , but when you'll need to build several reflexion/specular layers over the diffuse(s) layer(s) etc that's the goal . When you say we break the 'energy conservation' by adding a layer instead of mixing it .. as we can add it in a simple material , this has no sense for me sorry ( or this means that a simple material with a reflexion added inside is wrong so ?  )

Blender Cycles is a pathtracing engine if I'm not wrong too  ( sorry I'm not an expert with that so maybe I 'm saying mistakes) , and can allow building shaders by mixing and adding 'layers' ( "horisontal layers" / nodes ) .

( In fact I'm dropping Octane because of this lack of possibilities :) ( and still no hair shaders too ) . So I look arround the other render engine to see how they work and their limitations ;) . )
thx

The thing is, you can "add" effects, but you cannot simply add the light that is reflected, because it would not be the physically correct way as far as energy conservation goes. Imagine the base material itself having an albedo of 80% - that means it reflects 80% of the incoming light. Then the clearcoat reflects 70% of the incoming light. If you added these two together with additive blending, you would have material which reflects 150% of the incoming light, meaning that it intensifies the light by 50%. You effectively created a light-multiplying material. Imagine having two planes with this material opposing each other - you could have a ray bouncing between these two planes with increasing intensity with each bounce - not good (I'm simplifying the way the renderer works here a bit). Or take it this way - the renderer is built around the fact that each material's albedo is less than 1, including some advanced optimizations. If this physical fact wouldn't hold, the code would suddenly break.

To put it into yet another different perspective, look at the attached real-life photo. Clearly, the clearcoat's application reduces the amount of light reflected from the bottom material, reducing the overall lightness of the material in non-specular areas, which is exactly what happens even in physically-based renderers.

So to conclude this reply, you simply won't be able to find a strictly physical renderer, which does what you want.

2017-03-29, 11:17:18
Reply #10

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
The energy conservation argument is common, but would adding clamp to the whole thing internally as the last step not help ? (or this would not avoid loss?)

Juraj, what do you mean by clamping? I'm afraid it wouldn't work too much. If the base material has albedo of 90%, the clearcoat would have to be clamped to 10%, making it pretty much invisible. If you reduce the albedo of the base material on the other hand, you have a darker material, which is what the OP didn't want.

2017-03-29, 13:09:53
Reply #11

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
The energy conservation argument is common, but would adding clamp to the whole thing internally as the last step not help ? (or this would not avoid loss?)

Juraj, what do you mean by clamping? I'm afraid it wouldn't work too much. If the base material has albedo of 90%, the clearcoat would have to be clamped to 10%, making it pretty much invisible. If you reduce the albedo of the base material on the other hand, you have a darker material, which is what the OP didn't want.

You're right, I later realized that what OP wants as result is not correct in first place :- ) I just wanted to support the method other than current mix ( but since 90perc. of applications would be coating, it could be future addition to base shader, like Arnold/Disney/Unreal4..)
Please follow my new Instagram for latest projects, tips&tricks, short video tutorials and free models
Behance  Probably best updated portfolio of my work
lysfaere.com Please check the new stuff!