Search Unity

Adding a texture to a custom shader

Discussion in 'Shaders' started by lukaspnilsson, Apr 2, 2020.

  1. lukaspnilsson

    lukaspnilsson

    Joined:
    Apr 2, 2020
    Posts:
    1
    Hi,

    I am simply trying to add a texture to a sphere that only shows when viewed through another shader that is viewed.

    When I add the image to the texture box, it only shows white on the sphere and not the image but the rendering works as intended.

    Code (CSharp):
    1. Shader "Custom/2"
    2. {
    3.     Properties
    4.     {
    5.          _MainTex ("Texture", 2D) = "bump" {}
    6.         [Enum(Equal,3,NotEqual,6)] _StencilTest ("Stencil Test", int) = 6
    7.     }
    8.     SubShader
    9.     {
    10.         //_MainTex;
    11.         Stencil
    12.         {
    13.             Ref 1
    14.             Comp [_StencilTest]
    15.         }
    16.         Pass
    17.         {
    18.          
    19.         }
    20.     }
    21. }
    22.  
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352