Jump to content

Cook-Torrance Model in Mantra Shader ?


Recommended Posts

post-324-0-02424200-1406589786_thumb.jpg

Blinn with a shiny value mapped to a equivalent roughness value.

 

post-324-0-52634200-1406589806_thumb.jpg

GGX model, notice you can still see the terminators.  This is a straight distribution, not a full microfacet model.

 

post-324-0-87914200-1406592656_thumb.jpg

GGX microfacet model, includes Fresnel, Geometric masking term and "N dot L"

Edited by Wolfwood
Link to comment
Share on other sites

That looks great, you tease! :P

I hope sideFx are looking into this.

 

I can get reflections like this in traditional workflow (just as an exercise before the bsdf headache) with artist control over the `tails` (For loop, disturbing N with gauss rand noise, with pow to tweak the peak, plugged into phys spec set to cone and zero angle, etc) works fine for indirect reflections but its obviously horribly noisy for tracing direct area lights.

 

On one hand I'm kind of hoping to be forced to make my own ggx type bsdf, on the other I have a ton of other important stuff to do! :( 

Link to comment
Share on other sites

That looks great, you tease! :P

I hope sideFx are looking into this.

 

I can get reflections like this in traditional workflow (just as an exercise before the bsdf headache) with artist control over the `tails` (For loop, disturbing N with gauss rand noise, with pow to tweak the peak, plugged into phys spec set to cone and zero angle, etc) works fine for indirect reflections but its obviously horribly noisy for tracing direct area lights.

 

On one hand I'm kind of hoping to be forced to make my own ggx type bsdf, on the other I have a ton of other important stuff to do! :(

 

The plan is to post the ggx, disney bsdf implementation plus a big microfacet swiss army knife similar to the compare.brdf in BRDF in the next day or so once I finish up writing the help.

post-324-0-53995800-1406659038_thumb.jpg

  • Like 3
Link to comment
Share on other sites

Wow! That's just amazing, I hope you can handle all the free beer! :)

 

Q re the inclusion of Fresnel within the bsdf. Does this lead to more plausible results? I've read in a couple of places that it is separable, as in you can just mult the bsdf with Fresnel, which is what my ubershader and sesi surface model does. Its probably my inability to understand these papers in depth, but I have always thought it was strange for this to be accurate with rough reflections. I would have thought that as the ray deviates from a perfect mirror a different Fresnel result would be needed per ray coz the microfacet angle is different than the geometric. Am I talking crapola?

Link to comment
Share on other sites

I would have thought that as the ray deviates from a perfect mirror a different Fresnel result would be needed per ray coz the microfacet angle is different than the geometric.

 

This.  The Fresnel component is taken with respect to microfacet's normal (the half vector between the light vector and eye vector) not the surface normal.  Because you need the sample direction of the light to compute the half angle, which is only available inside the pathtracing engine, the ideal place to do this is within the bsdf (or rewrite the pbr engine).  For mirror-like surfaces this isn't a problem but like you said, the rougher the surface the more this contribution makes a difference.

 

post-324-0-14720300-1406685660_thumb.jpg

 

Which one is right?  Which ever the client thinks looks better.   :)

 

 

As a side note-

 

In all my testing I've been using PBRT as a "ground truth" because its has had a lot of different rendering experts studying it closely over the years and its very well documented.  So when doing these Mantra BSDFs, like the GGX microfacet, I'll test them in PBRT to make sure that I get similar images.  Its somewhat impressive that given the same camera, geometry, lights positions along with the same implementations of BSDF model how incredibly close the resulting two images will be.

 

PBRT & Mantra

post-324-0-05833900-1406684191_thumb.jpg post-324-0-84890500-1406684201_thumb.jpg

Edited by Wolfwood
Link to comment
Share on other sites

Thats great, the effect is what I expected to happen :)

 

Goes some way to explain why I failed miserably to shade very rough surfaces (like brick/concrete) whilst trying to follow the physical correct rule of `everything is 100% reflective at glancing angle`. This looks like it would surely help to stay within `real` parameters, but actually get `real` looking results too... :)

 

Porosity is another thing that shading models ignore, which can account for over bright  rough reflections. There's something about that on one of my fave blog, march 17th posthttp://www.filmicworlds.com/    

Link to comment
Share on other sites

Porosity is another thing that shading models ignore, which can account for over bright  rough reflections. There's something about that on one of my fave blog, march 17th posthttp://www.filmicworlds.com/    

 

Wow.... so many gems.  Must....read...it..all.

 

Thanks.

 

Ps-  I'll post everything I have tonight just to get some more eyes on it.  Though its all being worked on from time to time.  (I spent the morning figuring out why a render was going black, turns out a value ended up being raised to the 4th power over the course of execution pushing the small value beyond the happiness to floating point land.)   :angry:

Edited by Wolfwood
Link to comment
Share on other sites

Awesome, based on the screenshot it's exactly what it should be!

 

The only ambiguity in GGX I've run into is how the smoothness value is mapped - everybody seems to have their own little variation on it. (At least in the realtime world.)

Are you using the Disney one? (GGX roughness = Disney roughness ^2)

 

The parameter ranges can be a bit non-intuitive at first, so a value chart would be great to have in the help page - but you probably are already on it :)

Link to comment
Share on other sites

I use the disney roughness^2.  It maps into a somewhat nice range.  In the end the cvex models take an alpha parameter.   The front-end (the VOP) does the remapping.  And on the help pages I'm including links to as many of the references as possible.  Ultimately this is such a huge topic it makes doing the help page a bit daunting, so I've opted for here is the parameters and a brief description of what they do and then tons of links.

Edited by Wolfwood
Link to comment
Share on other sites

You probably have much of the same, but I'll just dump my bookmark list here anyway. These are a bit game oriented, but it's all the same, really, these days :)

 

 

Indeed, nice list! :D

 

This one is quite nice from this year, they talk about supporting an anisotropic geometric term.  Its on my todo list.  :D

 

http://hal.archives-ouvertes.fr/docs/00/94/24/52/PDF/RR-8468.pdf

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