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 psdev · Apr 21, 2011 at 01:14 AM · alphaitweenfadetoonshading

How do I fade out a Toon shaded character with iTween?

I have a null (empty) GameObject that is the parent of a Character with a skeleton and 2 meshes (one for body and one for wings) and alot of Toon shaded materials.

How can I use iTween (or something else) to simply fade out the entire character as one thing?

At the moment I'm trying:

iTween.FadeUpdate(myCharacter,iTween.Hash("alpha", 0.0f,"time", 2.0f,"includeChildren",true));

and it doesn't work - I've also tried .FadeTo (it only happens on a particular input - that's why it's in the Update).

I read here that the material needs to be Transparent/Diffuse, but I need Toon shaded characters for my look. Surely there is a way to do this?

thanks :)

.

UPDATE TO QUESTION: (attachments don't work in comments so I'm editing here)

Hi - very sorry for the delay in replying, hopefully you don't mind replying and elaborating on your answer.

I am using Toon Basic and Toon Lighted for a select few surfaces.
For Toon Lighted it doesn't work, it just turns the surface pink entirely when that "Blend" line is there.

And when I tried adding the "Blend" line after the ENDCG in the Toon Basic it DOES work - although not as I expected. See this attached image with alpha set to 50%:

It seems like I don't want a 3D surface fade, but rather a hidden occluded fade if that makes sense? I think I don't want internal or back facing polygons to be faded, but just front facing polys to be faded - i.e. as if it was a 2D sprite collapsed and then faded. Is that possible? thanks for your help! :)

alt text

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

1 Reply

· Add your reply
  • Sort: 
avatar image
3

Answer by Cyb3rManiak · Apr 21, 2011 at 10:03 AM

There is, but you're not going to like it... :) You need to edit the toon shader. If you're using the basic shader - you only need to do one little tweak - Add the line:

Blend SrcAlpha OneMinusSrcAlpha

right after ENDCG, so it will look like this:

float4 frag (v2f i) : COLOR { float4 col = _Color * tex2D(_MainTex, i.texcoord); float4 cube = texCUBE(_ToonShade, i.cubenormal); return float4(2.0f * cube.rgb * col.rgb, col.a); } ENDCG

Blend SrcAlpha OneMinusSrcAlpha

After this change, the alpha value of _Color (which is the main color you tweak in the inspector) will determine how transparent the object is. I tested it on my workstation and it works.

Now, obviously this is not perfect. For example I would change the RenderType property from Opaque to Transparent, and I would edit the lower part of the shader and make sure that if some graphic card falls back to the lower subshader - it will still work.

If you can tell us which of the toon shaders your using, I imagine someone here with more experience with shaders can help you change the shader in the best way possible.

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 psdev · May 19, 2011 at 02:50 AM 0
Share

thanks for your answer. :) I've updated my question with your suggestion - can you please advise?

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

1 Person is following this question.

avatar image

Related Questions

Is there a simple way of fading a Texture2D 1 Answer

Fade Shader- One texture fades in, the other fades out 2 Answers

Fading Objects does not work (Unity 5) 0 Answers

Fading all but single instance of a button 1 Answer

iTween FadeTo() problem 1 Answer


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