pbrt-v4
pbrt-v4 copied to clipboard
Mediums look too dark when an infinite environment is used as a light source
Hello! I've worked around volumes and found that homogeneous mediums (maybe others as well) appear almost black when an infinite environment with color/texture is used as a light source. With area lights sources, mediums look correctly. Pbrt-v4 scenes files: mediums2.zip
When area light is used:

When an infinite light source is set with a constant color:

When an environment map is used:

I think that the issue is that MediumInterface takes the "inside" medium first and then the "outside" medium, but you had them swapped. Changing the MediumInterface statements in the geometry.pbrt files to:
MediumInterface "Material.003::pbrtv4Homogeneous::Cube::0" ""
Seems to fix things. For example, for constenv, if I also remove the "scale" 10 for the env light, I get this:

and this for "env":

However, it's unclear to me why it worked for the area light case to have them swapped. I'll leave this open for now pending chasing that down to understand what's going on.
got it, I've generated the output string incorrectly, thank you) It "feels" like in some cases the outside medium works strange if there is no participating media outside the shape (but it is set) and an infinite light source is used (or area light source is used).
Here, on the screenshot, (rendered image on left side) red sphere is lited with constant env, and material preview (right side) is generated with area lights:

Interestingly, that if I define global outside medium (before WorldBegin) in scene file like so:
MakeNamedMedium "mymedium" "string type" "homogeneous" "string preset" "Sprite"
MediumInterface "" "mymedium"
WorldBegin
...
The result looks like:
With area light:
When an environment map is used:
With a constant color env:
Or, maybe I'm doing something in an appropriate way)
And here is the result if I place whole scene inside shape with medium:
