Jump to content
  • Advertisement
Sign in to follow this  
Omniscience

Smooth Shading Problem #include Solved.h

This topic is 3788 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

I am making a game engine with which I will make many games...I started one very quickly just to test it out, and the .obj file importer I made works perfectly. One thing that concerns me is the shading you see in the screenshot. Why does it not look smooth? I have one correctly implemented light, all of my normals are correct. This is my InitRendering function. void InitRendering() { glShadeModel(GL_SMOOTH); glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_NORMALIZE); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); } Screenshot: http://onewinged.byethost13.com/Problem.JPG [Edited by - Omniscience on July 8, 2008 8:11:43 PM]

Share this post


Link to post
Share on other sites
Advertisement
Maybe enable blending? I don't know, it is worth a shot. You set a blending function...


glEnable(GL_BLEND);



EDIT: Maybe some more code, are you setting a normal for each vertex?

Share this post


Link to post
Share on other sites
Thanks for the reply. I'll try. Yes, I do have a normal for each vertex, but I've noticed upon looking at my .obj files that they are often the same for each vertex in a surface, so it wouldn't matter. Nevertheless, I used someone else's .obj loader on my own models, and it shaded them perfectly. Maybe glEnable(GL_BLEND); will help.

EDIT: I tried. It didn't do anything. =[

Share this post


Link to post
Share on other sites
OMG Portmanteau! Thank you so much for bringing up normals for each vertex...That wasn't the problem, but it made me realize that I wasn't even using a vector for normals because I saw that all the normals in the file for a single surface were the same, so I just used 1 normal per surface and assigned it to each vertex individually...This, for some unknown reason, caused a problem (which it shouldn't have), and I changed normals into a vector just because you brought it up, and I decided to go for it XD. Anyways, solved! Thanks.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!