- Home /
 
               Question by 
               oliver-jones · Aug 19, 2015 at 05:02 PM · 
                shadertexturematerial  
              
 
              Cheapest Way to Render Texture on Quad
Hello,
Just a quick question; Using materials and shaders, I would like to know the cheapest way to show a texture2D on a quad.
I'm currently using NGUI's 'Unlit/Texture', for textures without an alpha.
And a custom one I found on the internet for textures with alphas (allows me to fade too):
 Shader "Unlit/UnlitAlphaWithFade" 
 {
     Properties 
     {
         //_Color ("Color Tint", Color) = (1,1,1,1)    
         _Color ("Main Color", Color) = (1,1,1,1)    
         _MainTex ("Base (RGB) Alpha (A)", 2D) = "white"
     }
 
     Category 
     {
         Lighting Off
         ZWrite Off
                 //ZWrite On  // uncomment if you have problems like the sprite disappear in some rotations.
         Cull back
         Blend SrcAlpha OneMinusSrcAlpha
                 //AlphaTest Greater 0.001  // uncomment if you have problems like the sprites or 3d text have white quads instead of alpha pixels.
         Tags {Queue=Transparent}
 
         SubShader 
         {
 
                Pass 
                {
                 SetTexture [_MainTex] 
                 {
                     constantColor [_Color]
                        Combine Texture * constant
                 }
             }
         }
     }
 }
               Comment
              
 
               
              Those are already pretty fast solutions. Not sure if you'll notice a difference, but you can try using cg ins$$anonymous$$d of fixed functions. For a good starting point look at: http://wiki.unity3d.com/index.php/Vertex/Fragment_Template
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                