pbrt-v4 icon indicating copy to clipboard operation
pbrt-v4 copied to clipboard

Mediums look too dark when an infinite environment is used as a light source

Open NicNel opened this issue 3 years ago • 3 comments

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: AreaLight

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

When an environment map is used: Env

NicNel avatar Jun 21 '22 03:06 NicNel

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:

image

and this for "env":

image

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.

mmp avatar Jun 21 '22 14:06 mmp

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: medium_test

NicNel avatar Jun 21 '22 22:06 NicNel

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: world_medium_area When an environment map is used: world_medium_env With a constant color env: world_medium_const Or, maybe I'm doing something in an appropriate way) And here is the result if I place whole scene inside shape with medium: global_inner

NicNel avatar Jun 22 '22 02:06 NicNel