POV-Ray : Newsgroups : povray.newusers : Howto create a light fading completely dark at distance? Scene attached : Howto create a light fading completely dark at distance? Scene attached Server Time
2 Nov 2024 05:20:31 EDT (-0400)
  Howto create a light fading completely dark at distance? Scene attached  
From: Icetoaster
Date: 28 Aug 2004 18:15:00
Message: <web.41310272f2fba73e3dff28c80@news.povray.org>
I tried the following:

1) point light source with "fading_distance" and "fade_power",
   but found out, that the light in far distance gets a
   constant level, NOT completely dark! So the pillars are
   visible even in infinity. I even tried a darker light.

2) I added an ambient light with:
      global_settings { ambient_light rgb<0.1, 0.1, 0.1> }
   which (to my astonishment) DARKENS the whole scene.
   However the floor in close distance is too dark now.

3) I added a spotlight pointing to the bottom of the
   camera position.
   However objects in close distance give wrong shadows now.
   And the radius and falloff is difficult to find off, because
   when touching near objects, the light cone should not be visible
   on vertical structures.

Is there a simpler possibility to create a light which is more
realistic and simpler?
Thanks for help!
Icetoaster.

P.S.: Attached is the scene. Set c=1, 2, or 3 if you want to see the
results of steps 1,2, and 3 described above.

#include "colors.inc"
#include "stones.inc"
#include "textures.inc"

background { color Black }
// ----------------------------------------

#declare c=5; // Number of scene to render:
    // 1=Lots of Pillars (fading point light)
    // 2=Lots of Pillars (fading point light + global darkening)
    // 3=Lots of Pillars (fading point light + global darkening + spot
light)
    // 4=DragonEggHolder only
    // 5=DragonEggPillar from floor
    // 6=DragonEggPillar from above


#declare texbot=texture{T_Stone18 scale 4};
#declare texcols=texture {PinkAlabaster scale 0.2};
//#declare texbot=pigment{Gray80}
//#declare texcols=pigment{Gray60}

#if (c=4)
 camera { // EggHolder
  location  <0, 1.0, -3.0>
  look_at   <0.0, 0.0,  0.0>
  right     x*image_width/image_height
 }
#end

#if (c=5)
 camera { // Pillar at Floor
  location  <0.0, 1.0, -7.0>
  look_at   <0.0, 2.0,  0.0>
  right     x*image_width/image_height
 }
#end

#if (c=6)
 camera { // Pillar at Top
  location  <0, 10.0, -5.0>
  look_at   <0.0, 6.0,  0.0>
  right     x*image_width/image_height
 }
#end

#if (c<=3)
 camera { // Lots of Pillars at Floor
  location  <27.0, 1.5, -5.0>
  look_at   <30.0, 2.0,  .0>
  right     x*image_width/image_height
 }

 light_source { // Fading point light -> constant lighting on background
pillars
  <26.5, 0.5, -5.0>
  color White
  fade_distance 5
  fade_power 1
 }

 #if (c>=2)
  global_settings { ambient_light rgb<0.1, 0.1, 0.1> } // darkens the scene
 #end
 // create a point "spotlight" (conical directed) light source

 #if (c=3)
  light_source {
   <26.5, 2.0, -3.0>
   color White
   spotlight                // this kind of light source
   point_at  <26.5, 0.0, -3.0> // direction of spotlight
   radius 50                // hotspot (inner, in degrees)
   tightness 0              // tightness of falloff (1...100) lower is
softer, higher is tighter
   falloff 79               // intensity falloff radius (outer, in degrees)
   //shadowless /* does not work */
  }
 #end

#end

#if (c>=4)
 light_source {
  <0,100,-40>
  color <2,2,2>
 }
#end


/**
 * Dragon egg holders for DragonPillar
 */

#declare DragonEggHolder=
 union {
  difference {      // Steg
   cylinder { <-1.0,-0.2,0.0>, <0.0,-0.2,0.0>, 0.1 }
   sphere { <0,0,0>, 0.43 scale <1.0,1.3,1.0>}
  }

  intersection {    // spherical holder
   difference {
    sphere { <0,0,0>, 0.50 }
    sphere { <0,0,0>, 0.43 }
   }
   box{ <-0.5,-0.5,-0.5>, <0.5,0,0.5> }
   scale <1.0,1.3,1.0>
  }

  translate <1.0,0.5,0.0>
  texture {texcols}
 }

/**
 * Pillar with dragon egg holders (Bigrim Preface)
 */

#declare DragonPillar=
 union {
  #local maxy=60;
  #local yh=1;
  #local ystep=1.0;
  #local w=0;
  object { cylinder { <0,0,0>, <0,maxy,0>, 0.4 } texture{texcols} }
  #while ( yh < maxy )
   object { DragonEggHolder rotate w*y translate yh*y }
   #local yh=yh+ystep;
   #local w=w+75;
   #if ( w >=360 )
    #local w=w-360;
   #end
  #end
 }

/**
 * Wood of DragonPillars (11x11)
 */
#if (c<=3)
#declare DragonPillarWood=
 union {
  #local i=0;
  #local k=0;
  #while (k < 10)
   #while ( i < 10 )
    object { DragonPillar translate <i*15, 0, k*15> }
    #local i=i+1;
   #end
   #local k=k+1;
   #local i=0;
  #end
 }
#end

/**
 * Set all object models here:
 */

#if (c=4)
 plane  { y,0 pigment { checker Green Black } }
 object {DragonEggHolder}
#end
#if (c=5 | c=6)
 plane  { y,0 pigment { checker Green Black } }
 object {DragonPillar}
#end
#if (c<=3)
 plane { y,0 texture{texbot}}
 object {DragonPillarWood}
#end


Post a reply to this message

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