Search Unity

Mobile CutOut and Emission shader

Discussion in 'Shaders' started by SnaiperoG, Oct 30, 2018.

  1. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Hello, i'm currently developing a mobile game and i need 2 shaders for it, but i'm bad at shaders. 1: mobile cutout shader, 2: mobile emission shader.

    I've found a cutout shader, it works well, but i need add to it property to apply a lightmap for static objects and light probe for dynamic.
    Code (Boo):
    1.  
    2. Shader "Custom/MobileCutOut" {
    3.  
    4.     Properties
    5.     {
    6.  
    7.         _Cutoff("Alpha Cutoff" , Range(0, 1)) = .5
    8.         _MainTex("Texture", 2D) = ""
    9.     }
    10.  
    11.         SubShader
    12.     {
    13.         Alphatest Greater[_Cutoff]
    14.         Cull Off
    15.  
    16.  
    17.         BindChannels
    18.     {
    19.         Bind "vertex", vertex
    20.         Bind "color", color
    21.         Bind "texcoord1", texcoord
    22.     }
    23.  
    24.         Pass
    25.     {
    26.         SetTexture[_MainTex]{ Combine texture, texture * primary }
    27.     }
    28.     }
    29. }
    And how to write a emission shader i completely don't know. What i need: put 2 textures to it, 1st: diffuse texture, 2nd: emission texture (where colors - light, and black - no light). And like previos lightmaps and light probes. Can someone help me?