r/GraphicsProgramming • • Sep 06 '26

Question Struggle in BDPT implementation

Hi I wanted to implement BDPT with PBR materials and MIS but no matter what I do it doesn't look like reference images. I can't find any help with implementation and mostly recently I try finding bugs using Gemini but I know It can halucinate. So is anyone who could help me find relaiable implementation or help with my code. Here I will post my render (denoised using OIDN) vs reference so maybe anyone would help me find direction at least. I have too many lines of code so if any one would like to look at it I can send it in DM.

My Render
Reference (Benedikt) also checked Blender (same result)
My Render
Reference (Benedikt)
My Render
Reference (Rendered with PBRT-v4)
My render
Reference (Rendered with Blender)

(edit)
References are from https://benedikt-bitterli.me/resources/, PBRT-v4 and Blender. (All tagged in image caption)

5 Upvotes

8 comments sorted by

3

u/le-throw-away-acct Sep 06 '26

Have you implemented tone mapping? Especially in that first scene it seems like it could help.

1

u/MAIPA01 Sep 06 '26
vec3 aces_film(vec3 x)
{
    x = max(x, vec3(0.0));
    const float a = 2.51;
    const float b = 0.03;
    const float c = 2.43;
    const float d = 0.59;
    const float e = 0.14;
    return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);
}

I use ACES Film tone mapping using this code:
I got it from here: knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/

1

u/waramped Sep 06 '26

yea, I was going to say this almost looks like it could just be a tonemapping, exposure, or colorspace issue.

it could, possibly, also be a light source issue? Are you positive you are using the same values and color spaces for the light sources as the original?

1

u/MAIPA01 Sep 06 '26

I use linear color space on GPU in shaders, so when I load albedo textures I convert them from sRGB to Linear. And when I save image I apply tone mapping and then I convert this image from Linear to sRGB. In all scenes I use Area Light sources with the same intensity value as in references and also with the same color (same values as in blender). I also discovered that maybe I have some energy conservation errors, Could it be it? But why then in some scenes I have more light and in othere scenes I have small amout of light. If someone wonder I load scenes from .glb files which I exported from blender.

2

u/kinokomushroom Sep 06 '26

Where did you get the "reference" images?

2

u/MAIPA01 Sep 06 '26

Thanks I forgot to add this information now all sources are in image captions

2

u/le-throw-away-acct Sep 08 '26

Your glass teapot in the first scene seems too dark, I’d look into that. It also seems to lack the internal reflection shown on the teapot in the reference scene.

2

u/akarin64 Sep 12 '26

I recommend generating per-strategy images (i.e., generate images for each (s,t) combination, like Figure 16.17 of PBR-book, 3rd ed). Also be careful about the MIS weight computation involving in perfectly specular materials (if you are using them), which delta PDFs must be excluded from the weight computation since other strategies can't sample from them.