# Smooth Shading Problem #include Solved.h

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

## 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 on other sites
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 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 on other sites
Yeah I'm stupid, each vertex would have the same normal.

##### 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.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632593
• Total Posts
3007269

×