Matrix [_Reflection] ? built-in variable ?

Hi,

I don’t get where the “_Reflection” is coming from in the glass example of the shaderlab doc : Unity - Manual: ShaderLab command: Blend

Thanks a lot
Vincent

That looks like it may be a typo… does it work if you rename it to reflections?

its defined in the properties and it generates a cubemap texture

Thanks for the quick answers, sorry for not being clear.

As you can see below there’s :
_Reflections (“Base (RGB) Gloss (A)”, Cube) = “skybox” { TexGen CubeReflect }

which is indeed defined in the properties, and used at the end in

SetTexture [_Reflections] {

but I was talking about

combine texture
Matrix [_Reflection]

just below.

I put this on a sphere with no script attached (so no _Reflection matrix defined), and it kind of inverts the texture.
If I put anything else than _Reflection (including _Reflections), the Matrix [ ] line has no effect

Just curious about that.

Shader "Glass" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB) Transparency (A)", 2D) = "white" {}
        _Reflections ("Base (RGB) Gloss (A)", Cube) = "skybox" { TexGen CubeReflect }
    }
    SubShader {
        Pass {
            Tags {"Queue" = "Transparent" }
            Blend SrcAlpha OneMinusSrcAlpha
            Material {
                Diffuse [_Color]
            }
            Lighting On
            SetTexture [_MainTex] {
                combine texture * primary double, texture * primary
            }
        }
        Pass {
            Blend One One
            Material {
                Diffuse [_Color]
            }
            Lighting On
            SetTexture [_Reflections] {
                combine texture
                Matrix [_Reflection]
            }
        }
    }
}

When I understand it right, the matrix is defined through the coordinate generation for cubemaps ( TexGen CubeReflect )

Thats similar to projectors that also generate specific data automatically that need to be used.

Thanks a lot, would be nice if it was in the docs!