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

jeanphi wrote:Probably because you just found a bug in MicrofacetReflection

Heh, nice to know I'm not completely dumb

If so, then the same bug is in CookTorrance, haven't checked the others.

edit: and of course Pdf() will have to be adjusted as well.
May contain traces of nuts.

Lord Crc

Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Small SchlickBRDF::SampleF question

Ok, I've now modified SchlickBSDF to take a MicrofacetDistribution instead of the BxDF.

I've then added some new private members to mimic the BxDF code, such as CoatingF, CoatingSampleF and CoatingPdf, which essentially does what MicrofacetReflection does. GlossyCoating then uses SchlickDistribution.

Sounds ok?
May contain traces of nuts.

Lord Crc

Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Small SchlickBRDF::SampleF question

Hi,

Looks ok to me, let's commit the code and see how it behaves

Jeanphi
jeanphi

Posts: 6570
Joined: Mon Jan 14, 2008 7:21 am

### Re: Small SchlickBRDF::SampleF question

Pushed.

I did some minor changes to your additions. Perhaps I'm wrong, so please review if you have a chance.

I left out the rho() implementation for now, I guess we'll have to copy it all from BxDF::rho()?

Also it seems to be working fine with SPPM
Attachments
Two glossycoating layers and a mattetranslucent base, rendered with SPPM.
May contain traces of nuts.

Lord Crc

Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Small SchlickBRDF::SampleF question

Hi,

You're changes (and fixes) look ok to me, thanks.
The rho members are only used by exphotonmap and IGI, but they are absolutely mandatory to those algorithms.

Jeanphi
jeanphi

Posts: 6570
Joined: Mon Jan 14, 2008 7:21 am

### Re: Small SchlickBRDF::SampleF question

I've copied the rho stuff into CoatingRho, so this should work now.

As for MicrofacetReflection and friends... I don't feel confident fixing this, do you have time to do it?
May contain traces of nuts.

Lord Crc

Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Small SchlickBRDF::SampleF question

Hi,

Regarding the pdf, it might actually be MicrofacetReflection that is correct and Schlick model that is wrong, I'll have a closer look at it.

Jeanphi
jeanphi

Posts: 6570
Joined: Mon Jan 14, 2008 7:21 am

### Re: Small SchlickBRDF::SampleF question

In that case I feel even less confident trying to fix it

Do let me know if I can help though

edit: If "pdfBack" should match what Pdf(wi, wo) would give you, then it's MicrofacetReflection which is wrong, or MicrofacetReflection::Pdf() is wrong.
May contain traces of nuts.

Lord Crc

Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Small SchlickBRDF::SampleF question

Hi,

I think that MicrofacetReflection is actually correct: pdf=microfacetPdf/(4*AbsDot(wo,wh)), however by construction AbsDot(wo,wh)==AbsDot(wi,wh) and the pdf is reciprocal!

Jeanphi
jeanphi

Posts: 6570
Joined: Mon Jan 14, 2008 7:21 am

### Re: Small SchlickBRDF::SampleF question

Ah and the devil hides in the details again, good point
May contain traces of nuts.

Lord Crc

Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

Previous