Sign in to follow this  
X Abstract X

.Obj Vertex Normals

Recommended Posts

I exported a model to .obj from Blender. I realize some vertices are used more than once in the faces, but why are there more vertex normals than vertices? I was expecting 1 vertex normal per vertex. Also, if anyone is familiar with Blender's .obj exporter, what is the difference between exporting the normals in HQ and non-HQ? Thanks.

Share this post


Link to post
Share on other sites
If the model uses "smoothing groups" (or equivalent features), then along the edge of two groups there will be a harsh change in the angle of the normals. This is achieved by having two different normals for those positions. Usually in a game engine, you'd duplicate the positions as well, and treat those cases as being duplicate vertices that happen to be located at the same position.

Share this post


Link to post
Share on other sites
I'm not entirely sure what smoothing groups are, but I've seen this happen in my own .obj importer before.

It happens if you try to make hard edges in your 3d modelling tool.
I don't know what it's called in blender, but it should be one of the tools related to normal editing.
A hard edge requires 2 normals or more per vertex, which is legal in obj, but not in gpu rendering, so you'll have to reconstruct the missing vertex points.

As for HQ normals, I don't know about blender, but some softwares can save the normals as double precision instead of float precision.

Share this post


Link to post
Share on other sites
Played around a bit more.

The faces that have smooth shading disabled in the .obj file share the same vertex normal for each vertex of the face.

In blender both HQ and non-HQ normals have float precision :S

Share this post


Link to post
Share on other sites
If you're using blender, the way to change this is to go into edit mode, and in the "Links and Materials" panel (F9) there are two little buttons "Set Smooth" and "Set Solid" (I think they are called). Select all of your vertices and then click one of those buttons. I think it defaults to solid.

If you do set solid each vertex normal is an exact copy of the face normal (so the model looks like very crisp polygons. Clicking "Set Smooth" will average all of the face normals around each vertex to give a smooth look. I think set solid will create more normals, because each vertex needs a unique normal for every face it is a part of.

Share this post


Link to post
Share on other sites
Yes all faces that are set smooth(under faces in blender)will be part of a smoothing group. This works well for a sphere for instance, as all vertex normals should be smoothed together, to ensure accurate interpolation of the normal, but not so well for a cube, or anything else with hard edges. An object like vitamin would need the top smoothed, but a hard edge where it meets the sides. The sides need to be smoothed in regards to each other, but we need to keep that hard edge along the top. This is where groups come in, as we can assign the sides into a smoothing group, and the top into another, and the bottom into a third group.

NORE: The presence of Vertex normals supersedes smoothing groups. This is because when vertex normals are exported, vertices can be defined multiple times with different normals, making smoothing groups completely unnecessary.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this