Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5 - Shader( matrix [_Projector] ) SOLVED

Discussion in 'Shaders' started by PCmaniak, Apr 21, 2015.

  1. PCmaniak

    PCmaniak

    Joined:
    Mar 26, 2014
    Posts:
    6
    Hello to the projection texture I used this shader that I found on the internet ...
    It worked well.. but with the advent Unity5 is the function matrix [_projector] does not work = (

    Can anyone help me fix this shader? Thanks ;)

    Shader "Projector/Texture"
    {
    Properties
    {
    _Color ("Main Color", Color) = (1,1,1,1)
    _ShadowTex ("Cookie", 2D) = "gray" {}
    }

    Subshader
    {
    Tags { "RenderType" = "Transparent" "Queue" = "Transparent-1" }
    Pass
    {

    ZWrite Off
    Lighting Off
    Fog { Color (0, 0, 0, 0) }
    ColorMask RGB
    Blend SrcAlpha OneMinusSrcAlpha
    Offset -1, -1
    Color [_Color]

    SetTexture [_ShadowTex]
    {
    combine texture * primary
    Matrix [_Projector]
    }
    }
    }
    }
     

    Attached Files:

  2. PCmaniak

    PCmaniak

    Joined:
    Mar 26, 2014
    Posts:
    6
    nobody ? :-/
     
  3. mholub

    mholub

    Joined:
    Oct 3, 2012
    Posts:
    123
    I don't have Unity4 to test how it should work.
    Is it what you need?
     

    Attached Files:

    PCmaniak likes this.
  4. PCmaniak

    PCmaniak

    Joined:
    Mar 26, 2014
    Posts:
    6
    aaa THANKS YOU! works perfectly! =)
     
  5. xuanyuan

    xuanyuan

    Joined:
    Jul 14, 2015
    Posts:
    1
    Shader "Hidden/PreviewT4M"
    {
    Properties
    {
    _Transp ("Transparency", Range(0,1)) = 1
    _MainTex ("Texture", 2D) = "" { }
    _MaskTex ("Mask (RGB) Trans (A)", 2D) = "" { TexGen ObjectLinear }
    }
    SubShader
    {
    Pass
    {
    Blend SrcAlpha OneMinusSrcAlpha
    SetTexture [_MainTex]
    SetTexture [_MaskTex]
    {
    constantColor (1,1,1,[_Transp])
    combine previous ,
    texture* constant
    Matrix [_Projector]
    }
    }
    }
    }

    The shader does not work!Could you help me to modify it?