Jump to content
  • Advertisement
Sign in to follow this  
SirOnion

OpenGL Cel-Shading Problem

This topic is 4879 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 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.

Share this post


Link to post
Share on other sites
Advertisement
try this:

glCallList(Gen3DObjectList(vLightDirection));

// Outlines
glEnable (GL_BLEND); // Enable Blending
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // Set The Blend Mode
glPolygonMode (GL_FRONT, GL_LINE);// Draw Backfacing Polygons As Wireframes
glLineWidth (5); // Set The Line Width
glCullFace (GL_BACK); // Don't Draw Any Front-Facing Polygons

float outlineColor[3] = { 0.0f, 0.0f, 0.0f }; // Color Of The Lines
glColor3fv (&outlineColor[0]); // Set The Outline Color

glCallList(Gen3DObjectList(vLightDirection)); // Draw the model

glDepthFunc (GL_LEQUAL);// Reset The Depth-Testing Mode
glCullFace (GL_FRONT);// Reset The Face To Be Culled
glPolygonMode (GL_BACK, GL_FILL);// Reset Back-Facing Polygon Drawing Mode
glDisable (GL_BLEND); // Disable Blending
glLineWidth (1);
glColor3f(1.0, 1.0, 1.0f);



this is how i draw outlines in my celshading demo..hope it helps :)

Share this post


Link to post
Share on other sites
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.

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!