• Advertisement
Sign in to follow this  

Model format

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm looking for a model format which stores vertices and normals, like the one i NeHes cel-shading lesson. I've made a simple loader for raw models, which only contains vertices, and I would like to try cel-shading and stuff and then I'll need to have the normals as well, right?

Share this post


Link to post
Share on other sites
Advertisement
Another option would be to keep your raw file format and calculate all the normals for each triangle / polygon face ONCE at the start when you are loading your model.

For example try:

vector3f CalcNormal(const vector3f& a, const vector3f& b, const vector3f& c)

{

vector3f ea = a - c;

vector3f eb = b - c;

vector3f normal = vector3f::Cross(ea, eb);


return normal.Normalize();

}


If the vertices happen to be backwards windings, just swap the cross product to get the correct normal for your file format.

Cheers

Share this post


Link to post
Share on other sites
What modeller are you using?

With 3dsMax it's super easy to write an exporter (in MaxScript) that puts out faces, vertices, normal, texcoords from multiple channels etc.
So go ahead and create your own format :-)

(There's a nice sample/tutorial in the script reference that does almost everything you need)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement