Re: "Color vectors" & shading [message #37755 is a reply to message #37754] |
Tue, 20 January 2004 16:54  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"Neil" <nasalmon@onetel.net.uk> wrote in message
news:74039481.0401201339.d26efa4@posting.google.com...
> Does anyone know how i correctly implement "color vectors" in
> "setProperty" to give each polygon of an object its own predetermined
> intensity level or colour? It should be that setting "shading" = 0 in
> "setProperty" should make it so that the colour of each polygon is
> defined by the "colour vertex" of the first vertex of the polygon
> connectivity. However, generally the number of "first vertices" of a
> polygon of an object is actually less than the number of polygons.
> That means you cant use this method to give each polygon of an object
> a predetermined different colour - or have i missed something? It
> seems to me that what is really needed is a colour vector for the
> polygons not the vertices.
There's no way to do this today if you have vertices that are shared between
polygons. There isn't a polygon color vector.
What you could do is make a vertex list and a connectivity list that creates
a set of independent polygons and then set the color of all the vertices
belonging to each polygon to the same color. Actually, you would only need
to set the first vertex of a polygon to an actual color; the rest are
ignored if you are doing flat shading.
Obviously, if you have many polygons that used to share vertices, this will
require more space.
For example, if you have 4 vertices, A, B, C, D, that form 2 triangles with
a shared edge, the triangles might be ABC, and DCB. If the vertices are in
the vertex list as ABCD, the conn list would be 3 0 1 2 3 3 2 1. To make
them independent triangles, your vertex list would be ABCDCB and the conn
list 3 0 1 2 3 3 4 5. You would set the color of vert A (at 0) to the
desired color and the color of vert D (at 3) to the desired color. The rest
of the vertex colors list can be left uninitialized.
It isn't very efficient, but would work well if you don't have that many
polygons.
Karl
|
|
|