Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

venomelektro

Md2 format + cel shading

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

Hello, I try to implement lesson 38 cel shading code with md2 models , I ve added normals calculations and cel shading works fine but I ve got a problem with outline , The outline is drawed on each triangle , I tried to change the depth function but I didnt succeeded in getting something right Any suggestions ??

Share this post


Link to post
Share on other sites
Advertisement
You shoudn''t encounter any problem with outlining. It''s probably one of the most generic algorithms out there.

What do you mean by "I didnt succeeded in getting something right" ?
Can you describe the problem or post a screenshot ?
Is outlining correct when you run lesson 38 ?

Share this post


Link to post
Share on other sites
Hi,

I will post a screen shot and code soon when I get back from work


I mean every polygon of the mesh is outlined

And yes, vincoof , outlining is correct when I run lesson38 , I have also implemented multitexturing and It works fine except with md2 file format

screenshot of cel shading with my own mesh format :

http://www.elektronoize.com/vm.games/imgs/celshd/glcaplg01.jpg

Will post md2 screenshot soon

[edited by - venomelektro on June 3, 2004 6:15:45 AM]

Share this post


Link to post
Share on other sites
If you can do it with your own format you can do it with all formats (if you load them into an internal format of course). Try loading the .md2 model into your internal format and i don''t see any reason (not even texturing / multitexturing) why it wouldn''t work. Just my opinion/view.

Share this post


Link to post
Share on other sites
I think this is a culling problem ,

because md2 format use :



glEnable ( GL_CULL_FACE); // Turnculling on

glCullFace ( GL_FRONT );



and lessons ... 37 (oops not 38 ! ) use it also to draw the outline ! , but I even tried to change polygonmode and depth test but still not succeeded in guetting something correct





[edited by - venomelektro on June 3, 2004 6:57:52 AM]

Share this post


Link to post
Share on other sites
If you control the rendering code of MD2 models, then you just have to reverse/enable/disbale face culling as needed by the cel-shading algorithm.
As tree penguin pointed out, if you can do it with your own format you should be able to do it with every format, even if it means conversion to your own format.

[edited by - vincoof on June 3, 2004 7:38:29 AM]

Share this post


Link to post
Share on other sites
Finally fix the problem :

the wrong code :


glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // Set The Blend Mode ( NEW )

glPolygonMode (GL_BACK, GL_LINE); // Draw Backfacing Polygons As Wireframes ( NEW )

glLineWidth ( 3.0f ); // Set The Line Width ( NEW )


glCullFace (GL_FRONT); // Don't Draw Any Front-Facing Polygons ( NEW )

glDepthFunc (GL_LEQUAL); // Change The Depth Mode ( NEW )

glColor3fv ((float*)&Vector3(1,0,0) );

glBegin(GL_TRIANGLES);

for( j = 0; j < pFrame->numOfFaces; j++)
{

for( int whichVertex = 0; whichVertex < 3; whichVertex++)
{


//****

//Draw_Vertex(); ///

///




}
}

glEnd();



screenshot :




That was a depth test + culling problem

good code :




glPolygonMode (GL_BACK, GL_FILL); // Draw Backfacing Polygons As Wireframes ( NEW )

glPolygonMode(GL_FRONT,GL_LINE);
glLineWidth ( 3.0f ); // Set The Line Width ( NEW )


glCullFace (GL_FRONT); // Don't Draw Any Front-Facing Polygons ( NEW )

glDepthFunc (GL_LESS);











[edited by - venomelektro on June 3, 2004 9:23:03 AM]

Share this post


Link to post
Share on other sites

  • 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!