What are Normals for?

Blitz3D Forums/Blitz3D Programming/What are Normals for?

Nicstt(Posted 2005) [#1]
I'm using em in my code, not actually sure what they do

UpdateNormals

i.e.: I commented them out, didnt notice any change.


slenkar(Posted 2005) [#2]
a normal is a the direction in which a polygon is facing,
updatenormals is only needed when mesh commands have been used.


jfk EO-11110(Posted 2005) [#3]
And: Updatenormals is needed when a mesh is edited, eg. some vertices have been moved. The normals are then used by the lights, for shading and shininess etc.

Sometimes they are also pretty useful for you, eg. CollisionNX or PickedNX etc. if you want to calulate the angle an object has to bounce off a wall or something.


markcw(Posted 2005) [#4]
a normal is actually just a 3d point like a vertex,
but it represents a direction or vector.
each vertex has a normal, and the vector
obtained from these two points can be
used in several ways.

generally, it is used to describe how to light the
polygons, and the distance of the vector is used
for the light intensity. So, if you were to set all
normals to their vertex positions you should get
a flat-shaded mesh like if you set it with entityfx
(or whatever it is.) If you then scaled them up a bit
you'd start to notice lights starting to effect them.
The more you scale them up the more lights
effect them. a distance of 1 is the standard
value used in normalising polygons.

im pretty sure updatenormals is for smoothing a
mesh, so if it didn't change anything thats probably
because it is already smoothed.


Nicstt(Posted 2005) [#5]
thx guys for responses


puki(Posted 2005) [#6]
And the fact that you didn't notice any visual changes when you commented it out is also often a case (depending on what you are doing) - which is why I limit the use of the command coz it may be unnecessary. I suppose it really depends on what you are doing as to how much you really need to update normals. Sometimes the actual changes will be very slight anyway in terms of visuals - again, depending on what you are doing.

The use of the command has appeared in Blitz demos/code whereby there is no difference if you comment it out. Not sure whether this will be consistent from one graphics card to another though - ie. I wonder if someone will see a visual difference that someone else cannot when running the same code.

Anyone know if the visual output is affected by the graphics card?


taxlerendiosk(Posted 2005) [#7]
Try turning it off in the sample code of the waving flag. It should seem oddly flat, the rippled areas won't be shaded - like the surface is all still facing the same direction.


KuRiX(Posted 2005) [#8]
Question: Do i Need to update the normals if i use rotatemesh?. Thanks.


taxlerendiosk(Posted 2005) [#9]
No, only if you mess around with the actual vertices.


KuRiX(Posted 2005) [#10]
Thanks.