POV-Ray : Newsgroups : povray.newusers : Howto create a light fading completely dark at distance? Scene attached Server Time
2 Nov 2024 07:23:06 EDT (-0400)
  Howto create a light fading completely dark at distance? Scene attached (Message 1 to 5 of 5)  
From: Icetoaster
Subject: Howto create a light fading completely dark at distance? Scene attached
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

From: Hughes, B 
Subject: Re: Howto create a light fading completely dark at distance? Scene attached
Date: 28 Aug 2004 22:51:47
Message: <413144c3$1@news.povray.org>
A fog with color rgb 0, or media, and attenuation might be what you need to 
use. Without either of those there wouldn't be any kind of atmosphere to 
obscure things at distance.


Post a reply to this message

From: Slime
Subject: Re: Howto create a light fading completely dark at distance? Scene attached
Date: 29 Aug 2004 00:08:37
Message: <413156c5@news.povray.org>
> 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.

It seems that you're not aware that there is a default ambient light
setting. The default for the global_settings ambient_light setting is rgb
<1,1,1>. This is multiplied by each object's ambient light setting, which is
set in the object's texture's finish and has a default of rgb <0.1, 0.1,
0.1>. That means that by default, even without any light sources, all
objects will show at 1/10 their intensity.

In order to remove this ambient light and start from pure blackness, you can
set the default ambient light value for all objects like this:

#default {finish {ambient 0}}

Since you seem to want your light sources to be completely in charge of the
lighting, you may also want to set diffuse to 1 (the default is 0.6) so that
the incoming light color is multiplied by the full color of the object's
pigment (as opposed to just 60% of it):

#default {finish {ambient 0 diffuse 1}}

Though doing so is not necessary to create blackness.

> 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.

I'm not quite clear what you're saying here.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Warp
Subject: Re: Howto create a light fading completely dark at distance? Scene attached
Date: 30 Aug 2004 05:21:16
Message: <4132f18c@news.povray.org>
Hughes, B. <bob### [at] charternet> wrote:
> A fog with color rgb 0, or media, and attenuation might be what you need to 
> use. Without either of those there wouldn't be any kind of atmosphere to 
> obscure things at distance.

  No, that's not the correct solution to the problem. He wants the light
emitted by light sources to fade to completely black, not the rays emitted
by the camera, which is a completely different thing.

  The correct explanation and solution were already given: The default
global ambient light level is (iirc) 0.3, and setting it to 0 does what
he wants.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Hughes, B 
Subject: Re: Howto create a light fading completely dark at distance? Scene attached
Date: 30 Aug 2004 14:21:17
Message: <4133701d$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message 
news:4132f18c@news.povray.org...
> Hughes, B. <bob### [at] charternet> wrote:
>> A fog with color rgb 0, or media, and attenuation might be what you need 
>> to
>> use. Without either of those there wouldn't be any kind of atmosphere to
>> obscure things at distance.
>
>  No, that's not the correct solution to the problem. He wants the light
> emitted by light sources to fade to completely black, not the rays emitted
> by the camera, which is a completely different thing.
>
>  The correct explanation and solution were already given: The default
> global ambient light level is (iirc) 0.3, and setting it to 0 does what
> he wants.

Okay, but it did seem like they wanted a falloff that reached zero within a 
finite distance for light-facing surfaces. I didn't think any value of 
fade_power. Unless maybe using zero fade_distance, negatives, or something?

Default finish ambient is 0.1, last I checked, just so that doesn't get 
confused. I know it can seem like it's higher, making everything unblack 
even if in complete shadow. And ambient_light defaults to 1, the multiplier 
for all ambient finishes.

Please correct me if I'm wrong, of course. ;-)

Bob H.


Post a reply to this message

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