I'm working on a small code in win32asm (masm). I look for a math formula of the shading.

I would like coloriser the faces of a cube (the the API polygon) one simulating a light. This cube makes a rotation 3d

If somebody can help me with a tut / source / url.


see you
Posted on 2006-06-21 07:24:58 by tomart2005
try hornet.org or scene.org or gamedev.net or cfxweb.net
Posted on 2006-06-21 12:40:10 by comrade
It's as simple as calculating a dot-product of given light vector and face's/vextex' normal vector. The result is the 'amount' of light on that particular face/vertex.
Posted on 2006-06-21 14:01:20 by ti_mo_n
He's asking a much simpler question, I believe.
Each VERTEX of the Cube can have its own COLOUR.
The result is that each FACE of the Cube is filled with colour that is smoothly blended (interpolated) between the four VERTICES that it shares.

Vertices can contain much more information than simple Position in XYZ, for example they can contain Texture Coordinates.
Under Direct3D, we're expected to define exactly WHICH COMPONENTS are active in our Vertices. The combination of active components in a Vertex is known as an FVF (Flexible Vertex Format).

If you require more information or example code, just ask.
Regards, H.
Posted on 2006-06-21 19:55:55 by Homer