Sign in to follow this  
shultays

cel shader question

Recommended Posts

I am trying to implement a cel shader into my project but I have problems while determining edges. I am using this technique http://en.wikipedia.org/wiki/Cel-shaded_animation I am rendering normal.xyz and depth into a texture and after that use a sobel filter in a post process to detect edges but my results are very messy (disregard the textures on terrain, I am working on only edge detection now) terrain is rather good but player model has very large areas that are detected as an edge. I think the problem is on player normals change pretty fast in a very small area and that causes edges. is there a better algorithm for cel shader? I searched a bit this result looks good (search for "linedraw") http://developer.download.nvidia.com/shaderlibrary/webpages/hlsl_shaders.html but it looks like same algorithm that wiki says. maybe problem is about rendering my normals? In my vertex shader I use OUT.Norm = mul( float4(IN.Normal,0.0) , World); OUT.Norm.w = saturate(distance(IN.Pos.xyz, EyePos.xyz)/6000); and in pixel shader return float4(0.5*(normalize(IN.Norm.xyz)+1), IN.Norm.w) so what my be a problem, or is there a better algorithm?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this