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 Nov 13, 2011 12:37 pm

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


Heh, nice to know I'm not completely dumb :lol:

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.
User avatar
Lord Crc
Developer
 
Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Sun Nov 13, 2011 1:27 pm

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.
User avatar
Lord Crc
Developer
 
Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Sun Nov 13, 2011 2:26 pm

Hi,

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

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

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Sun Nov 13, 2011 6:10 pm

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
coating_sppm5.jpg
Two glossycoating layers and a mattetranslucent base, rendered with SPPM.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Sun Nov 13, 2011 6:33 pm

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
Developer
 
Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Sun Nov 13, 2011 11:33 pm

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.
User avatar
Lord Crc
Developer
 
Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Mon Nov 14, 2011 4:19 pm

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
Developer
 
Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Mon Nov 14, 2011 4:39 pm

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

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.
User avatar
Lord Crc
Developer
 
Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Re: Small SchlickBRDF::SampleF question

Postby jeanphi » Mon Nov 14, 2011 4:57 pm

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
Developer
 
Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

Re: Small SchlickBRDF::SampleF question

Postby Lord Crc » Mon Nov 14, 2011 5:12 pm

Ah and the devil hides in the details again, good point :)
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Previous

Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 0 guests