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! :slight_smile:

alt text

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);

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.