Toon (cel-) shading, ideas?
2 posters
Toon (cel-) shading, ideas?
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
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=37
Thanks,
--yarri
yarri- Posts : 81
Join date : 2009-04-10
Re: Toon (cel-) shading, ideas?
I just check the code quickly... and it should be really easy to implement with SIO2... no sweat
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!
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!
Re: Toon (cel-) shading, ideas?
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:
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
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
Re: Toon (cel-) shading, ideas?
Yeah, might help you alot... check the source of MeditationGarden to check how to use SIO2vertexshader.
Permissions in this forum:
You cannot reply to topics in this forum