POV-Ray : Newsgroups : povray.binaries.images : Sundial and shadow problem Server Time
28 Mar 2024 16:01:13 EDT (-0400)
  Sundial and shadow problem (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: Sundial and shadow problem
Date: 3 Jan 2021 08:45:08
Message: <web.5ff1ca30346ceddf1f9dae300@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
> Hello,
>
> Little brain teaser : the attached image is part of an animation that
> simulates a simplified sundial. In order not to overload the image, the
> shadow of the sundial has been removed with the "no_shadow" attribute.
> But not for the gnomon to get the "time". As you can see, its shadow is
> also projected on the ground "through" the wall.
>
> So, how to remove this shadow on the floor but keep the shadow on the wall ?

That's indeed a crazy little problem, and a wonderful brain-teaser.
It's before 2nd coffee, so all I can suggest is to have you main light source
(maybe with parallel) and then put a second light source on the back side of the
wall, in line with the light / point-at vector...

Do you need a shadow on the floor?   What if THAT had no_shadow as well?
I'm sure there may be something you can do with light groups to separate the
components of the scene.  Perhaps the gnomon and wall in one group, and the
floor in the other.


Post a reply to this message

From: Alain Martel
Subject: Re: Sundial and shadow problem
Date: 3 Jan 2021 12:10:41
Message: <5ff1fa91$1@news.povray.org>
Le 2021-01-03 à 05:36, kurtz le pirate a écrit :
> Hello,
> 
> Little brain teaser : the attached image is part of an animation that 
> simulates a simplified sundial. In order not to overload the image, the 
> shadow of the sundial has been removed with the "no_shadow" attribute. 
> But not for the gnomon to get the "time". As you can see, its shadow is 
> also projected on the ground "through" the wall.
> 
> So, how to remove this shadow on the floor but keep the shadow on the 
> wall ?
> 

First a little question : Does the illumination of the floor need to 
vary according to the Sun's position ?

If no, then, you can do the following :
Remove that no_shadow as you'll no longer need it.
Change the finish of the floor for this :
finish{ diffuse 0 emission 0.6 }

That way, the floor no longer receive any illumination from the light, 
and the emission make it clearly visible.

If the illumination of the floor must reflect the Sun's location, use a 
light_group :

Place the floor in a light_group.
In that, have a light that mirrors the main light.
Have the diffuse set as, keeping the rest of the finish unchanged :
finish { diffuse 0, 0.6 }
Add an inside_texture with : pigment {rgbt 1}

The front diffuse don't diffuse any light. The backside part reproduce 
the normal diffuse.
The inside_texture ensure that the light coming from bellow won't get 
blocked by the bottom part of the floor.


Post a reply to this message

From: Kenneth
Subject: Re: Sundial and shadow problem
Date: 4 Jan 2021 11:00:01
Message: <web.5ff33ae5346ceddfd98418910@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
> Hello,
>
> Little brain teaser...
>
> So, how to remove this shadow on the floor but keep the shadow on the wall ?
>
> --

That is indeed an interesting situation.

After reading the various suggestions here, I experimented with different
set-ups, and finally found one that works. It uses two light sources: a
shadowless one in a light_group with the large horizonal disc, and another light
for everything else. The no_shadow flag is not needed in any of the objects.

---

plane{...}

// light_source A
light_source {...}

light_group{
// light_source B
light_source {  // same position as light_source A
....
  shadowless
}

// large horizontal disc
cylinder{...}
} // end of light_group

// sundial CSG
union{
box{...}

// gnomon
cylinder{...}
}


Post a reply to this message


Attachments:
Download 'shadow_question.png' (61 KB)

Preview of image 'shadow_question.png'
shadow_question.png


 

From: kurtz le pirate
Subject: Re: Sundial and shadow problem
Date: 6 Jan 2021 11:56:11
Message: <5ff5ebab$1@news.povray.org>
On 04/01/2021 16:57, Kenneth wrote:
> After reading the various suggestions here, I experimented with different
> set-ups, and finally found one that works. It uses two light sources: a
> shadowless one in a light_group with the large horizonal disc, and another light
> for everything else. The no_shadow flag is not needed in any of the objects.

Interesting approach. I'm trying this out.
Thanks Kenneth


-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Subclick
Subject: Re: Sundial and shadow problem
Date: 6 Jan 2021 22:01:49
Message: <87czyhtppn.fsf@sp.am>
"Kenneth" <kdw### [at] gmailcom> writes:
> After reading the various suggestions here, I
> experimented with different
> set-ups, and finally found one that works. It uses
> two light sources: a
> shadowless one in a light_group with the large
> horizonal disc, and another light
> for everything else. The no_shadow flag is not
> needed in any of the objects.

I’ve tried that out, too.  With a shadowless light source, you don’t get
highlights.  You can remedy this by setting “no_shadow” for both the
wall and the gnomon, and putting the former in a light group with a
negative-intensity light source projected through the gnomon.


Post a reply to this message


Attachments:
Download 'sundial.mpg' (658 KB) Download 'us-ascii' (1 KB)

From: kurtz le pirate
Subject: Re: Sundial and shadow problem
Date: 7 Jan 2021 13:17:12
Message: <5ff75028$1@news.povray.org>
You can see the result with Kenneth's method here:
<http://louisbel.free.fr/wip/sundial.html>


Very close to Subclick
LOL



-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Kenneth
Subject: Re: Sundial and shadow problem
Date: 8 Jan 2021 11:55:00
Message: <web.5ff88e1a346ceddfd98418910@news.povray.org>
Subclick <no### [at] spam> wrote:
> "Kenneth" <kdw### [at] gmailcom> writes:
> > After reading the various suggestions here, I
> > experimented with different
> > set-ups, and finally found one that works...
>
> I've tried that out, too.  With a shadowless light source, you don't
> get highlights.  You can remedy this by setting no_shadow for both
> the wall and the gnomon, and putting the former in a light group
> with a negative-intensity light source projected through the gnomon.

That is a really clever solution, and a good improvement. I didn't notice the
lack of highlights in my own test.

At first, I thought that the negative light_source would 'invert' the color of
the wall object; but that's not the case.

Here's my own demo code. (Note that the light_group requires global_lights ON).
-------

#default{finish{ambient .04 diffuse .8}}

camera {
  perspective
  location  <-4, 2.5, -3>
  look_at   <0, 0,  0>
  right     x*image_width/image_height
  angle 40
}

// light_source A-- main
light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <20, 20, -20>
}

plane{y,0 pigment{rgb .2}}


// large horizontal disc
superellipsoid{ <1,.2> rotate 90*x scale 1.5*<1,.1,1>
texture{
pigment{ rgb .5*<.6,1,.6>
       }
       finish{phong .8}
       normal{bumps .7 scale .1 bump_size 1}
       }

       }

// --- sundial ---
#declare GNOMON =
cylinder{0,-.55*z,.02
pigment{rgb <.8,.2,.2>}
rotate -40*x
translate .9*y
no_shadow
}

object{GNOMON}

light_group{
// light_source B-- same position as light_source A
light_source {
  0*x
  color rgb -1 // NEGATIVE light
  translate <20, 20, -20>
  projected_through{GNOMON}
}

// vertical wall
superellipsoid{<.1,.3> scale <.7,1,.08>
texture{
pigment{rgb <.95,.85,.55>}
finish{phong 1}
}
no_shadow
}
global_lights on
} // end of light_group


Post a reply to this message


Attachments:
Download 'sundial_shadow_solution_2.png' (119 KB)

Preview of image 'sundial_shadow_solution_2.png'
sundial_shadow_solution_2.png


 

From: kurtz le pirate
Subject: Re: Sundial and shadow problem
Date: 8 Jan 2021 13:26:07
Message: <5ff8a3bf$1@news.povray.org>
On 08/01/2021 17:53, Kenneth wrote:
> At first, I thought that the negative light_source would 'invert' the color of
> the wall object; but that's not the case.

hum, hum... negative light...
why not, just had to think of it.



-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Subclick
Subject: Re: Sundial and shadow problem
Date: 8 Jan 2021 23:06:23
Message: <87turqoitc.fsf@sp.am>
"Kenneth" <kdw### [at] gmailcom> writes:
> At first, I thought that the negative light_source would 'invert' the color of
> the wall object; but that's not the case.

If it were the only light shining on the wall, those pixels would get
overall negative color components (each—negative—component of the light
multiplied by the corresponding—positive—component of the wall’s pigment
and by its—positive—diffuse value, plus the highlights, which are
similarly negative, plus the ambient illumination, which is positive,
but too small to overcome the two previous summands), which would in
turn be clipped to zero—pure black—in the final image; but since there
is also a global light with the opposite—positive—intensity, it just
cancels it out.

Another option would be to leave out “no_shadow” for the gnomon, and
instead to fill in its shadow on the ground with another positive light
projected through the gnomon, in a light group with the ground.
However, I think it’d be easy to notice rounding errors around the edge
of the shadow, where it’s not exactly cancelled out, especially in an
animation.  With the negative light projected through the gnomon onto
the wall, there’s no such problem, since the eye has no way to tell our
makeshift shadow is not exactly the same as the one it’d see if we let
the gnomon cast one normally.  Only if there were no ambient light might
it notice the shadow is not perfectly black.

> (Note that the light_group requires global_lights ON).

Certainly.


Post a reply to this message

From: Alain Martel
Subject: Re: Sundial and shadow problem
Date: 9 Jan 2021 11:31:09
Message: <5ff9da4d$1@news.povray.org>
Le 2021-01-08 à 23:06, Subclick a écrit :
> "Kenneth" <kdw### [at] gmailcom> writes:
>> At first, I thought that the negative light_source would 'invert' the color of
>> the wall object; but that's not the case.
> 
> If it were the only light shining on the wall, those pixels would get
> overall negative color components (each—negative—component of the light
> multiplied by the corresponding—positive—component of the wall’s pigment
> and by its—positive—diffuse value, plus the highlights, which are
> similarly negative, plus the ambient illumination, which is positive,
> but too small to overcome the two previous summands), which would in
> turn be clipped to zero—pure black—in the final image; but since there
> is also a global light with the opposite—positive—intensity, it just
> cancels it out.
> 
> Another option would be to leave out “no_shadow” for the gnomon, and
> instead to fill in its shadow on the ground with another positive light
> projected through the gnomon, in a light group with the ground.
> However, I think it’d be easy to notice rounding errors around the edge
> of the shadow, where it’s not exactly cancelled out, especially in an
> animation.  With the negative light projected through the gnomon onto
> the wall, there’s no such problem, since the eye has no way to tell our
> makeshift shadow is not exactly the same as the one it’d see if we let
> the gnomon cast one normally.  Only if there were no ambient light might
> it notice the shadow is not perfectly black.
> 
>> (Note that the light_group requires global_lights ON).
> 
> Certainly.
> 

The faked shadow using projected_through can match exactly. The only 
thing needed is that the location of the light with projected_through 
exactly match the general light : Same location, and eventually, 
area_light parameters.


light_source{1000 rgb <0,1,1> area_light z x 17 17 adaptive 0 circular 
orient} // A cyan light

light_group{
  light_source{1000 rgb <1,-1,-1> // make the shadow red
   area_light z x 17 17 adaptive 0 circular orient
   projected_through object{Gnomon}}
  object{Gnomon texture{Gnomon_Texture}}
  global_lights on
}


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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