Vertex Normals and Sharp Edges: How to Correct?

Hi folks,

So recently I’ve been playing around with loading in models from Blender in .OBJ format and applying some simple lighting to them. In order to improve the lighting, I calculated the vertex normals for the model and used these. For a sample model of a foot, this worked great. For a simple cube I created myself however, the result wasn’t great, with strange lighting at the edges as Shown below (the cube on the left is drawn using GLUT). I also subdivided the mesh in Blender so it has lots of vertices.

Thinking about it, I realised that this would be the case for any polygon with sharp edges as some of the adjacent face normals would be in the light and some wouldn’t be. The vertex normal would then be an average of this, causing this gradual blurring of colour.

Looking around the internet I haven’t found too much information but what I have found scattered around has been this:

[ul][li]Create the Model in Blender with duplicate vertices at Sharp Edges.[]Detect the angle between surface normals of adjacent triangles. If greater than a certain value, programatically duplicate the vertices.[]Somehow switch to flat shading when encountering a sharp edge. [/ul][/li]
I guess I’m asking how I should approach this? Is this typically the modellers job and it’s up to them to duplicate vertices for sharp edges and/or fix normals themselves? If I should do this within the application, how should I go about it? It seems like a bit of a task for big models that may have a few sharp edges.

Thanks

Hello,

the vertices should get dublicated, thats the work of the artist.

If you use normal maps instead of vertex normals, you’ll have much more normals per surface area. In that situation these artifacts on sharp edges will not be visible that obvious. You might ignore this problem then.

Thanks for the reply Menzel. Yeah I went back into Blender and duplicated the vertices (via the edge split modifier) and it worked fine. Glad to know it’s not my problem haha!

I’ll look into normal maps further down the road.