POV-Ray : Newsgroups : povray.advanced-users : Sharp shadows on meshes Server Time
30 Jul 2024 16:13:13 EDT (-0400)
  Sharp shadows on meshes (Message 1 to 7 of 7)  
From: Nieminen Mika
Subject: Sharp shadows on meshes
Date: 7 Jun 1999 03:18:37
Message: <375b724d@netplex.aussie.org>
Check the scene at the end of the article. It's a "cylinder" made of
smooth triangles.
  Why there's a sharp shadow instead of a smooth one? If you set AngStep
to 45 then there's a smooth shadow just like it should.

camera { location -z*50 look_at 0 angle 35 }
light_source { <100,100,-100> 1 }

mesh
{ #declare AngStep=90;
  #declare YStep=20;
  #declare Rad=5;
  #declare PosY=-10;
  #while(PosY<10)
    #declare Ang=0;
    #while(Ang<360)
      smooth_triangle
      { <sin(radians(Ang))*Rad, PosY, cos(radians(Ang))*Rad>,
	  <sin(radians(Ang)), 0, cos(radians(Ang))>,
	<sin(radians(Ang))*Rad, PosY+YStep, cos(radians(Ang))*Rad>,
	  <sin(radians(Ang)), 0, cos(radians(Ang))>,
        <sin(radians(Ang+AngStep))*Rad, PosY+YStep, cos(radians(Ang+AngStep))*Rad>,
	  <sin(radians(Ang+AngStep)), 0, cos(radians(Ang+AngStep))>
      }
      smooth_triangle
      { <sin(radians(Ang))*Rad, PosY, cos(radians(Ang))*Rad>,
	  <sin(radians(Ang)), 0, cos(radians(Ang))>,
        <sin(radians(Ang+AngStep))*Rad, PosY+YStep, cos(radians(Ang+AngStep))*Rad>,
	  <sin(radians(Ang+AngStep)), 0, cos(radians(Ang+AngStep))>,
	<sin(radians(Ang+AngStep))*Rad, PosY, cos(radians(Ang+AngStep))*Rad>,
	  <sin(radians(Ang+AngStep)), 0, cos(radians(Ang+AngStep))>
      }
      #declare Ang=Ang+AngStep;
    #end
    #declare PosY=PosY+YStep;
  #end
  pigment { rgb x } finish { specular .5 }
}


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

From: Lance Birch
Subject: Re: Sharp shadows on meshes
Date: 7 Jun 1999 04:19:06
Message: <375b807a@netplex.aussie.org>
Smooth Triangles only cast normal triangle shadows to my knowledge (I could
be wrong though).

After all, isn't the smoothing just normal perturbation?  In which case it
shouldn't affect the shadow.

--
Lance.


---
For the latest 3D Studio MAX plug-ins, images and much more, go to:
The Zone - http://come.to/the.zone
For a totally different experience, visit my Chroma Key Website:
Colorblind - http://listen.to/colorblind


Post a reply to this message

From: Nieminen Mika
Subject: Re: Sharp shadows on meshes
Date: 7 Jun 1999 10:24:20
Message: <375bd614@netplex.aussie.org>
Lance Birch <lan### [at] usanet> wrote:
: Smooth Triangles only cast normal triangle shadows to my knowledge (I could
: be wrong though).

  With "shadow" I'm not meaning casted shadow, but the part of the object
which is not illuminated by the light.

: After all, isn't the smoothing just normal perturbation?  In which case it
: shouldn't affect the shadow.

  Of course it affects.
  If the normal of one corner is pointing towards the light and the normal
of another corner is pointing to the other direction, the shadow line
is somewhere between these corners. This shadow line is not sharp, but
smooth (just like in regular cylinders).

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

From: Ron Parker
Subject: Re: Sharp shadows on meshes
Date: 7 Jun 1999 13:55:45
Message: <375c07a1@netplex.aussie.org>
On 7 Jun 1999 10:24:20 -0400, Nieminen Mika wrote:
>  If the normal of one corner is pointing towards the light and the normal
>of another corner is pointing to the other direction, the shadow line
>is somewhere between these corners. This shadow line is not sharp, but
>smooth (just like in regular cylinders).

I think the triangle smoothing is only good up to a certain point.  If
the normal vectors of the corners diverge by too much, it might not work
as you'd expect.


Post a reply to this message

From: Lance Birch
Subject: Re: Sharp shadows on meshes
Date: 7 Jun 1999 17:39:34
Message: <375c3c16@netplex.aussie.org>
Sorry, I thought you meant object casted shadows not self shadowing.  In
which case I'd have to agree with what Mr Parker said... only really good to
a certain point (after all it's trying to fake the shadow effect because the
object doesn't exist the way it is rendered).

I suggest moving to more segments and therefore less difference in curvature
of the segments to fix the problem.

--
Lance.


---
For the latest 3D Studio MAX plug-ins, images and much more, go to:
The Zone - http://come.to/the.zone
For a totally different experience, visit my Chroma Key Website:
Colorblind - http://listen.to/colorblind

Nieminen Mika wrote in message <375bd614@netplex.aussie.org>...
>Lance Birch <lan### [at] usanet> wrote:
>: Smooth Triangles only cast normal triangle shadows to my knowledge (I
could
>: be wrong though).
>
>  With "shadow" I'm not meaning casted shadow, but the part of the object
>which is not illuminated by the light.
>
>: After all, isn't the smoothing just normal perturbation?  In which case
it
>: shouldn't affect the shadow.
>
>  Of course it affects.
>  If the normal of one corner is pointing towards the light and the normal
>of another corner is pointing to the other direction, the shadow line
>is somewhere between these corners. This shadow line is not sharp, but
>smooth (just like in regular cylinders).
>
>--
>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

From: Nieminen Mika
Subject: Re: Sharp shadows on meshes
Date: 8 Jun 1999 02:34:05
Message: <375cb95d@netplex.aussie.org>
No the problem is not too diverging normal vectors. I think that I got
what's the problem.
  I'll try to "draw" the situation in ascii:

   /    \             Z
 2/      \3           |
  \      /       -X --|-- X
   \a  b/             |
    \  /             -Z
     \/
     1
             * <-light

  We have two faces here, a and b. The normal vector at point 1 is pointing
at the -Z direction and the normal vector at point 2 is pointing at the
-X direction. The normal vector at point 3 is pointing at the X direction.
When rendering face b, the normal vector changes from X to -Z and
everithing is ok (every point is illuminated; the normal vector points
at the light in each point).
  Now, when rendering face a, the point 1 is illuminated (because the
normal vector is pointing at the light) but the point 2 is not (the
normal vector is pointing to the other direction). This would mean that
the line of the shadow is somewhere between point 1 and point 2.
  But there's one problem: The face b is blocking the light. The face b
actually casts a shadow over face a. The result is that face a is completely
shadowed.
  If my theory is correct, applying a "no_shadow" to the object (or more
precisely to face b) will eliminate the problem.

  This problem is sometimes very annoying. It causes sharp shadows in
smooth meshes. The only solution I can think of is making the mesh
shadowless (but then it will not cast shadows to the rest of the scene)...

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

From: Nieminen Mika
Subject: Re: Sharp shadows on meshes
Date: 8 Jun 1999 02:36:26
Message: <375cb9ea@netplex.aussie.org>
I just tested my theory. I was right. Applying "no_shadow" to the mesh
eliminated the sharp shadow.

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