Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Tuni · May 31, 2013 at 12:59 PM · shadercubetoon

Toon shader for a cube - outline problem

Hi everyone,

I want to have a cube with a toon shader. I created the cube and added the standard "Toony-BasicOutline" to the cube.

My problem is that the outline is missing at the top edge and the outlines go to far away from the edges when I increase the width of the outline.

alt text

How can I fix this problem? I want outlines at all edges and the should touch the edges (no matter what width I choose).

Tim

bildschirmfoto 2013-05-31 um 14.50.07.png (8.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Aestial · Sep 23, 2013 at 12:34 AM

Hello, I found a better solution with this approach (Pro only, uses Image Effects):

http://www.isotx.com/selection-outlines/

However, the scale approach works only if the origin of the geometry is in the same point as its centroid. Perfect for a cube, and you only have to take out from the common toon/outline shader this line:

 o.pos.xy += offset * o.pos.z * _Outline;

And add the following:

 v.vertex.xyz *= (1 + _Outline);

just before this multiplication in the code nearby:

 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);


<\br>Hope it helps! :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Chronos-L · May 31, 2013 at 02:29 PM

If I remember it correctly, the outline is created by moving each faces of the mesh away from the original position aligned to the face-normal, before it is rendered behind of your original mesh, so thicker outline means further away from the original face-position.

Orignal + DiOutline -> Outlined Object alt text

To get the real cartoonish full outline, a working way is to perform a dilation of the image and do some simple compositing:

Orignal + Tinted Dilation -> Outlined Object alt text

However, I did this in a photo editing software, and unfortunately I do not know how to do the dilation (2D image manipulation) in a 3D environment. This will be very useful if an efficient shader that can do the same is implemented, so far I do not manage to find to it. You can work on it if you want to, or else you will have to stay put with what is offered by the standard shader.


dilate.png (7.8 kB)
sim.png (27.9 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by legion_44 · May 31, 2013 at 03:36 PM

You can make other cube, scale this to be bigger than original, attach SkyBox shader to it, then change it color to ex. black and you have good looking outline. You can make it by script also.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tuni · May 31, 2013 at 04:06 PM 0
Share

This should work, but I prefer to use the toon shader. Is it a good idea to add the shader without outline to the original cube and place another cube with the outlines around the original?

But this wouldnt solve the problem that the top edge is not visible...

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Silhouette Toon Shader 0 Answers

Questions about the Toon/Basic Outline Shader 0 Answers

Toon shader shows outlines in editor, but not in game views 1 Answer

Toon Lit Outline Outline Transparent on Air 0 Answers

Reflective toon (outline+ramp) shader 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges