2
votes

I'm trying to obtain a smooth lighting effect on a solid with openGLES 2.0. I exported an .obj solid from blender and converted the obj file in C array of vertex and normal (with obj2openGL - http://heikobehrens.net/2009/08/27/obj2opengl/ ).Then I draw this data on my openGL ES app on iPhone. The problem is that the faces of the solid have a flat lighting (the same color for each face). I want a smooth effect without using per fragment lighting. I tried to increase the number of faces but with no results.

Is there a function on openGLES2.0 that control this effect (smooth vs flat lighting)?

1
And it cannot be that the Blender-exported .obj file has per-face normals in the first place? I don't have much experience with Blender, but modelling programs usually suck at exporting to simple and widespread formats (though Blender's open-source nature might it make different in this regard).Christian Rau
Thank you Christian, in the mean time I tried to do per fragment lightning obtaining the same flat effect. Instead a sphere that I created manually on the same application looks perfectly smooth. So I created with the same method a simple cube centered to 0,0,0 and the normals generated seems to be face normals! (e.g. 1,0,0 ...).Alex79
Once SO allows you to, can you post your solution as a full answer and then accept it? That would make us completionists happy :-)user577537

1 Answers

1
votes

I solved the problem. In order to export vertex normal in a .obj with blender 2.62 must be selected "shade smooth" (while in edit mode ctrl-F and choose shade mode). Hope this can help someone!. Thanks very much Christian, it was the easiest solution.