POV-Ray : Newsgroups : povray.general : Problems with mesh2 and uniform normals Server Time
3 Aug 2024 18:20:26 EDT (-0400)
  Problems with mesh2 and uniform normals (Message 1 to 6 of 6)  
From: FlyerX
Subject: Problems with mesh2 and uniform normals
Date: 17 Oct 2003 00:05:01
Message: <web.3f8f6510af4cd4389d6b971d0@news.povray.org>
I have a mesh2 object where I defined all the vertex normals to be the same
regardless of the original face orientation. I expect this mesh to be
rendered with a constant color sice all its normals are in the same
direction. But when the mesh is rendered in POV-Ray the face orientation
still affects the appearence of the surface. Maybe it has to do with the
way POV-Ray does the rendering. Is there a way to force POV-Ray to not take
into account the real face orientation and use the normals only?

In fact if I remove the normal_vectors and normal_indices sections from the
mesh2 statement I get no change in the rendered image. Is like POV-Ray does
not take into account the normals at all if they are defined this way.

I am using POV-Ray 3.5 on Windows 98

thanks for any information on this,

FlyerX

Below is a small sample POV code with 4 faces as seen from the top to
illustrate the issue.

camera {perspective
        up <0,1,0>
        right <-1.310938,0,0>
        location <-1.800633,-0.1000352,19.58355>
        look_at <-1.800633,-0.1000352,18.58355>
        angle 54.4521 // horizontal FOV angle
        translate <1.4725,0,-2.579> }

//single light
light_source {<-1.800633,-0.1000352,19.58355>
              color rgb <1,1,1> parallel
              point_at <-1.800633,-0.1000352,0>}

mesh2{
vertex_vectors{6,
<2.5,4.33,0>,<-5,0,0>,<2.5,-4.33,0>,
<-3.972,6.88,-5.158>,<-3.972,-6.88,-5.158>,<7.945,0,-5.158>
}
normal_vectors{ 6, //all the same vectors
<0,0,1>,<0,0,1>,<0,0,1>,<0,0,1>,<0,0,1>,<0,0,1>
}
texture_list{1, texture{pigment {color rgb <1,1,1>} }}
face_indices{4,
<1,4,2>,0, <2,5,0>,0, <0,1,2>,0, <0,3,1>,0
}
normal_indices{4,
<1,4,2>,<2,5,0>,<0,1,2>,<0,3,1>
}
}


Post a reply to this message

From: Shay
Subject: Re: Problems with mesh2 and uniform normals
Date: 17 Oct 2003 13:29:16
Message: <3f9026ec@news.povray.org>
"FlyerX" <fly### [at] yahoocom> wrote in message
news:web.3f8f6510af4cd4389d6b971d0@news.povray.org...

POV-Ray is going to treat your triangles like flat triangles when all or
the vertex normals are equal. Inconvenient in this case. You could
either use an ambient finish and no light_source, or change your normals
to something like <0,.0001,1>, <0,.0002,1>, etc..

 -Shay


Post a reply to this message

From: FlyerX
Subject: Re: Problems with mesh2 and uniform normals
Date: 17 Oct 2003 14:10:01
Message: <web.3f902f48984cd6c4462c6a70@news.povray.org>
That is what I suspected. By disturbing the normals slightly it worked.
I wonder why does POV-Ray behave like that.

Thanks for the information,

FlyerX

Shay wrote:
>"FlyerX" <fly### [at] yahoocom> wrote in message
>news:web.3f8f6510af4cd4389d6b971d0[at]news.povray.org...
>
>POV-Ray is going to treat your triangles like flat triangles when all or
>the vertex normals are equal. Inconvenient in this case. You could
>either use an ambient finish and no light_source, or change your normals
>to something like <0,.0001,1>, <0,.0002,1>, etc..
>
> -Shay
>


Post a reply to this message

From: John VanSickle
Subject: Re: Problems with mesh2 and uniform normals
Date: 17 Oct 2003 14:15:49
Message: <3F9031D2.4516191C@hotmail.com>
FlyerX wrote:
> 
> That is what I suspected. By disturbing the normals slightly it
> worked. I wonder why does POV-Ray behave like that.

Whoever wrote the parser decided that this was a valid optimization.

Regards,
John


Post a reply to this message

From: Christopher James Huff
Subject: Re: Problems with mesh2 and uniform normals
Date: 17 Oct 2003 17:47:11
Message: <cjameshuff-C13280.17445717102003@netplex.aussie.org>
In article <web.3f902f48984cd6c4462c6a70@news.povray.org>,
 "FlyerX" <fly### [at] yahoocom> wrote:

> That is what I suspected. By disturbing the normals slightly it worked.
> I wonder why does POV-Ray behave like that.

If the normals are all the same, no interpolation needs to be done. 
Simply using a normal value is faster than interpolating between three, 
so interpolation is turned off. Whoever wrote the code just never 
anticipated that anyone would want a non-interpolated normal that is not 
in the direction of the actual triangle normal. It does seem a very 
strange thing to do.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: John VanSickle
Subject: Re: Problems with mesh2 and uniform normals
Date: 19 Oct 2003 14:27:03
Message: <3F92D770.C9F3C5F@hotmail.com>
Christopher James Huff wrote:
> 
> It does seem a very strange thing to do.

I found an application where this is reasonable.  When modeling
polygon meshes, one might want several triangles to appear as if they
were one face, even when they aren't co-planar.  Giving them a
different normal that is uniform across the face is the best way to
do this, but the optimization nukes that.  I learned this the hard
way while working on the new surface subidivsion macros.

Regards,
John


Post a reply to this message

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