How to add light maps to a custom Rflection shader
I am a total beginner when it comes to shaders\Programing in unity and i need this shader to recive lightmaps since it is for a mobile game project :| i want to have a floor reflection but it needs to look nice too with the light maps! And since i can't find anything about it on the damn google o.O i wanted to ask here for help !
This is the shader :
Shader "Mobile/PlanarReflection" { Properties { _MainAlpha("MainAlpha", Range(0, 1)) = 1 _ReflectionAlpha("ReflectionAlpha", Range(0, 1)) = 1 _MainTex ("MainTex (RGBA)", 2D) = "" [HideInInspector]_ReflectionTex ("ReflectionTex", 2D) = "white" { TexGen ObjectLinear } }
Subshader
{
CGPROGRAM
#pragma surface surf Lambert
float _MainAlpha;
float _ReflectionAlpha;
sampler2D _MainTex;
sampler2D _ReflectionTex;
struct Input
{
float2 uv_MainTex;
float4 screenPos;
};
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 main_Tex = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = main_Tex.rgb * _MainAlpha;
o.Emission = tex2D(_ReflectionTex, IN.screenPos.xy / IN.screenPos.w).rgb * _ReflectionAlpha * main_Tex.a;
}
ENDCG
}
Fallback "Diffuse"
}
Your answer
Follow this Question
Related Questions
Vertex and Fragment shader with vertex displacement *and* shadows 1 Answer
Inverted Depth Map (Draw farthest geometry over closest) 0 Answers
Custom Outline Shader acting weird on iOS builds. 1 Answer
Is it possible to read an image made up of vertex positions and use those positions 0 Answers
How do I generate and compile a compute shader in the editor? 0 Answers