mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
2.01k stars 229 forks source link

Modify aov integrator to make it sopport base color #303

Closed ys521325 closed 1 year ago

ys521325 commented 1 year ago

I want to use Mitsuba3 to render base color(albedo) image, I don't need shading normal, So I intend to replace it with base color. I notice that https://github.com/mitsuba-renderer/mitsuba3/issues/170 have a solution on how to get base color, but I want to integrate it with aov integrator like this:

case Type::ShadingNormal:
                    {
                        auto bsdf = si.bsdf(ray);
                        auto si_retro    = si;
                        si_retro.wi   = si.n;
                        Spectrum value =
                            si.bsdf().eval(ctx, si_retro, si.n, active);
                    }
                    break;

And it reports initialization of 'bsdf' is skipped by 'case' label.

Besides I don't know how to transform spectrum to rgb3. Could you offer me any solutions?

njroussel commented 1 year ago

Hi @ys521325

Take a look at https://github.com/mitsuba-renderer/mitsuba3/pull/283. In there we're adding support for the OptiX Denoiser, but we're also adding a albedo field to AOVs. It might not exactly match what you want, but it should at least help you to implement your own field in the aov integrator. Namely, you can copy/replicate how we do the spectrum/<->color3f conversion and how the BSDF is used to evaluate the diffuse reflectance.

ys521325 commented 1 year ago

Got it. Thank you very much for your help.