POV-Ray : Newsgroups : povray.general : What's going on with this mesh2? : Re: What's going on with this mesh2? Server Time
2 Aug 2024 06:19:59 EDT (-0400)
  Re: What's going on with this mesh2?  
From: Mike Williams
Date: 25 Dec 2004 00:51:31
Message: <SxXcQEAT$PzBFw35@econym.demon.co.uk>
Wasn't it Slime who wrote:
>> The second triangle (the one using the x+y+z corner) is at a different
>angle
>> towards the lightsource and thus gets lit differently.
>
>Well yeah. But since I'm assigning normals to its vertices, I'm expecting
>those to be used instead of the true normal of the surface.
>
>And since I'm assigning them all the normal y (<0,1,0>), I'm expecting the
>surface to be shaded as though it were along the X-Z plane, regardless of
>where it actually is.

There's something quite odd going on.

Shifting one of the normals by one part in a hundred thousand causes it
to behave as you would expect, with both triangles being equally bright.
This suggests to me that you're not doing anything wrong, and that it is
POV that is behaving oddly.

camera {
 location <3,3,-5>
 look_at 0.5
 angle 20
}

light_source {
 <-5,5,-5>*9999
 rgb .7
}

mesh2 {
 vertex_vectors {
  4,
  <0,0,0>,x,z,x+z+y
 }
 normal_vectors {
  2,
  y,
  y+0.00001             // Modified normal
 }
 face_indices {
  2,
  <0,1,2>,<1,3,2>
 }
 normal_indices {
  2,
  <0,0,0>,<0,1,0>       // One point uses the modified normal
 }
 pigment {rgb 1}
}

I've not looked at the source, but I vaguely seem to remember something
about POV using different (faster) code for triangles that it considers
to be flat. I guess what might be happening is that POV spots that all
three normals are the same and therefore treats both triangles as being
flat. This works correctly for the first face because the normals are
perpendicular to the face, but it doesn't work for the second face
because they're not. Tweaking one or two of the normals slightly forces
POV to skip the optimisation and use the actual smooth triangle
processing.

I don't know if I'd call this a bug, because a face with three equal
normals that are not perpendicular to the face is physically
unrealistic.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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