weird lighting on 3d mesh

i have very simple code for loading and drawing a head from a ply file:

#pragma once  
#include "ofMain.h"  
#include "ofxAssimpModelLoader.h"  
class testApp : public ofBaseApp {  
	void setup();  
	void update();  
	void draw();  
	ofxAssimpModelLoader model;	  
	ofEasyCam cam;  
	ofMesh mesh;  
	ofLight light;  

#include "testApp.h"  
void testApp::setup() {  
	mesh = model.getMesh(0);  
void testApp::draw() {  

i’ve attached an image of the result in OF, and the original in meshlab. i’ve also attached the model (head-only.ply).

i’ve tried some different combinations of the lighting and shading models, but nothing seems to work. GL_NORMALIZE doesn’t help. i’m really not sure what’s wrong. any ideas?

![]( shot 2011-10-07 at 6.20.09 PM.png)

![]( shot 2011-10-07 at 6.25.44 PM.png)

hi @kylemcdonald, i 'll take a look in the model and in the code, maybe a issue with the normals…

the reason of this artifacts is because vertex normals aren’t reoriented. You can see in mesh lab(see the picture) .In meshlab just select all the vertex and then apply the reorient normals.take a look in the model the zip file

aha! that totally did it. i don’t know why i didn’t think of that sooner :slight_smile:

to summarize: it’s not a problem with OF or GL or assimp. it’s just that the vertex normal orientation is very important when you have smooth shading enabled, because opengl needs to interpolate between the normals. thanks kalwalt!

i think it is a way to reorient the vertex normals(via code) but i’haven’t a clear and safety idea how to do it. ::slight_smile:
Anyway Mesh lab is very useful!