Jump to content
  • Advertisement
Sign in to follow this  
ChenA

cartoon rendering outlining

This topic is 3906 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
Advertisement
Hi, the images you gave aren't showing up here - can you try and describe the problems you're getting (or fix the links)?

Share this post


Link to post
Share on other sites
Quote:
Original post by Cycles
Hi, the images you gave aren't showing up here - can you try and describe the problems you're getting (or fix the links)?

Sorry,can you see it now?

Share this post


Link to post
Share on other sites
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.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!