POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Attached to Project: POV-Ray
Opened by Paul - 2013-04-30
Last edited by William F Pokorny - 2017-02-01

FS#289 - area_illumination with light fading and scattering media

with reference to http://bugs.povray.org/task/46

still some issue with area illumination and light fading when interacting with media

seems light fade is not taken into account with scattering media.
emission and absorption media seem to work fine.
occurs with all scattering types.

#version 3.7;

global_settings {
 ambient_light 0
 assumed_gamma 1
}

camera {
  location <0, 3, -5>
  look_at <0, 2, 0>
}


#declare Light = 3; // light 1 = individual lights
                   // light 2 = standard area light
                   // light 3 = area light with area illumination

#declare Fade = 1; // light fading: 1 on, 0 off

#declare Media = 1; // media 1 = scattering
                    // media 2 = emission
                    // media 3 = absorption

#declare Type = 1; // scattering media type


#switch(Light)
 #case(1)

  #declare Ls = light_source {
    0
    1/7
    #if(Fade) fade_distance 2 fade_power 2 #end
  }

  union {
   object { Ls }
   object { Ls translate .5*x }
   object { Ls translate x }
   object { Ls translate 1.5*x }
   object { Ls translate -.5*x }
   object { Ls translate -x }
   object { Ls translate -1.5*x }
   translate y
  }

 #break
 #case(2)

  light_source{
    y
    1
    area_light 3*x, z, 7, 1
    #if(Fade) fade_distance 2 fade_power 2 #end
  }

 #break
 #case(3)

  light_source{
    y
    1
    area_light 3*x, z, 7, 1
    #if(Fade) fade_distance 2 fade_power 2 #end
    area_illumination on
  }

 #break

#end


cylinder { <0, .01, 0>, <0, 5, 0>, 2 pigment { rgbt 1 } hollow no_shadow
 interior {
  media {
   #if(Media = 1) scattering {Type, 30 } #end
   #if(Media = 2) emission 2 #end
   #if(Media = 3) absorption 2 #end
    density { cylindrical turbulence 1.5 scale <1, .14, 1> }
  }
 }
 scale <.15, 1, .4> translate 4*z
}

plane { y,0 pigment { rgb .7 } }
plane { -z,-7 pigment { gradient y color_map { [.5 rgb 1][.5 rgb 0] } } }
union {
 sphere { 0,.05 }
 sphere { .5*x,.05 }
 sphere { x,.05 }
 sphere { 1.5*x,.05 }
 sphere { -.5*x,.05 }
 sphere { -x,.05 }
 sphere { -1.5*x,.05 }
 translate y
  hollow pigment { rgbt 1 } interior { media { emission 10 } }
}
Simon commented on Wednesday, 01 May 2013, 13:32 GMT

Well emission has nothing to do with lights, and absorption creates shadows and obscures what's behind, but does not shine under light. So scattering is the only one affected by attenuation.

I found where the problem is in the code.

Function
MediaFunction::ComputeOneMediaSample
calculates the light colour by calling
Trace::TestShadow
This function then calls
Trace::ComputeOneLightRay
where you see the comment
'for full area lighting we apply distance- and angle-based attenuation to each "lightlet" individually later'

but TestShadow function never does that (never goes recursively into full area lighting, it treats the area light as a single point source). A simple solution is to just add attenuation in TestShadow after calling the ComputeOneLightRay function. Basically, two lines of code must be copied from ComputeOneLightRay into TestShadow. Or a more long term solution, Ray object should have a flag that signals that it is meant for media calculation. This flag can then be tested in ComputeOneLightRay.

Do we want area_illumination to apply to scattering media? It should not be default, because this would make area_illumination extremely slow. But it could be the user's choice.

This will not affect anything else. Trace::TestShadow is ONLY USED FOR SCATTERING MEDIA - it appears nowhere else in the code.

William F Pokorny commented on Wednesday, 01 February 2017, 14:54 GMT

Now tracked on github as issue #225.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing