.Obj Vertex Normals

Started by
5 comments, last by Burnt_Fyr 13 years, 11 months ago
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.
Advertisement
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.
Is that what's meant by smooth shading? Denoted like this in the .obj file format:
s 1
s off

Or is this a different feature I have to worry about?
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.
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
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.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
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.

This topic is closed to new replies.

Advertisement