best way to update normals?
Blitz3D Forums/Blitz3D Programming/best way to update normals?
| ||
hey, im trying to build a water system for my game, the main stuff is sorted out and working nicely. However, update normals is completely to slow to be any use with big meshs. Are there any faster ways? Ive noticed SSwift has wrote some for the code archives, are these faster or slower sswift? |
| ||
The Blitz ones (UpdateNormals) are very fast (relatively), but not very good, but you might be able to optimise your own (or sswifts) using what you know about your data - precalcing or otherwise. |
| ||
ok, how hard would it be to create a dll in c++ to do a better job than blitz? |
| ||
Unlikely since it would need access to the blitz system to do it. I'd go with sswift's code and see if it works fast enough for what you want. Sswift said that his code was faster I believe, because it respects the triangle connections and so doesn't have to smooth out the face normals of each triangle at each vertex, whereas the inbuilt blitz one does. |
| ||
I have to admit, I've never really understood the whole updating normals thing. What's the purpose of it? |
| ||
To set the nurmals of the faces of your mesh to point outward. It averages out where each normal points based on the directions that the faces that touch that normal are pointing For the most part, it smooths out most objects (which may or may not be what you want). |
| ||
It's for lighting. Each vertex has a normal and each triangle has three vertices and so three normals. since blitz uses vertex lighting it lights the mesh based on the normal. If you flipped all the normals the mesh would bit lit backwards. Shaded areas would be lit and vis versa. |