Giter VIP home page Giter VIP logo

Comments (5)

LukasRuppert avatar LukasRuppert commented on June 17, 2024 1

The m_distributions[0] is actually an entire mixture of up to 32 components.
For the BSDF product, I may have to compute the product with 2 components
which then results in two mixutres m_distributions[0] and m_distributions[1] which essentially combine into a mixture of up to 64 components.

The product function I've linked above is the wrong one.
This one will be called:

PMM_INLINE float product(const TKernel& a)
{
const uint32_t numActiveKernels = (m_K+ScalarWidth::value-1)/ScalarWidth::value;
ScalarType partialSumScale {0.0f};
for (uint32_t k=0; k<numActiveKernels; ++k)
{
partialSumScale += m_comps[k].product(a);
}
const float sumScale = lightpmm::sum(partialSumScale);
ScalarType inv_sumScale(1.0f/sumScale);
for (uint32_t k=0; k<numActiveKernels; ++k)
{
m_comps[k].m_weights *= inv_sumScale;
}
return sumScale;
}

Which then calls the one I've linked above on all components.

from robust-vmm-guiding.

LukasRuppert avatar LukasRuppert commented on June 17, 2024

Hi,
of course, all vMF distributions span the entire sphere - so when sampling them without bias, there are necessarily always a few samples below the hemisphere.
However, when we sample a vMF mixture, we already know our intersection point and its surface normal.
So, instead of sampling the mixture as is, we compute the product of each component with a vMF approximation of the cosine lobe centered around that surface normal.
(Each component will also be weighted by the integral of that product.)
The resulting mixture will be focused much more towards directions on the upper hemisphere and far less towards the lower hemisphere.
Essentially, its the cheapest way of product sampling you can do:
In this case, we only consider the cosine term in the rendering equation.

The relevant code is here:

else if (gBSDF.m_useCosineProduct)
{
const TVMFKernel vmfCosineLobe(1.0f, 2.18853f, surfaceNormalTowardsWi);
gBSDF.m_guidingData.m_productIntegral = gBSDF.m_guidingData.m_distributions[0].product(vmfCosineLobe);
}

Here, the product function modifies the mixture in place:
PMM_INLINE TScalar product(const VMFKernel<TScalar>& a)

And just above you can find the code for the full BSDF (including cosine) product sampling which can deal with multiple lobes.

I hope that is clear enough, I feel like this needs some drawing to come across :)

Best regards,
Lukas

from robust-vmm-guiding.

Mephisto405 avatar Mephisto405 commented on June 17, 2024

OMG, "a vMF approximation of the cosine!" -> That makes sense because the product of two vMF-lobes is as straightforward as your paper described in Appendix A.1, isn't it?
When I first read the paper, I was confused about multiplying the vMF with the cosine. But now I understand that you're multiplying it after approximating the cosine as another vMF. Thank you for explaining it so quickly and clearly.

from robust-vmm-guiding.

Mephisto405 avatar Mephisto405 commented on June 17, 2024

Additionally, I'm wondering why only the first lobe (gBSDF.m_guidingData.m_distributions[0]) is used when sampling the cosine product in GuidingDistributionFactoryVMM.h.

from robust-vmm-guiding.

Mephisto405 avatar Mephisto405 commented on June 17, 2024

Thank you very much!!

from robust-vmm-guiding.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.