mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.83k stars 440 forks source link

Transparent (dielectric) material with projection light gives unexpected behavior #178

Open kontramind opened 3 years ago

kontramind commented 3 years ago

Hi, Using projector light to simulate a scene with structured light. The scene contains transparent (dielectric) objects.

Here is an image with ambient light, just to have an overview of the scene. One can already notice suspicious shadows behind the bottles. I would expect that patterns are penetrating the bottles. image

Things become even more apparent if env light is turned off (only projected patterns). image

I can get something when roughness is set to non-zero value, but not sure if it is "correct" (too much noise?). See image below (only one bottle is tweaked to have roughness). image

The questions are:

Many thanks Aleksandar

kontramind commented 3 years ago

In addition, have performed an experiment where instead of projector a focused red spot light is used.

Here is an image with a bottle shape and diffuse material - to illustrate where the light hits. image

And here is an image of same scene but bottle has been made as dielectric. image

shadeops commented 3 years ago

The VolPath integrator appears to ignore(?) SpecularTransmission but does work with GlossyTransmission (when the dielectrics have roughness). Whether that is a bug or by design I'm not sure.

If you switch to another integrator like the BDPT you can get SpecularTransmission.

bdpt bdpt2

kontramind commented 3 years ago

@shadeops Hi, Many thanks for your input. What type of light source you were using?

Please, would it be possible for you to share the scene files so I can reproduce your images? Aleksandar

shadeops commented 3 years ago

Top image is using a AreaDiffuse light with a sphere shape. The bottom image is using a projector light. Both were rendered with the BDPT.

example.zip

kontramind commented 3 years ago

Top image is using a AreaDiffuse light with a sphere shape. The bottom image is using a projector light. Both were rendered with the BDPT.

example.zip @shadeops

Found your example very useful. One thing to note wrt. my bottle(s) is that normals for the geometry may not be correct; I really hope that is not the complexity of the geometry. Hence I continued to play with your setup; simple transparent slab.

I have added color to the background planes and used more dense pattern. With BDPT, one can see that lower left corner in the slab is giving dark shadows even thought the red background should be visible. See the image below. image

Then I tried SPPM (photon mapping) and it seems that the dark area improves. However, due to the algorithm itself, patterns appear more noisy/fuzzy. See the image below. image

This kind of hints that a combination of BDPT and SSPM could give more faithful result. Maybe having VCM (Vertex Connection and Merging) light transport algorithm would help; not implemented in PBRT.

What dp you think @shadeops (and @mmp)?

shadeops commented 3 years ago

If the sppm integrator looks a bit blurry you can usually lower the photon search radius.

I'm not entirely sure where that black triangle is coming from in the bidirectional integrators. Perhaps a limitation when sampling a point light source via specular transmission.

VolPath

volpath

MLT

mlt2

BDPT

bdpt

SPPM

sppm3

Scene

scene.zip

Just to make sure that the triangle faces were facing the right way I made an alternate version using bilinear meshes as well that you can switch between.

kontramind commented 3 years ago

@shadeops Many thanks for your tips. I went with a small radius of 0.001 in SPPM. Also, box filtering worked better for my case. I also tried different integrators and got results in sync with yours.

Also have noticed, when it comes to noise with SPPM, it gets even worse if one is using realistic camera with lenses; especially for parts behind the transparent items.

Perspective camera image

Realistic with lenses image