Board index » delphi » interpolated shading of polygons

interpolated shading of polygons

I need some help on knowing how to shade a surface (like the side
of a cube).  I know how to actually calculate the color
intensities based upon the angle of the light source and the
viewer, but I do not know in what format I should store this info
nor do I know how to paint the surface to reflect this.  What I
wanted to do was have a rotating cube and shade or illuminate the
sides as it spun.  The side I will be painting may not be an
exact square (because of the rotation).  Any help would be
greatly appreciated.
Thanks, Mike Rohan  MRO...@InVisionTech.com

--
MRO...@InVisionTech.com

 

Re:interpolated shading of polygons


Quote
Mike Rohan (76734.2...@CompuServe.COM) wrote:

: I need some help on knowing how to shade a surface (like the side
<wordys cut out>
I've recently done something quite similar to the above, the way I did
this was to create a vertex structure, with the 3 co-ords of the vertex
and the vertex intensity, I then also have a face structure which is 3
pointers to vertex structures (I used triangles - should work with 4
vertices though), objects are then made up from these face structures,
for a basic flat shade, simply average the 3 (or 4) vertex intensities
around your face and use this to calc. the intensity of the face, or for
a more impressive shade, you'll need to write your own poly fill (mines a
bit flakey, any advise welcome), for each pixel you plot on the poly,
find how far away from each vertex you are, you can then work this out as
a percentage of the intensity of each vertex, add these together and use
the result to set the colour, sorry if this is not too clear, I have none
of my notes with me, any problems, let me know and I'll try to help.

        Good luck.

                Michael - cm3b...@bs47c.staffs.ac.uk

Other Threads