Jump to content
  • Advertisement
Sign in to follow this  
Hikaru

Problem loading normals from an OBJ file

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I'm having some problems with my obj-loader. I'm using c++ and opengl. My vertex coordinates and texture coordinates are correct but when it comes to the normals something isn't right. I'm kinda new to this so bare with me. If i look at the first vertex,texcoord,norm and face in my obj file i read: v -4.871077 -1.644360 5.017470 vt 0.495749 0.753512 vn 0.000000 0.000000 1.000000 f 1/16/1 2/2/2 3/19/3 so the first point should be rendered: glNormal3f(0, 0, 1); glTexCoord2f(0.495749, 0.753512); glVertex3f(-4.871077, -1.644360, 5.017470); right? But if i calculate the normal for this point i get (-0.6666669,-0.6666669,0.333333), which looks correct. So, what am i doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
It's impossible to give you an answer without any more information. What exactly is wrong about it? Can we see the other points?

Perhaps the normal in question has been averaged amongst the faces that share that vertex in order to give it a smoother appearance.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!