POV-Ray : Newsgroups : povray.general : normal indices in mesh2 Server Time
29 Nov 2024 15:56:20 EST (-0500)
  normal indices in mesh2 (Message 1 to 5 of 5)  
From: sokermaniac11
Subject: normal indices in mesh2
Date: 3 Aug 2005 14:25:00
Message: <web.42f10b6bc12bd03c1068d2140@news.povray.org>
can anyone explain to me how the normal indices work in mesh2? i have 2
normals for each of my vertex vectors, and i cant find a good documentation
of how the normal_indices are supposed to be set up. I know that if i have
the same number of normals and vertexs, then the indices are the same. but
if i have more normals, how do i tell povray which normals go with which
vertex? or does the normal_indice only work if you have less normals than
vertexs?


Post a reply to this message

From: Slime
Subject: Re: normal indices in mesh2
Date: 3 Aug 2005 14:48:54
Message: <42f11196$1@news.povray.org>
>  but
> if i have more normals, how do i tell povray which normals go with which
> vertex? or does the normal_indice only work if you have less normals than
> vertexs?


The reason for having more normals than vertices is so that adjacent faces
can use different normals on the same vertices, creating sharp transitions
between them (like at sharp edges of an object).

If you're generating the mesh yourself, and you have more normals than
vertices and you don't know how to use them, then it sounds like you don't
understand what you made the extra normals for (which would be weird since
you wrote the code yourself).

If your mesh is coming from an external program, I would have expected the
normal indices to be set up automatically.

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


Post a reply to this message

From: sokermaniac11
Subject: Re: normal indices in mesh2
Date: 3 Aug 2005 15:35:00
Message: <web.42f11b35a43a55f01068d2140@news.povray.org>
quote:
The reason for having more normals than vertices is so that adjacent faces
> can use different normals on the same vertices, creating sharp transitions
> between them (like at sharp edges of an object).

yes, i knew this. sorry, i think my question was phrased poorly. i know that
i have twice as many normals because im generating a square
ribbon(molecular modeling) and thus have sharp corners on the ribbon. my
question was actually regarding the format of povray's normal indices. i
have been trying to figure out how to write the code itself. i have the
normals and vertexs calculated correctly, but i need to figure out how to
lay out the index correctly. I know that if you dont specify a normal
index, it just takes the index from your faces. but when i specify a
seperate normal index, what is the format? for example, if i have 2 vertex
points and 4 normals, how do i tell povray that the first two normals go
with the first vertex, and the second two with the second vertex? what
would that index look like? (obviously this isnt the best example since its
not a triangle, but it illustrates my question). Thanks!

Ben


Post a reply to this message

From: Mike Williams
Subject: Re: normal indices in mesh2
Date: 3 Aug 2005 16:02:48
Message: <gGyL+BAFhR8CFwnS@econym.demon.co.uk>
Wasn't it sokermaniac11 who wrote:
>can anyone explain to me how the normal indices work in mesh2? i have 2
>normals for each of my vertex vectors, and i cant find a good documentation
>of how the normal_indices are supposed to be set up. I know that if i have
>the same number of normals and vertexs, then the indices are the same. but
>if i have more normals, how do i tell povray which normals go with which
>vertex? or does the normal_indice only work if you have less normals than
>vertexs?

Place two vertices at the same point in space, and apply the different
normals to them. A polygon that needs the first normal uses the first
copy of that vertex and a polygon that needs the second normal uses the
second copy of that vertex.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: normal indices in mesh2
Date: 4 Aug 2005 01:04:54
Message: <42f1a1f6@news.povray.org>
sokermaniac11 <sok### [at] hotmailcom> wrote:
> can anyone explain to me how the normal indices work in mesh2? i have 2
> normals for each of my vertex vectors, and i cant find a good documentation
> of how the normal_indices are supposed to be set up.

  Perhaps a well-commented example could help:


camera { location <0, 1.5, -3> look_at 0 angle 35 }
light_source { <5, 10, -1>, 1 }

mesh2
{ vertex_vectors
  { 4,
    <-1, -.5, 0>, // 0: leftmost vertex
    <0, 0, -1>,   // 1: mid vertex, closer to camera
    <0, 0, 1>,    // 2: mid vertex, farther from camera
    <1, -.5, 0>   // 3: rightmost vertex
  }
  normal_vectors
  { 6,             // Normal vectors for:
    <-1, .5, 0>,   // 0: leftmost vertex
    <-.5, 1, -.5>, // 1: mid vertex (closer to camera) for left triangle
    <-.5, 1, .5>,  // 2: mid vertex (farther from camera) for left triangle
    <.5, 1, -.5>,  // 3: mid vertex (closer to camera) for right triangle
    <.5, 1, .5>,   // 4: mid vertex (farther from camera) for right triangle
    <1, .5, 0>     // 5: rightmost vertex
  }
  face_indices
  { 2,
    <0, 1, 2>, // left triangle
    <1, 2, 3>, // right triangle
  }
  normal_indices
  { 2,
    <0, 1, 2>, // normals for left triangle
    <3, 4, 5>  // normals for right triangle
  }

  pigment { rgb 1 } finish { specular .5 }
}


-- 

                                                          - Warp


Post a reply to this message

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