Calc Normals

Started by
2 comments, last by Hunter_Ex 18 years, 9 months ago
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
Blekinge Institute of Technology
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon
Advertisement
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?
....[size="1"]Brent Gunning
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(..)
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??
Blekinge Institute of Technology
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon

This topic is closed to new replies.

Advertisement