Toon (cel-) shading, ideas?

View previous topic View next topic Go down

Toon (cel-) shading, ideas?

Post  yarri on Mon Oct 12, 2009 5:53 pm

Hi, I haven't really done much yet but look at the HeNe code but has anyone tried applying toon or cel-shading techniques using SIO2?

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=37

Thanks,
--yarri

yarri

Posts : 81
Join date : 2009-04-10

View user profile

Back to top Go down

Re: Toon (cel-) shading, ideas?

Post  sio2interactive on Mon Oct 12, 2009 6:05 pm

I just check the code quickly... and it should be really easy to implement with SIO2... no sweat Wink

If you get it up and running (if you don't mind), send it to me, I will integrate the workflow inside one of the existing tutorials.

Cheers and Good luck!

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Toon (cel-) shading, ideas?

Post  yarri on Tue Oct 13, 2009 1:54 am

Well my first attempt using face culling and a 2-pass object rendering doesn't look too good:


I added this code to the tutorial02 render function, where _SIO2object points to suzanne and I explicitly render it using:
Code:

         _SIO2object->dst = 1.0f;
         vec3 scaleup = {1.1f, 1.1f, 1.1f };
         sio2TransformSetScl(_SIO2object->_SIO2transform, &scaleup);
         sio2TransformBindMatrix( _SIO2object->_SIO2transform );
         
         glPushMatrix();
         {
            glEnable( GL_BLEND );                  // Enable Blending
            glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );  // Set The Blend Mode
            
            // Draw Backfacing Polygons As Wireframes
            //glPolygonMode( GL_BACK, GL_LINE );
            glLineWidth( outlineWidth );                        // Set The Line Width
            
            glCullFace( GL_FRONT );            // Don't Draw Any Front-Facing Polygons
            glDepthFunc( GL_LEQUAL );          // Change The Depth Mode
            
            glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );            // Set The Outline Color
            
            sio2ObjectRender( _SIO2object, sio2->_SIO2window, sio2->_SIO2camera, 0, 1 );
            
            glDepthFunc( GL_LESS );            // Reset The Depth-Testing Mode
            glCullFace( GL_BACK );              // Reset The Face To Be Culled
            // Reset Back-Facing Polygon Drawing Mode
            //glPolygonMode( GL_BACK, GL_FILL );
            glDisable( GL_BLEND );              // Disable Blending
            
         }
         glPopMatrix();
         
         sio2MaterialReset();
         sio2ObjectReset();
         
         vec3 scaledown = {1.0f, 1.0f, 1.0f };
         sio2TransformSetScl(_SIO2object->_SIO2transform, &scaledown);
         sio2TransformBindMatrix( _SIO2object->_SIO2transform );
         
         sio2ObjectRender( _SIO2object, sio2->_SIO2window, sio2->_SIO2camera, 1, 1 );

Next, I'll look into porting the HeNe code but I don't understand how to use _SIO2vertexshader() and I suspect that might be critical?

--yarri

yarri

Posts : 81
Join date : 2009-04-10

View user profile

Back to top Go down

Re: Toon (cel-) shading, ideas?

Post  sio2interactive on Tue Oct 13, 2009 2:05 am

Yeah, might help you alot... check the source of MeditationGarden to check how to use SIO2vertexshader.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Toon (cel-) shading, ideas?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum