Simple PBR BSDF with PDF?

Started by
3 comments, last by Vilem Otte 2 months, 3 weeks ago

I am looking for a simple BSDF that can nicely interpolate 3 parameters (transparency, metallicity, roughness), but it must come with pdf evaluation as well.

So I want a BSDF function that can generate samples with some reasonable importance sampling and then another function that can calculate PDFs of a given existing sample.

Example of exactly what I want: https://www.shadertoy.com/view/sltXRl

vec3 DisneySample(State state, vec3 V, vec3 N, out vec3 L, out float pdf);

vec3 DisneyEval(State state, vec3 V, vec3 N, vec3 L, out float bsdfPdf);

The problem with this one is complexity – I am looking for something much cheaper, so it could be used e.g. for real-time raytracing in editor preview mode.

I found countless of cheap BSDFs on shadertoy, but they never have the 2nd evaluation function. The only ones I found are these expensive Disney's implementations.

Advertisement

I don't think you will find a “simple” PBR BSDF. Cook-Torrance is another option. Sampling from those functions will not be straightforward.

However a key insight is that in a path tracer the BRDF used for sampling does not have to exactly match the BRDF used for evaluating the light intensity. For instance, you could use Disney or Cook-Torrance for the evaluation function, then use a simple Phong BRDF for the importance sampling and PDF. Then your path tracing calculation becomes:

out = samplePhong( in, N )
outPDF = phongPDF( in, out, N )
outI = inI * Disney( in, out, N ) / outPDF

This should converge to the same result if you had a magic function to sample and calculate PDF for Disney BRDF. The BRDF used for sampling only affects the convergence rate. Phong is close enough to PBR to get good convergence.

@Aressera Wou, this is actually a pretty smart idea. I understand, drawing samples from phong with corresponding phong distribution, while the contribution itself can be “fancy”. The only difference is the convergence speed as you pointed and as long they are similar, they should converge reasonably fast to the same result. I am impressed 🙂 Thank you! 🙂

Aressera said:
The BRDF used for sampling only affects the convergence rate.

Let's also add a note that it can also negatively affect it (up to the point where it is unusable). Keep that in mind.

For an extreme case:

If BRDF of given material is mirror reflection one and you try to sample with model that does F.e. uniform hemisphere sampling … it is extremely unlikely it will hit the exact reflection spot within finite time.

Aressera said:
I don't think you will find a “simple” PBR BSDF. Cook-Torrance is another option. Sampling from those functions will not be straightforward.

For Disney B*DF and importance sampling - it's not straightforward, but possible (this is probably more for @gamer9xxx ). I won't try to derive it here (would take quite a bit) - and rather point you to article about it: https://shihchinw.github.io/2015/07/implementing-disney-principled-brdf-in-arnold.html

If you're looking for some more “simple” B*DF - I'd say GGX tends to be simpler than Disney (or at least I think so). But as it was noted, any semi-realistic B*DF is generally not simple.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

This topic is closed to new replies.

Advertisement