View Full Version : shading

zip7000

05-01-2002, 06:39 AM

hello,

I have a set of coordinate in a linear array which give a cylinder shape.(array of 341 points).

I would like to apply shading on it. But I think I have to build my object with polygon to have normals. Is it Right? How to do that? could you give me the principles in order to do that? Is it "the tesslation"?

thank you!!!

SirKnight

05-01-2002, 01:12 PM

Yes, to do shading you need normals. A normal to a polygon is the vector perpendicular (or orthogonal if you will) to the plane the polygon is lying on. Lets say for an example you have a triangle. Well you have those three points which make up the triangle. Lets call them P1, P2 and P3. Now, the normal vector would be computed like this: (P2-P1)x(P3-P1) where x means cross product. There you have it, a vector which is perpendicular to the polygon, un-normalized of course.

-SirKnight

SirKnight

05-01-2002, 01:16 PM

Oh and about your tesselation question, tesselation is the process of taking a description of some image (beit a star, foot, door, whatever) and breaking it down into simpler shapes such as triangles. This is needed because you can only draw convex shapes (like a triangle), but sometimes we need to draw a concave shape so inorder for us to do so, we tesselate it into convex pieces.

-SirKnight

Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.