Skip to content
  • Matt Pharr's avatar
    Factor out radiance scaling due to transmission when applying Russian roulette. · 615b1347
    Matt Pharr authored
    When rays from the camera are refracted to different media, the radiance
    they carry is scaled depending on the relative indices of refraction. It's
    worthwhile to apply Russian roulette without including this scaling, since
    it saves us from terminating rays that are actually about to refract out of
    a medium and have the effect of radiance scaling cancelled out.
    
    Test scene that shows the difference:
    
    Film "image" "integer xresolution" 400 "integer yresolution" 400
    
    Sampler "halton" "integer pixelsamples" 1
    Integrator "path" "float rrthreshold" .8 "integer maxdepth" 7
    
    LookAt 0 0 -3   0 0 0   0 1 0
    Camera "perspective"
    
    WorldBegin
    
    LightSource "spot" "rgb I" [1000 1000 1000] "point from" [0 15 0] "point
    to" [0 0 5]
    
    AttributeBegin
    Material "uber" "rgb Kd" [ 0 0 0] "rgb Ks" [ 0 0 0 ] "float index" 1
      "rgb Kt" [0 0 0 ] "rgb opacity" [.00001 .00001 .00001]
    Shape "trianglemesh" "point P" [-9 -9 -2.5   9 -9 -2.5    0 9 -2.5 ]
      "integer indices" [0 1 2]
    Shape "trianglemesh" "point P" [-9 -9 -2.25   9 -9 -2.25    0 9 -2.25 ]
      "integer indices" [0 1 2]
    Shape "trianglemesh" "point P" [-9 -9 -2   9 -9 -2    0 9 -2 ]
      "integer indices" [0 1 2]
    Shape "trianglemesh" "point P" [-9 -9 -1.5   9 -9 -1.5    0 9 -1.5 ]
      "integer indices" [0 1 2]
    AttributeEnd
    
    AttributeBegin
    Material "glass"
    Shape "sphere"
    AttributeEnd
    
    Material "matte" "rgb Kd" [.4 .4 .8 ]
    Shape "trianglemesh" "point P" [-40 -40 5   40 -40 5    0 40 5 ]
      "integer indices" [0 1 2]
    
    WorldEnd
    615b1347