PDA

View Full Version : OBJ Import Normals



Fenrisul
12-12-2008, 10:40 AM
So... i have a bunch of OBJ models to import and their vertex normals (defined in the OBJ) and the mesh itself was rotated 75degrees off plane (dont ask why); so I had a problem with importing the normals as Modeler wont rotate the vertex normal maps along with the Rotate tool so i wrote a C app to just matrix invert->transpose and parse the OBJ vn x y z entries... that being solved... i encountered this lovely issue...

OpenGL shows everything perfectly
Render it and the normals are *INVERTED*

Quickshade ignores all smoothing/normals and at least gets the light direction correct
Realistic is busted; light is literal multiply by -1 inverted; obviously this is solvable my exporting my OBJ's with inverted normals...but then OpenGL is worthless because I cant see anything. So in a last ditch attempt to not think about switching to Maya :P I decided to use the advanced camera to render...

Low and behold...advanced camera has no problems at all with light direction and imported OBJ normals...

Where do I buglist this?

Sensei
12-12-2008, 11:20 AM
Matrix transpose? That's were you introduced problem.. ;)

Search google for glRotate(), and use similar matrix as presented in this command, it should work better..

Fenrisul
12-12-2008, 01:00 PM
Well - my method works just as well in this scenario since i only have to rotate about one axis :P Anyway; the issue came from Classic camera failing at rendering the baked OBJ normals.

Sensei
12-12-2008, 01:08 PM
I wrote TrueOBJImport http://www.trueart.pl/?URIType=Directory&URI=Products/Plug-Ins/TrueOBJImport and I was having similar to you problems.. if something was not right calculated in the first place, OpenGL was fine and render was screwed, or OpenGL was broken and render was fine..