What are Normals for?
Blitz3D Forums/Blitz3D Programming/What are Normals for?
| ||
I'm using em in my code, not actually sure what they do UpdateNormals i.e.: I commented them out, didnt notice any change. |
| ||
a normal is a the direction in which a polygon is facing, updatenormals is only needed when mesh commands have been used. |
| ||
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. |
| ||
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. |
| ||
thx guys for responses |
| ||
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? |
| ||
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. |
| ||
Question: Do i Need to update the normals if i use rotatemesh?. Thanks. |
| ||
No, only if you mess around with the actual vertices. |
| ||
Thanks. |