OpenGL Flächennormale

Hey Leute.
Cinema4d kann irgendwie keine Obj’s mit Normalen exportieren, und ich habe (noch)
keine lust einen collada parser zu schreiben.
Daher dachte ich mir berechne ich die Normalen von einem exportierten 3d Modell einfach selbst.

Folgendes habe ich gefunden: https://www.opengl.org/wiki/Calculating_a_Surface_Normal

Als Code bei mir:

Vector3f v2 = face.get(1);
Vector3f v3 = face.get(2);
Vector3f U = Vector3f.sub(v2, v1, new Vector3f());
Vector3f V = Vector3f.sub(v3, v1, new Vector3f());
float nx = U.y * V.z - U.z * V.y;
float ny = U.z * V.x - U.x * V.z;
float nz = U.x * V.y - U.y * V.x;
normal = (Vector3f) new Vector3f(nx, ny, nz).normalise();
//Nx = UyVz - UzVy
//Ny = UzVx - UxVz
//Nz = UxVy - UyVx```

das ganze.. funktioniert jedoch nicht ganz. 
Flächen die direkt zum Licht zeigen sind manchmal komplett schwarz, 
manche sind bunt obwohl sie überhaupt nicht angestrahlt werden. 

Ist diese Berechnung nun richtig oder nicht?

*** Edit ***

Okay, hab das ganze mal mit einem Würfel versucht.. Normalen werden definitv richtig berechnet.
Sieht zumindest richtig aus.. oder nicht?


v: 2.0, 2.0, 2.0 normal: 0.0, 0.0, 1.0 vt: 1.0, 1.0
v: -2.0, 2.0, 2.0 normal: 0.0, 0.0, 1.0 vt: 1.0, 1.0
v: -2.0, -2.0, 2.0 normal: 0.0, 0.0, 1.0 vt: 1.0, 1.0
v: 2.0, 2.0, -2.0 normal: 1.0, 0.0, -0.0 vt: 1.0, 1.0
v: 2.0, 2.0, 2.0 normal: 1.0, 0.0, -0.0 vt: 1.0, 1.0
v: 2.0, -2.0, 2.0 normal: 1.0, 0.0, -0.0 vt: 1.0, 1.0
v: -2.0, 2.0, -2.0 normal: 0.0, 0.0, -1.0 vt: 1.0, 1.0
v: 2.0, 2.0, -2.0 normal: 0.0, 0.0, -1.0 vt: 1.0, 1.0
v: 2.0, -2.0, -2.0 normal: 0.0, 0.0, -1.0 vt: 1.0, 1.0
v: -2.0, 2.0, 2.0 normal: -1.0, 0.0, -0.0 vt: 1.0, 1.0
v: -2.0, 2.0, -2.0 normal: -1.0, 0.0, -0.0 vt: 1.0, 1.0
v: -2.0, -2.0, -2.0 normal: -1.0, 0.0, -0.0 vt: 1.0, 1.0
v: 2.0, 2.0, -2.0 normal: 0.0, 1.0, 0.0 vt: 1.0, 1.0
v: -2.0, 2.0, -2.0 normal: 0.0, 1.0, 0.0 vt: 1.0, 1.0
v: -2.0, 2.0, 2.0 normal: 0.0, 1.0, 0.0 vt: 1.0, 1.0
v: 2.0, -2.0, 2.0 normal: -0.0, -1.0, 0.0 vt: 1.0, 1.0
v: -2.0, -2.0, 2.0 normal: -0.0, -1.0, 0.0 vt: 1.0, 1.0
v: -2.0, -2.0, -2.0 normal: -0.0, -1.0, 0.0 vt: 1.0, 1.0
v: 2.0, -2.0, 2.0 normal: 0.0, -0.0, 1.0 vt: 1.0, 0.0
v: 2.0, 2.0, 2.0 normal: 0.0, -0.0, 1.0 vt: 1.0, 0.0
v: -2.0, -2.0, 2.0 normal: 0.0, -0.0, 1.0 vt: 1.0, 0.0
v: 2.0, -2.0, -2.0 normal: 1.0, 0.0, 0.0 vt: 1.0, 0.0
v: 2.0, 2.0, -2.0 normal: 1.0, 0.0, 0.0 vt: 1.0, 0.0
v: 2.0, -2.0, 2.0 normal: 1.0, 0.0, 0.0 vt: 1.0, 0.0
v: -2.0, -2.0, -2.0 normal: 0.0, 0.0, -1.0 vt: 1.0, 0.0
v: -2.0, 2.0, -2.0 normal: 0.0, 0.0, -1.0 vt: 1.0, 0.0
v: 2.0, -2.0, -2.0 normal: 0.0, 0.0, -1.0 vt: 1.0, 0.0
v: -2.0, -2.0, 2.0 normal: -1.0, 0.0, 0.0 vt: 1.0, 0.0
v: -2.0, 2.0, 2.0 normal: -1.0, 0.0, 0.0 vt: 1.0, 0.0
v: -2.0, -2.0, -2.0 normal: -1.0, 0.0, 0.0 vt: 1.0, 0.0
v: 2.0, 2.0, 2.0 normal: 0.0, 1.0, 0.0 vt: 1.0, 0.0
v: 2.0, 2.0, -2.0 normal: 0.0, 1.0, 0.0 vt: 1.0, 0.0
v: -2.0, 2.0, 2.0 normal: 0.0, 1.0, 0.0 vt: 1.0, 0.0
v: 2.0, -2.0, -2.0 normal: 0.0, -1.0, 0.0 vt: 1.0, 0.0
v: 2.0, -2.0, 2.0 normal: 0.0, -1.0, 0.0 vt: 1.0, 0.0
v: -2.0, -2.0, -2.0 normal: 0.0, -1.0, 0.0 vt: 1.0, 0.0



Licht sieht trotzdem irgendwie komplett falsch aus.. 
Werde ich den Fehler wohl doch im Shader suchen müssen... 


Falls sich das jemand anschauen möchte:

```#version 150

in vec3 fVertex;
in vec3 fNormal;

struct Light {
	vec4 position;
	vec3 color;
	vec3 ambient;
	float attenuation;
};

const int MAX_LIGHTS = 5;

uniform mat4 model;
uniform int lightCount;
uniform Light lights[MAX_LIGHTS];

vec3 calculateLight(Light light, vec3 fragmentColor){
	vec3 rayDirection;
	float finalAttenuation;	
	if(light.position.w == 0.0){ //directional light
		rayDirection = normalize(light.position.xyz);
		finalAttenuation = 1.0;
	}
	else { //point light
		vec3 normal = normalize(transpose(inverse(mat3(model))) * fNormal);
		vec3 fragmentPosition = vec3(model * vec4(fVertex, 1));
		rayDirection = normalize(light.position.xyz - fragmentPosition);
		
		//calculate attenuation
		float distanceToLight = length(light.position.xyz - fragmentPosition);
		finalAttenuation = 1.0 / (1.0 + light.attenuation * pow(distanceToLight, 2));
	}
	
	//calculate ambient
	vec3 finalAmbient = light.ambient * light.color * fragmentColor;
	
	//diffuse
	float diffuseIntense = max(0, dot(fNormal, rayDirection));	
	vec3 finalDiffuse = diffuseIntense * fragmentColor * light.color;
	
	//calculate final color
	return finalAmbient + finalAttenuation * finalDiffuse;
}

vec4 getLightColor(vec4 texColor){
	vec3 colorSum = vec3(0);
	for(int i = 0; i < lightCount; i++){
		colorSum += calculateLight(lights**, texColor.rgb);
	}
	return vec4(colorSum, texColor.a);	
}```

ich poste später mal ein kskb..

*** Edit ***

OKAY. 

Kann mich bitte irgendjemand schlagen.. oder so?
Das ganze lag an den Zeilen "27" im shader.. ich berechne 
die normale im world space, aber lokal im if.. zeile "40" benutze ich die alte,
untransformierte normale... meine güte -.- `
Ist also alles richtig... sorry für den unnötigen Post >.<

Ich bearbeite die shader in eclipse als text dateien.. da gibts ja kein syntax highlighting.. hat da jemand einen tipp?