Cel-Shading Problem
I did NeHe celshading tutorial but it didn't work out, so I did the next one I found in google and It works but it will flicker the faces in the back that are supposed to be culled.
Pictured here: http://www.angelfire.com/art2/sironion/celshade_problem.gif
Code Here:
//Model
glCallList(Gen3DObjectList(vLightDirection));
//Outline
////////////////////////////////////////////////////
glCullFace(GL_FRONT);
glLineWidth(6);
glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
glPolygonMode(GL_BACK, GL_LINE);
glDisable(GL_TEXTURE_1D);
glCallList(Gen3DObjectList(vLightDirection));
glEnable(GL_TEXTURE_1D);
glCullFace(GL_BACK);
/////////////////////////////////////////////////////////
This seems to be happening a lot, when I use Deep Exploration to export something as OpenGL code and load the model It will flicker faces that shouldn't be culled.
try this:
this is how i draw outlines in my celshading demo..hope it helps :)
glCallList(Gen3DObjectList(vLightDirection));// OutlinesglEnable (GL_BLEND); // Enable BlendingglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // Set The Blend ModeglPolygonMode (GL_FRONT, GL_LINE);// Draw Backfacing Polygons As WireframesglLineWidth (5); // Set The Line WidthglCullFace (GL_BACK); // Don't Draw Any Front-Facing Polygonsfloat outlineColor[3] = { 0.0f, 0.0f, 0.0f }; // Color Of The LinesglColor3fv (&outlineColor[0]); // Set The Outline Color glCallList(Gen3DObjectList(vLightDirection)); // Draw the model glDepthFunc (GL_LEQUAL);// Reset The Depth-Testing ModeglCullFace (GL_FRONT);// Reset The Face To Be CulledglPolygonMode (GL_BACK, GL_FILL);// Reset Back-Facing Polygon Drawing ModeglDisable (GL_BLEND); // Disable BlendingglLineWidth (1); glColor3f(1.0, 1.0, 1.0f);
this is how i draw outlines in my celshading demo..hope it helps :)
Imma take a wild guess here. Your call to gluPerspective's zNear parameter is 0? Try changing it to 0.1 or more. Having it set at zero causes some serious issues that usually look like what you have here.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement