Search Unity

Transparent Cutout Diffuse with Alpha?

Discussion in 'Shaders' started by mattbrand, Nov 29, 2011.

  1. mattbrand

    mattbrand

    Joined:
    Jan 16, 2011
    Posts:
    98
    Hey all. I'm relatively new to shaders, so please forgive any ignorance.

    I'm working with a 2D sidescrolling platformer that uses 3D assets. We use the transparent/cutout/diffuse shader because just using the transparent/diffuse shows the geometry through the textures. The cutout gives the characters the look that we want.

    My issue is that I have a short cut scene that involves stills of the characters fading in and out. I am doing this by modifying the alpha values of the renderer.material.colors. But this, of course, doesn't work with the transparent/cutout/diffuse shader. I've tried many other stock shaders, and don't get the look we want, or alpha doesn't work.

    Anyone have suggestions?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    cutout is an alpha based effect, thats why it does not work.

    you would need to create a new shader that has cutout and uses vertex colors and then change the mesh color basically for the fading as the texture alpha is 'locked' to the cutout (not exactly locked but you will not get a smooth fading as any alpha below the value you set will just be cut
     
  3. mattbrand

    mattbrand

    Joined:
    Jan 16, 2011
    Posts:
    98
    Great, thanks so much! :)
     
  4. Ajes

    Ajes

    Joined:
    Sep 13, 2013
    Posts:
    26
    this is exactly what I have been looking for.. Does anyone have an example or something? I've tried over 30 downloaded shaders, that almost do it..

    its the inbuildt "transparent cutout diffuse" I need, with a possibility to change the mesh color on "generating the mesh" ..