strange code in mc.h

Discussion and help for Compilation problems and platform portability.

Moderator: coordinators

strange code in mc.h

Postby Rom1 » Tue Mar 06, 2012 1:07 pm

Hello,

I'm trying some improvement in luxrender and i see something strange :


Code: Select all
   void SampleContinuous(float u0, float u1, float uv[2],
         float *pdf) const {
      float pdfs[2];
      unsigned int v;
      uv[1] = pMarginal->SampleContinuous(u1, &pdfs[1], &v);
      uv[0] = pConditionalV[v]->SampleContinuous(u0, &pdfs[0]);
      *pdf = pdfs[0] * pdfs[1];
   }

   void SampleDiscrete(float u0, float u1, unsigned int uv[2], float *pdf) const {
      float pdfs[2];
      uv[1] = pMarginal->SampleDiscrete(u1, &pdf[1]);
      uv[0] = pConditionalV[uv[1]]->SampleDiscrete(u0, &pdf[0]);
      *pdf = pdfs[0] * pdfs[1];
   }



on the second method : should we correct

uv[1] = pMarginal->SampleDiscrete(u1, &pdf[1]);
by
uv[1] = pMarginal->SampleDiscrete(u1, &pdfs[1]);

and the same for
uv[0] = pConditionalV[uv[1]]->SampleDiscrete(u0, &pdfs[0]);

I think the returned pdf is bad ...


and the same in mcdistribution.h
Rom1
Developer
 
Posts: 100
Joined: Thu Feb 04, 2010 7:18 am

Re: strange code in mc.h

Postby jeanphi » Tue Mar 06, 2012 3:27 pm

Hi,

You are indeed right. It should fix HDR lighting.

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


Return to Compilation & Portability

Who is online

Users browsing this forum: No registered users and 0 guests