mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.87k stars 1.18k forks source link

Light from Point light source seems couldn't pass through Glass material #197

Closed jk-vision closed 6 years ago

jk-vision commented 6 years ago

Hi,

i'm new to pbrt and was trying to render an image where the environment is as follows, (the checkerboard is inside the glass box that contains water) image

However, the image rendered in a full black image. Could someone help me with this?

My pbrt file is

LookAt 0 4 0  # eye
         0 0 0  # look at point
         0 0 1  # up vector
Camera "perspective" "float fov" 30

Sampler "halton" "integer pixelsamples" 2048

Integrator "volpath" 

Film "image" "string filename" ["img1.exr"]
      "integer xresolution" [128] "integer yresolution" [128]

MakeNamedMedium "water" "string type" "homogeneous"
#absorption cross section
    "rgb sigma_a" [ 0.006 0.006 0.006]
#scattering cross section
         "rgb sigma_s" [ 0 0 0]

WorldBegin

AttributeBegin
LightSource "point" "point from" [0  4  0] "rgb I" [100 100 100]
AttributeEnd

AttributeBegin
Material "glass"
MediumInterface "water" ""
Shape "trianglemesh"
"integer indices" [0 2 1 0 3 2 0 5 7 0 1 5 1 2 4 1 4 5 3 6 4 3 4 2 7 6 3 7 3 0 7 4 6 7 5 4]
"point P" [ -50 0 -50   50 0 -50   50 0 50  -50 0 50   50 -40 50   50 -40 -50   -50 -40 50   -50 -40 -50]
AttributeEnd

AttributeBegin
  Texture "checks" "spectrum" "checkerboard"
          "float uscale" [7] "float vscale" [6]
          "rgb tex1" [.1 .1 .1] "rgb tex2" [.8 .8 .8]
 Material "matte" "texture Kd" "checks"
 Shape "trianglemesh"
 "integer indices" [0 2 1 0 3 2]    
 "point P" [ -2 -10 -2   2 -10 -2   2 -10 2  -2 -10 2 ]
 "float st" [ 0 0   1 0    1 1   0 1 ]

AttributeEnd

WorldEnd
sriravic commented 6 years ago

Hi.

This would be because the path vertex at the light source and the glass are both specular (delta) and hence they cannot be connected by direct path sampling strategies (their eval() functions return zero all the time). If you use an area sensor then a light tracer (starting from the light source) might be able to have some rays from the glass hit the sensor but with a pinhole camera, you cannot render this also.

Try using photon mapping to visualize this scene or use a small area light source instead of a point light source.

jk-vision commented 6 years ago

Hi, thanks for your kind reply.