Sign in to follow this  

Inner edge detecting

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

Hi,

 

I am not that good of a shader programming. Still experimenting. Currently i am going with unity engine and practicing cg programming. I am trying to create a shader that will detect both inner and outer edges and outline them. So far i tried to fix the front face of my object and extended the vertices that are not visible. That worked for some basic shapes but not complex ones. I tried detecting the outer edges using some common sense that dot product of normal and view direction of a vertex will be 0. But I do no know how to set the outline there. How to create an extra thick line following the edges. And how can i detect the pixel changes inside the objects to detect the inner edges ? 

Thanks in advance

Share this post


Link to post
Share on other sites
Not sure I understand, are you after cel shading ?

Anything more complicated probably needs a custom vertex and/or a geometry shader to grant your pixel shader enough information (triangle adjacency, inner edge tagging).

A screenshot or mockup drawing might help wink.png

Share this post


Link to post
Share on other sites

Not sure I understand, are you after cel shading ?Anything more complicated probably needs a custom vertex and/or a geometry shader to grant your pixel shader enough information (triangle adjacency, inner edge tagging).A screenshot or mockup drawing might help :wink:


Yes. That's exactly what I am after. I'll read through the article u provided.

Share this post


Link to post
Share on other sites

I just had a closer look at that XNA article. It actually uses the edge detection approach. There are others, and now that you have the name you can search better (AFAIK cel shading also means color quantization, not just edge enhance). The wikipedia entry lists the one I had in mind: Not a post process approach but a two pass with some culling trick.

Share this post


Link to post
Share on other sites

 

A pretty effective and simple way can be analysing your depth buffer. Using a sobel filter is pretty common for that kind of operation. http://homepages.inf.ed.ac.uk/rbf/HIPR2/sobel.htm


I heard of it. I will try to get hang of the theory explained in your provided link.

 

That was just the first link I found on google. It's pretty simple in practice: sample your depth buffer for the point your are shading and the surrounding points, compute how much variance there is over the kernel, and this will tell you if you are on/close to an edge or not. You can then shade the point differently based on that. Kernel size will impact how wide your filter is. (though you can control the thickness in other, more performance friendly ways as well of course)

Share this post


Link to post
Share on other sites

This topic is 1119 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.

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