Md2 format + cel shading
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 ??
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 ?
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 ?
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]
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]
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.
I think this is a culling problem ,
because md2 format use :
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]
because md2 format use :
glEnable ( GL_CULL_FACE); // Turnculling onglCullFace ( 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]
Have you tried disabling culling for the outlines or reversing that culling (do some lines appear or non at all?)?
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]
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]
Finally fix the problem :
the wrong code :
screenshot :
That was a depth test + culling problem
good code :
[edited by - venomelektro on June 3, 2004 9:23:03 AM]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement