- Home /
Reflection shader has inverse direction
I have this shader for mirror-like reflection. It works ok but for the reflection direction. If I apply this on a sphere and look at it, it should reflect what's behind me, however it "reflects" what's in front. If I uncomment the Matrix [_Reflection] line, it swaps the Y direction, however it's the Z direction that should be flipped.
Any ideas anyone? Thanks
Shader "Kweetet/Transparent/Unlit Reflective"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_MainTex ("Base (RGB)", 2D) = "white" { }
_Cube ("Reflection Cubemap", Cube) = "" { TexGen CubeReflect }
}
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
Color [_Color]
Lighting Off
SetTexture [_MainTex]
{
combine texture * primary
}
SetTexture [_MainTex]
{
constantColor [_Emission]
combine previous + constant
}
SetTexture [_Cube]
{
//Matrix [_Reflection]
combine texture * previous, previous
}
}
}
}
Answer by Croustibat · Nov 28, 2013 at 05:57 PM
up I've been messing with shaders all day long, I ended up with the same troubles too. If you already figured out how to solve that, please make me know!
Your answer
Follow this Question
Related Questions
Shadow Support in Custom Shader 0 Answers
How would I grab the lighting pass in a post process shader for deferred lighting? 0 Answers
Pass ShaderLab properties to Standard cginc 2 Answers
Shader compiler: internal error compiling shader snippet type=0 platform=0: 1 Answer
GL.lines Drawing over Objects 0 Answers