POV-Ray : Newsgroups : povray.unofficial.patches : photons.inc Server Time
2 Sep 2024 18:16:29 EDT (-0400)
  photons.inc (Message 1 to 1 of 1)  
From: Nieminen Mika
Subject: photons.inc
Date: 7 Jul 1999 01:29:45
Message: <3782e5c9@news.povray.org>
Since every time I use photons, I also use very similar settings, I put
those settings into a small include file. The include file can be used
this way:

#include "photons.inc"

light_source { <0,1,2>, 1 Photons(no,no,no) }

object { Jar Photons(yes,yes,yes) }
object { Mirror Photons(yes,no,no) }

  The first parameter to the Photons() macro tells whether to use reflection
or not. The second parameter is for refraction. The third parameter is for
ignore_photons.
  In the example, the light source doesn't emit photons (it has
reflection and refraction turned off; a regular light source would not use
the Photons() macro). The Jar object uses reflection and refraction and
ignores photons and the Mirror object uses reflection but not refraction
and doesn't ignore photons.

  Before including photons.inc you can optionally specify any of these
identifiers:

  phd : Sets the quality of the photons calculations, as described in the
documentation. Default value is 1.
  UsePhotons : If set to 'no', no photons will be used. This way you can
render the scene without the photon patch (and without photons, of course).
Default value is yes.
  PhotonsMaxTraceLevel : To set the max_trace_level for the photons (if
different to the global max_trace_level). Default is none.
  PhotonsADCBailout : To set adc_bailout for photons. Default is none.

  Any suggestions to improve the include file are very welcome.

  And the file itself:

----------------------------------------------------------------------------

#ifndef(UsePhotons) #declare UsePhotons=yes; #end
#ifndef(phd) #declare phd=1; #end

global_settings
{ 
  #if(UsePhotons)
    photons
    { gather 20,100
      radius 0.1*phd, 2, 0.1*phd
      autostop 0
      jitter .4
      expand_thresholds 0.2, 40
      #ifdef(PhotonsMaxTraceLevel) max_trace_level PhotonsMaxTraceLevel #end
      #ifdef(PhotonsADCBailout) adc_bailout PhotonsADCBailout #end
    }
  #end  
}

#macro Photons(Refl,Refr,Ignore)
  #if(UsePhotons)
    photons
    { separation .01*phd
      reflection Refl
      refraction Refr
      #if(Ignore) ignore_photons #end
    }
  #end
#end

----------------------------------------------------------------------------

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.