Jump to content
OpenGL API Specifications
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 31 July 2001 - 11:17 PM
Posted 31 July 2001 - 11:58 PM
Original post by illuzion
I have the following information:
- an array of triangles, each withx y and z coords, and uniques texture u and v coordinates
- an array of (omni) lights, each with a rgb color and an xyz position coordinate.
I want to calculate the amount of light (rgb values) for each triangle (I suppose; would at each vertex be better? How would you do that though?)
I suppose I have to calulate the normals for each triangle, and then find the angle between those / the light. How do I do this? (Please explain clearly, or link to a site that explains it clearly, preferably with code examples).
Once I have a value for each triangle, I want to draw this to a bitmap. I suppose I could just draw a flat shape, but that would result in flat-shaded triangles in-game, wouldn''t it?
So how do I go about blending between the triangles? Does anyone have a code snippet for drawing triangles with a different colour at each vertex? Or should I draw them flat, and then use a blur function? (Now I need to know code for a blur... and how do you calulate how much blur to use?)
Posted 01 August 2001 - 11:12 PM
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.