- Home /
Question by
Paulius-Liekis · May 19, 2013 at 07:21 PM ·
lightmapshadowsurfacesurfaceshaderlighting-model
Lightmapped object in Surface-shader
Hi,
It looks like my lighting model is ignored when an object has a lightmap. Is there are way to control how lightmap is blended with other stuff when using Surface-shader?
What I mean is if you do this (taken from Unity examples):
Shader "Example/Diffuse Texture" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf SimpleLambert
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) {
half NdotL = dot (s.Normal, lightDir);
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten * 2);
c.a = s.Alpha;
return c;
}
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Fallback "Diffuse"
}
LightingSimpleLambert is completely ignored on lightmapped objects? How do I control the strength of lightmap in the surface shader?
Comment
Your answer
Follow this Question
Related Questions
Gun goes black... 1 Answer
Best lightmapping wierd soft shadows 0 Answers
Disable Lightmap when baked lights turn off 0 Answers
Baked + Real-Time Shadows 6 Answers
Have only "Near" lightmaps 1 Answer