calculating normals of vertices in a custoscenenode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
phobos
Posts: 1
Joined: Sat May 08, 2004 10:45 am

calculating normals of vertices in a custoscenenode

Post by phobos »

I tryed to modify the customscenenode tutorial to draw a cube instead of a tetrahedron. The problem is that i'm lost in mathematics : i don't know how to calculate normals coordinates of the vertices of my cube.

A second question is how to determinate tu and tv constants (i think it's for mapping, but I don't know how it works.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

normals are just basic vectors and they influence way in which lighting influence wertex.
Vector consist of two points in space and direction:
point A and point B. Direction is A->B
vector of coordinates 0,-10,5 consist of A[0,0,0] and B[0,-10,5]
vector of 1,1,2 have point A[0,0,0] and B[1,1,2]
but if we have A[1,1,1] and B[2,2,3] coordinates of vector are also 1,1,2 since vector = B-A = 2-1, 2-1, 3-1 = 1,1,2

Lets take example:
you have simple plain object with 4 wertices (let say coords of those wertices are: 0,0,0 - 0,0,1 - 1,0,1 - 1,0,0)
We want that normals of all wertices face up so object looks right when lith from abowe, while it will be invisible from below. Normals of all 4 wertices will be the same: 0,1,0

U and V coordinates are coordinates of vertex on mapping space. Maping space is your texture. Mapping space is always 1 unit width and 1 unit high. If your texture is for example 256/128 pixels then 1U represent 256 pixels of your texture width and 1V represent 128 pixels of texture height.

If coordinates of vertex are for example 0.5, 0.5 than it sits right in the middle of your texture.
You can use coordinates which are greater than 1 if you want your texture to repeat on your surface.
Post Reply