Sign in to follow this  

cartoon rendering outlining

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

I use the method from the paper <<Real-Time Image-Space Outlining for Non-Photorealistic Rendering>>. Blow is the render result: here is the code:
float4 normalAngle;			
normalAngle.r = ((dot(normal0,normal1)) - 0.8f) > 0.0f ? 0.0f : 1.0f;
normalAngle.g = ((dot(normal0,normal2)) - 0.8f) > 0.0f ? 0.0f : 1.0f;
normalAngle.b = ((dot(normal0,normal3)) - 0.8f) > 0.0f ? 0.0f : 1.0f;
normalAngle.a = ((dot(normal0,normal4)) - 0.8f) > 0.0f ? 0.0f : 1.0f;

float normalInking = 1.0f - saturate(dot(normalAngle,normalAngle));





normal1-4 is the surround sample point's normal. This method has two question: 1.the normal edge is too thick. 2.the normal edge is not enough smooth. I find if i render normal to a double size rendertarget,the normal edge is thin,like this: but it need more resource. How to solve these question? Any suggestions, comments or links to articles would help greatly. Thanks. [Edited by - ChenA on December 5, 2007 7:59:33 AM]

Share this post


Link to post
Share on other sites
Images show up fine for me.

Apologies for hijacking, but at least it's topical:
Anyone know of a way to do this on a per-object basis? Obviously, post-process filters are out for me. Right now I have a crappy version that renders the object again shifted out along normals, as a solid color, and with the winding order reversed for the culling method. Looks ok most of time. Anyone have any good solutions for per-object outlining?

Share this post


Link to post
Share on other sites
1/ change the 0.8f to a different value eg 0.85
2/ not easy/cheap to fix, u could render to a higher res + downscale eg AA, or perhaps blur the final colorbuffer result a bit

Share this post


Link to post
Share on other sites
you can find a better way for that in "Introduction to 3D Game Programming with DirectX9.0"

by the way, I have another way to render outlines

Pass 0:
Set D3DCULL to D3DCULL_CW
then scale the model by the normal direction
render the model with one color
Pass 1:
render the model with texture

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
If you want smoother edges, you may want to try using a sobel operator on the normals and/or depth. I'm not sure if you will be able to control the line thickness, though.

I try the sobel filter,but it don't generate smooth edge,neither the normal edge nor the depth edge.
Maybe my code has some bug,is someone use the sobel filter to get the smooth edge?
Can you give me some suggestion or articles?
Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by zedz
1/ change the 0.8f to a different value eg 0.85
2/ not easy/cheap to fix, u could render to a higher res + downscale eg AA, or perhaps blur the final colorbuffer result a bit

1.change the threshold can't control the line thinness,it just control the line appear or not.
2.I use the gauss blur,it don't generate smooth edge.Maybe i should try more.

Share this post


Link to post
Share on other sites
Quote:
Original post by xoyojank
you can find a better way for that in "Introduction to 3D Game Programming with DirectX9.0"

by the way, I have another way to render outlines

Pass 0:
Set D3DCULL to D3DCULL_CW
then scale the model by the normal direction
render the model with one color
Pass 1:
render the model with texture

Thanks for your suggestion.
The method in the book use the extra information(two face normal),need to preprocess,and it can't generate normal edge.

The mehtod you said can't generate fixed thinness outline silhouette,and it can't generate normal edge.

Share this post


Link to post
Share on other sites
There are different ways to draw silhouettes, but in your case, here's a solution for both problems:

1) increase the size of the kernel; right now you sample only the surrounding 4 normals. Changing the threshold (i.e. 0.8) won't change the thickness of the outline, changing the size of the kernel will.
2) add weights; after you have increased the kernel size, you can smooth edges by weighing the contribution of each sample to the result. for example, samples at one unit from the center will contribute more than samples at two units from the center.

While I'm pretty sure about 1, I leave 2 for you to verify ;-).

Cheers.

Share this post


Link to post
Share on other sites

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