Author Topic: PBR kinda materials  (Read 71740 times)

2014-06-03, 19:54:41
Reply #15

rampally

  • Active Users
  • **
  • Posts: 208
    • View Profile
exactly what we are saying ....those renders are rendered with vray3 and ggx shader
if same shader  would be in corona!!! it will boost corona

2014-06-03, 19:58:06
Reply #16

johan belmans

  • Primary Certified Instructor
  • Active Users
  • ***
  • Posts: 761
    • View Profile
    • belly.be
When i shifted from mental ray to corona, i was shocked how much simpler CoronaMtl is compared to  A&D material. It almost felt like handicapped and it took a while for me to get used to it. And now you want it to be even more simple!? :]

This is exactelly what I am experiencing myself as well.
And then reading the answer of Juraj makes me want to dive deeper in this issue.......

2014-06-03, 20:19:09
Reply #17

arqrenderz

  • Active Users
  • **
  • Posts: 996
  • https://www.behance.net/Arqrenderz1
    • View Profile
    • arqrenderz
" currently use both, and what I am gonna say, I am happy user. " juraj, can you explain some more? are you still using the old method on corona or are you taking the data from megascans or something else on your shaders?
Has anyone tried marmoset on arviz inteior scenes or so?

2014-06-03, 20:22:23
Reply #18

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
" currently use both, and what I am gonna say, I am happy user. " juraj, can you explain some more? are you still using the old method on corona or are you taking the data from megascans or something else on your shaders?
Has anyone tried marmoset on arviz inteior scenes or so?

You will not have much sucess with Marmoset on any scene really :- ) It's asset previewer.

No I am using everything as is now regarding rendering. I am happy user of CryEngine, that's what I meant :- )
Btw I am not in megascans beta, but I might write them to see if they would consider me. I don't think it will be live for public until after summer.

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!

2014-06-03, 21:50:44
Reply #19

Tanakov

  • Active Users
  • **
  • Posts: 831
  • Corona is faster than diarrhea
    • View Profile
    • https://www.behance.net/Gringott
Juraj_Talcik, your words make me want to learn more and understand.

I think I might have misunderstood part of the text OP posted, thanks for correcting me.
Theres still a lot to learn for me.

You said quite a lot about proper material creation, are you able to reccomend me some source of information? We all might benefit from that, your work is proffesional and realistic, you are type of person I want to learn from.

I want to improve and this seems like an opurtunity, sorry for offtopic.
Using Corona since 2014-01-02
https://www.behance.net/Gringott

2014-06-03, 22:10:55
Reply #20

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
Juraj_Talcik, your words make me want to learn more and understand.

I think I might have misunderstood part of the text OP posted, thanks for correcting me.
Theres still a lot to learn for me.

You said quite a lot about proper material creation, are you able to reccomend me some source of information? We all might benefit from that, your work is proffesional and realistic, you are type of person I want to learn from.

I want to improve and this seems like an opurtunity, sorry for offtopic.

To be honest I am last person who can be considered professional :- )

Anyway, I always loved Bertrand Benoit's insight on materials, although he is more eye-balling, he nails it everytime almost. But on more realistic side from start:

currently very good insight on shading can be from Grant Warwick's "Mastering Vray" course (But reading Akin's,LeLe's and bunch of other guys at Chaos forum is also helpful).
I love white papers from ILM and Disney/Pixar, also Paul Devebec's website has so much good info (you can study it for days!) There is always some thing that one can incorporate into his workflow,
even if the vast majority of paper is unattainable.
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!

2015-06-06, 10:39:04
Reply #21

deshu

  • Active Users
  • **
  • Posts: 35
    • View Profile
Its bad that this topic is soooo dead.

2015-06-17, 10:28:03
Reply #22

vkiuru

  • Active Users
  • **
  • Posts: 320
    • View Profile
I think it was a good direction in the development of Corona renderer.
Here's a visual comparison:
http://www.shlyaev.com/rnd/37-cpp-category/54-ggx

Would you guys care to elaborate on the subject a bit more please? shading models come up so often now and every time I see the comparisons what I see are two renders that are different from each other and there's never any explanation that would hint at what else I'm supposed to see here.

EDIT: Lol actually never mind this page has short explanations, somehow my browser jumped right to the part where it only mentions render times etc. Still, might help having some photo reference to further explain what's going on but I think I got the basics :)
« Last Edit: 2015-06-17, 10:37:10 by vkiuru »

2016-06-06, 07:53:43
Reply #23

Moataz

  • Active Users
  • **
  • Posts: 48
    • View Profile
    • Facebook
can i use Marmoset for materials and turn to corona to render ?

2016-07-03, 18:25:37
Reply #24

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
Shamelessly resurrecting this thread :- )

Saw this over at ChaosGroup (by user Sharktacos), the code from Disney's paper (not sure which iteration though). Supposedly you can get this working in Maya through OSL. Would love to see that...
It nicely describes the parameters and how exactly do they work in the code notes. Uses only the Schlick approximation for Fresnel, but GTR version of GGX without exposing the tail ("gamma") parameter.

I wish we could get stuff like this working too, could be nice alternative shader.

You can see some interesting things it does :- ) Specular amount is not direct multiplier of specular intensity (which is physically incorrect, such phenomenon doesn't happen), but instead normalizes IOR for non-conductors to 1.0- 1.8 . Since it's linear I presume the default 0.5 equals 1.4 ?
I can see how this can be bit limiting (only up to 1.8, but that is a lot with full grazing intensity), or precise (for those who need exact 1.423 for some zirconium or whatever), but it could be exposed perhaps (like in next shader bellow, one from Arnold).

Extended paper : http://blog.selfshadow.com/publications/s2015-shading-course/


Code: [Select]
/* artist friendly metal */
float n_min( float r )
{ return (1-r )/(1+ r ); }


float n_max( float r )
{ return (1+ sqrt ( r ))/(1- sqrt ( r )); }

float get_n ( float r , float g)
{ return n_min( r )*g + (1-g)*n_max( r ); }


float get_k2 ( float r , float n)
{
float nr = (n+1)*(n+1)*r-(n-1)*(n-1);
return nr/(1-r );
}

float get_r ( float n, float k)
{ return ((n-1)*(n-1)+k*k )/(( n+1)*(n+1)+k*k);  }

float get_g ( float n, float k)
{
float r = get_r (n,k);
return (n_max( r)-n )/( n_max( r)-n_min( r ));
}

float AFMF ( float r , float g, float theta )
{
float _r = clamp(r ,0 ,0.99);

float n = get_n (_r ,g);
float k2 = get_k2 (_r ,n);
float c = cos ( theta );
float rs_num = n*n + k2 - 2*n*c + c*c;
float rs_den = n*n + k2 + 2*n*c + c*c;
float rs = rs_num/ rs_den ;
float rp_num = (n*n + k2)*c*c - 2*n*c + 1;
float rp_den = (n*n + k2)*c*c + 2*n*c + 1;
float rp = rp_num/ rp_den ;

return 0.5*( rs+rp );
}



//////


color getTextureDif(string texture_name, color no_texture_default_color)
{
    int channels = -1;
    if (gettextureinfo(texture_name, "channels", channels))
    {
        return texture(texture_name, u, v);
    }
 
    return no_texture_default_color;
}

float fresnelReflectionFactor(normal bumped_normal, float ior)
{
    float c = abs(dot(I, bumped_normal));
    float g = ior * ior - 1.0 + c * c;
    if (g > 0.0) {
        g = sqrt (g);
        float A = (g - c) / (g + c);
        float B = (c * (g + c) - 1.0) / (c * (g - c) + 1.0);
        return 0.5 * A * A * (1.0 + B * B);
    }
 
    return 1.0;
}

// Schlick simplified Fresnel function, non-metal/non-metal, no polarisation.
float SchlickFresnel(normal bumped_normal, float ior)
{
    float c = abs(dot(-I, bumped_normal));
    float g = (1 - ior) / (1 + ior);
    g = g * g;
    return g + (1 - g) * pow((1 - c), 5);
   
}



surface
DisneyBRDFMtl
[[ string description = "Disney Principled BRDF Material" ]]
(

    string  Base_Color = "color.png",
   
        float  Metallic_Amount = 0
    [[ string description =
        "the metallic-ness (0 = dielectric,  1 = metallic).  This is a linear blend between two
        different models.  The metallic model has no diffuse component and also has a tinted incident
        specular, equal to the base color."
    ]],
   
    float  Specular_Amount = 0.5
    [[ string description =
        "incident specular amount.  This is in lieu of an explicit index-of-refraction.
        normalizes ior 1.0-1.8"
    ]],
   
    float  Specular_Tint = 0
    [[ string description =
        "a concession for artistic control that tints incident specular towards the base color.
        Grazing specular is still achromatic."
    ]],
   
    float  Roughness = 0.5
    [[ string description =
        "surface roughness, controls both diffuse and specular response.
           R = roughness^2 for diffuse & (0.5 + roughness/2)^2 for spec"
    ]],
   
    float  Anisotropic = 0
    [[ string description =
        "degree of anisotropy.  This controls the aspect ratio of the specular highlight. 
        (0 = isotropic, 1 = maximally anisotropic)."
    ]],
   
    float  Anisotropic_Rotation = 0.5,
   
    float  Sheen = 0
    [[ string description =
        "an additional grazing component, primarily intended for cloth."
    ]],
   
    float  Sheen_Tint = 0.5
    [[ string description =
        "amount to tint sheen towards base color."
    ]],
   
    float  Clearcoat = 0
    [[ string description =
        "a second, special-purpose specular lobe. always isotropic and non-metallic. 
          fixed ior=1.5. Fixed roughness=0.25. Fixed GGX gamma=2. normalizes amount 0-0.25."
    ]],
   
    float  Clearcoat_Gloss = 1  [[ string description =
        "controls clearcoat glossiness (0 = satin appearance, 1 = gloss appearance"
    ]],
   
    string Opacity = "opacity.png",
    int Reflection_Subdivs = 8,
    float Texture_Gamma = 1,

    output color result = 1
)

{
    /* Define Bump */
    normal bumped_normal = N;
   
    /* Diffuse */
    color OpacityColor = getTextureDif(Opacity, color(1));
    color BaseColor = getTextureDif(Base_Color, color(0.5));
    BaseColor = pow(BaseColor, Texture_Gamma);

    float Kd = 1;
//is there an amount?

   /* Specular */
    float IOR_disable = 0;
    float Tail = 2.0;
    float RoughnessGGX = 0;
   
    /* Spec amount - remaps ior to normalized value */
    float SpecAmount = clamp(Specular_Amount,0,1); //set min-max to 0-1
    // remapping: b1 + (s-a1)*(b2-b1)/(a2-a1)
    float IOR = 1 + SpecAmount*0.8; //in lieu of an explicit index-of-refraction. Normalizes ior 1.0-1.8
    color Fresnel = SchlickFresnel(bumped_normal, IOR); //Fresnel_Amount
   
    /* Spec tint */
    float SpecTintAmount = clamp(Specular_Tint,0,1); //set min-max to 0-1
    color TintColor= mix(1,BaseColor,SpecTintAmount); //mix between baseColor and white based on Specular_Tint amount
    color Tint = mix(TintColor,1,Fresnel); //mix between tintColor and white based on Fresnel
    Fresnel *= Tint; //tints incident specular towards the base color. Grazing specular is still achromatic.
    Fresnel *= Specular_Amount;
   
    /* Metallic */
    color BaseMetal = pow(BaseColor,2.2);
    color Edgetint = pow(BaseColor,0.2);

    float thetaB = acos(dot(-I,N));
    float RCH = AFMF(BaseMetal[0],Edgetint[0],thetaB);
    float GCH = AFMF(BaseMetal[1],Edgetint[1],thetaB);
    float BCH = AFMF(BaseMetal[2],Edgetint[2],thetaB);
   
    float MetallicAmount = clamp(Metallic_Amount,0,1); //set min-max to 0-1. 0 = dielectric,  1 = metallic
    Kd = 1 - MetallicAmount; //The metallic model has no diffuse component
    color Metallic = mix(BaseMetal,Edgetint,Fresnel); // Metallic has tinted incident specular, equal to the base color.
//    color Metallic = color(RCH,GCH,BCH);
    color SpecColor = mix(Fresnel,Metallic,MetallicAmount); // linear blend between dielectric & metallic

   
    /* Anisotropy */
    float AniAmount = clamp(Anisotropic,0,1); //set min-max to 0-1
    float AniRotation = clamp(Anisotropic_Rotation,0,1); //set min-max to 0-1
    AniRotation *= 10; // not sure why this works...


 
    /* Define Sheen */
    float SheenAmount = clamp(Sheen,0,1); //set min-max to 0-1
    float SheenTintAmount = clamp(Sheen_Tint,0,1); //set min-max to 0-1
    float facingRatio = 1 - abs(dot(I, bumped_normal));

    SheenTintAmount *= 2; // intensify tint amount
    color TintBoost = transformc("hsl", BaseColor);
    TintBoost[2] = TintBoost[2] + 0.5; // make the tint a brighter version of the mainColor
    TintBoost[2] = clamp(TintBoost[2],0,1);
    TintBoost = transformc("hsl","rgb", TintBoost);
     
    color EdgeColor = color(0.25,0.25,0.25);
    color TintEdge = EdgeColor * TintBoost;   //colorize sheen with the tint
    EdgeColor = mix (EdgeColor, TintEdge, SheenTintAmount); //mix between tinted & untinted sheen based on tint value
    EdgeColor = clamp (EdgeColor, 0, 1);
    color SheenMix = EdgeColor * facingRatio * SheenAmount;
    BaseColor += SheenMix;
   
    /*  Roughness */
    float RoughnessAmount = clamp(Roughness,0,1); //set min-max to 0-1
    float DifRoughness = pow(RoughnessAmount,2);
    float SpecRoughness = RoughnessAmount; // paper uses pow((0.5 + RoughnessAmount/2),2) in BRDF
   


    /* diffuse  */
    color BaseLess = BaseColor * 0.5; // reduce diffuse by 0.5 at grazing angles for smooth surfaces
    color BaseMore = BaseColor * 2.5; // increase diffuse by up to 2.5 at grazing angles for rough surfaces.
    color BaseEdge = mix(BaseLess,BaseMore,RoughnessAmount);
     //BaseColor = mix(BaseColor,BaseEdge,Fresnel);


    /* Clearcoat */
    float ClearcoatAmount = clamp(Clearcoat,0,1); //set min-max to 0-1
    float ClearcoatGloss = clamp(Clearcoat_Gloss,0,1); //set min-max to 0-1
    ClearcoatAmount *= 0.25; //normalizes amount 0-0.25
    float ClearIOR = 1.5; // fixed ior
   
    closure color difMain =  BaseColor * Kd *
        diffuse(bumped_normal, "roughness", DifRoughness);
       
     
     closure color spcMain = SpecColor *
        microfacet_ggx (bumped_normal, SpecRoughness, IOR_disable,
        "gtr_gamma", Tail,
        "subdivs", Reflection_Subdivs,
        "anisotropy", AniAmount,
        "aniso_rotation", AniRotation
        );
       
       
    closure color spcClearcoat = ClearcoatAmount *
        microfacet_ggx (bumped_normal, RoughnessGGX, ClearIOR,
        "gtr_gamma", Tail,     
        "reflection_glossiness", ClearcoatGloss,
        "highlight_glossiness", ClearcoatGloss,
        "subdivs", Reflection_Subdivs
        );
   
    Ci = OpacityColor * difMain + spcMain + spcClearcoat + (1.0 - OpacityColor) * transparent();
    //Ci = OpacityColor * difMain + (1.0 - OpacityColor) * transparent();
   

}

« Last Edit: 2016-07-03, 18:51:37 by Juraj_Talcik »
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!

2016-07-03, 18:32:02
Reply #25

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
Another interesting advanced PBR shader is alSurface from alShaders pack by Anders Langlands. It's primarily for Arnold, but it's also open-source, and could simply be translated to other packages thus.

It seem bit more extended in feature-set even compared to Disney Principled shader, but also more complex, less user-friendly and it has a lot of technical parameters exposed (for rendering control), part that could be avoided since Corona doesn't use such features.  I like the Disney bit more but I can see how people requiring precise or advanced control could prefer this one. It doesn't hide parameters like IOR.

This one is like compromise between 100perc. PBR, but still giving users absolute control to go outside of plausible boundaries. (lowering spec strength, specifying too high IOR for non-conductors to create "plasti-metal" crap :- ) )

http://www.anderslanglands.com/alshaders/alSurface.html

White paper: http://blog.selfshadow.com/publications/s2014-shading-course/langlands/s2014_pbs_alshaders_slides.pdf

« Last Edit: 2016-07-03, 18:51:16 by Juraj_Talcik »
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!

2016-07-03, 18:49:41
Reply #26

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
I have yet to try 3dsMax 2017 but 3rd nice PBR option came from Autodesk, the physical material.
Doesn't look bad at all ! But breaks compatibility with legacy versions,since it's only on 2017+ . Maybe they could introduce this with service pack ?

http://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=GUID-C1328905-7783-4917-AB86-FC3CC19E8972




Roughness (can be inverted so you can use your old glossines maps without ticking 'invert' inside map option). Helps with some legacy conversion.


Also features nice coating directly inside shader, with weight, roughness and affecting checkbox for bump and color. This seems to be on par with level of control provided by alShader.

Funny, Autodesk got it quite right imho :- ) Took all the correct stuff from PBR.  I would be very happy if this shader was supported. Does anyone know if it works in latest Vray ?
« Last Edit: 2016-07-03, 18:57:16 by Juraj_Talcik »
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!

2016-07-03, 19:25:40
Reply #27

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
Edit: Soon :- )
« Last Edit: 2016-07-03, 19:40:38 by Juraj_Talcik »
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!

2016-07-03, 19:42:31
Reply #28

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
Hi Juray. According to AutoDesk it (Physical Material) should work in Vray. Haven't tried it, since I'm not a Vray user :)

2016-07-03, 19:44:34
Reply #29

Juraj

  • Active Users
  • **
  • Posts: 4761
    • View Profile
    • studio website
And I don't have 2017 :- ) Someone who has 2017 + 3.4SP combo should post some test.
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!