Search Unity

Transparent Cutout shader without light. With one render per triangle.

Discussion in 'Shaders' started by Santa, Oct 9, 2010.

  1. Santa

    Santa

    Joined:
    Dec 4, 2009
    Posts:
    42
    Hello,

    I'm trying to make an analog of built-in Transparent\Cutout\Diffuse shader without lighting. The reason to do it is to render each triangle in only one pass. But I couldn't quite understand how it works. I'm trying to do this:

    Code (csharp):
    1. Shader "Cutout Diffuse No Lighting" {
    2. Properties {
    3.     _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    4.     _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    5.         }
    6.  
    7. SubShader {
    8.     Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"}
    9.     Lighting off
    10.  
    11.     Pass {  
    12.                 AlphaTest Greater [_Cutoff]
    13.         SetTexture [_MainTex]
    14.         }
    15.     }
    16. }
    17.  
    But in "stats" amount of "tris" for the model is still double for the triangles count in the model.
    How it could be done to render cutout in one pass? Is it possible?
     
  2. Santa

    Santa

    Joined:
    Dec 4, 2009
    Posts:
    42
    Really no one knows?