# Calc Normals

This topic is 4932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

whats a fast way of calcualtion normals for 300 000 vertices at game creation i know i can turn my terrain into a mesh then fix the normals with the dx command and then copy it back to the vbuffer but thats sounds like it will also take some time?? or if u know a good method of calculation smooth normals cheers hunter_ex

##### Share on other sites
Calculating unsmoothed normals is a quick process, but smoothed ones require that you know adjacency information so you can average normals from multiple triangles. Unfortunately, I do not know of an easier way to do this but maybe someone else can direct you.

If I were you in this situation, I would structure you mesh into triangles with pointers to vertices, and vertices with multiple pointers back to their respective triangles. I would first calculate the normal of each triangle and store these vectors. Then I would iterate through each vertex and for each triangle that it belongs to and average the normals from the triangles.

... out of curiosity, for what purpose do you need to calculate the normals at startup? There is no possible way you can precalculate these normals?

##### Share on other sites
You can always use nvidia nvmeshmender - im nopt 100% sure but it can also compute normals and its api indipenmdent.

But still i think it would be reasonable to turn that map into mesh, com0pute adjecency and then normals. You dont have to retrive those vertices after that and copy to your vbuffer, since you can use mesh vbuffer with LockVertexBuffer(..)

##### Share on other sites
before i made my own functions for generation adjaecny and normals but they wne pretty slow : /

so maybe the best i can do is using the dx compute normals and try to store them

in a text file..

hey i need some more help
can someone explain what the D3DXCreateNormalMap "the functions might be named slight other" but i hope what functions i mean : )

what does it do what can i use it for??

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 30
• 16
• 11
• 10
• 11
• ### Forum Statistics

• Total Topics
634113
• Total Posts
3015591
×