Small SchlickBRDF::SampleF question

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: jromang, tomb, zcott, coordinators

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Sun Sep 11, 2011 3:52 pm

I've been a bit ill this week and haven't had the time to work much on this :(

jeanphi wrote:My idea was that a generic 2 layer BSDF would be stackable to allow multilayers.


I'm not entirely sure what you mean by stackable?

jeanphi wrote:Regarding the specular reflection, you get to it either with the Rho member or by updating the Weight member which is meant for that (only used by glass currently with specular transmission/reflection). The hardest part here is that the specular reflection depends on the half angle which you don't know beforehand, I hadn't found any elegant heuristic to solve that part.


Rho is not thread safe and I'm not sure what good it would do in any case. Weight seems good. As for the sampling... As mentioned, from my limited tests simply using the specular reflection direction to compute H (ie H == N) seemed to work well.

jeanphi wrote:For the coating absorption, I planed to reference a named volume for the coating, this would give the IOR and the absorption in one go, plus allow scattering if we ever want to support it... It would be stored in the BSDF along with the coating depth so the BSDF would have all element to compute the absorption.


This sounds like a good idea.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4518
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Mon Sep 12, 2011 2:43 am

Hi,

I hope you'll feel better soon.

Lord Crc wrote:
jeanphi wrote:My idea was that a generic 2 layer BSDF would be stackable to allow multilayers.


I'm not entirely sure what you mean by stackable?

Well, if you have a generic 2 layer thingy, then you can add a coating over a coated material, ... Not really efficient, but that's a start.

Jeanphi
jeanphi
Developer
 
Posts: 6624
Joined: Mon Jan 14, 2008 7:21 am

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Mon Sep 12, 2011 5:03 am

jeanphi wrote:I hope you'll feel better soon.

Well, if you have a generic 2 layer thingy, then you can add a coating over a coated material, ... Not really efficient, but that's a start.


Thanks :)

Right, I didn't think about the volumes being passed to the BSDF, without them it would be impossible. Well I think I'll start with a simple 2 layered one and try to generalize. Also we'll need the amount of reflection for each layer (BxDF) for a pair of directions. Currently this is given by Weight(), but that name sounds more general than what we need it for. I think I'd like to introduce a new function and just have SpecularReflection::Weight() etc call it, but perhaps you have a better idea? This should then also hopefully make it easier to incorporate the "passthrough" (opacity?) you mentioned, so you could have a partially see-through metal layer fex.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4518
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Mon Sep 12, 2011 6:54 am

Lord Crc wrote:Right, I didn't think about the volumes being passed to the BSDF, without them it would be impossible. Well I think I'll start with a simple 2 layered one and try to generalize. Also we'll need the amount of reflection for each layer (BxDF) for a pair of directions. Currently this is given by Weight(), but that name sounds more general than what we need it for. I think I'd like to introduce a new function and just have SpecularReflection::Weight() etc call it, but perhaps you have a better idea? This should then also hopefully make it easier to incorporate the "passthrough" (opacity?) you mentioned, so you could have a partially see-through metal layer fex.

The rational behind the Weight member is to help select the most important component. I introduced it initially for the glass material: previously the reflection and refraction were sampled with equal probabilities regardless of the incident angle. The idea is that the returned value can even be used as a precomputation step for the BxDF. I don't see why you want to introduce another function. This selection stuff only needs to happen for SampleF when we only have 1 known direction, otherwise you don't need to select anything, since you compute all possible paths.

Jeanphi
jeanphi
Developer
 
Posts: 6624
Joined: Mon Jan 14, 2008 7:21 am

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Mon Sep 12, 2011 7:29 am

You're of course right, I was getting things mixed up.

What I was thinking about is computing F(), then the BxDF::F() of the lower layer has to be modulated by the transmission component (1-R) from the above layer. However since I mixed it up I forgot that we use the fresnel object from the coating volume, and possibly modulate it by the pass-through factor. Then we should get what we want.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4518
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Mon Sep 12, 2011 10:01 am

Ok, after playing with it a bit I think I've zeroed in on my confusion :)

A generic layered BSDF which you describe will need to accept BSDF's for the two layers. The BSDF does not have any Weight function or similar.

If the layered BSDF accept BxDF's then there's no issue there but you can't stack them.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4518
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Mon Sep 12, 2011 10:23 am

Hi,

You don't need a BSDF for the coating: you can start simple with a specific coating (like schlick coating formula), being general for the coating will be much more difficult.

Jeanphi
jeanphi
Developer
 
Posts: 6624
Joined: Mon Jan 14, 2008 7:21 am

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Mon Sep 12, 2011 10:26 am

Right, that will indeed make it a lot easier :D
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4518
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Wed Sep 14, 2011 7:58 pm

Hmm, making some baby steps at least :)

Currently my LayeredBSDF takes a BxDF for the top (coating) layer, a Fresnel for the coating and a BSDF for the base layer.

It assumes that the top layer uses the same Fresnel object in it's BxDF::F(), so my LayeredBSDF only uses the Fresnel object to blend between the top and the base. Not very elegant, the alternative would be to add a member to BxDF to get the fresnel reflectance, but that's not brilliant either. It should be easy to add the pass-through you wanted.

I've so far added a GlossyCoating which uses the LayeredBSDF. It's based on Glossy2, but takes a named material instead of Kd. I've added a specular-only variant of the SchlickBRDF which I use for the coating BxDF. The alternative would be to hard code this in the LayeredBSDF (along with all the Schlick special functions). Thoughts?

Here's an example of the GlossyCoating:
Code: Select all
MakeNamedMaterial "translucentbase"
   "color Kr" [0.075 0.005 0.0005]
   "color Kt" [0.75 0.05 0.005]
   "bool energyconserving" ["true"]
   "string type" ["mattetranslucent"]

MakeNamedMaterial "luxball"
   "string type" ["glossycoating"]
   "string basematerial" ["translucentbase"]
   "color Ks" [0.1 0.1 0.1]
   "float uroughness" [0.005]
   "float vroughness" [0.005]


I've attached the output from the above material example after about 30 minutes.

I think (hope) I've got the weighting and PDF stuff more or less right (ie not horribly wrong), but I'm sure there are some issues left. For example I'm not sure I'm handling the flags and sampled type stuff correctly, especially in the case where the SampleF flag is only for diffuse (what to do about the coating?).
Attachments
layeredbsdf3.jpg
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4518
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Thu Sep 15, 2011 1:40 am

Hi,

Cool, I'm longing to have a look at it in detail.

Jeanphi
jeanphi
Developer
 
Posts: 6624
Joined: Mon Jan 14, 2008 7:21 am

PreviousNext

Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 0 guests