Well, this is, for some one who interest in baking art and wonder about the weakness of lightmapper, that the fact is black multiply texture.
This is the issue of current lightmapper
Well, we lose the glow/exposure point that make scene really dull.
So I decide to make a mod to current lightmapper shader, add a exposure control texture. You will see the different here
New Lightmapper
Shader "Lightmapped/DiffuseMod" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_LightMap ("Lightmap (RGB)", 2D) = "black" {}
_LightMap2 ("Exposure map (RGB)", 2D) = "black" {}
}
SubShader {
UsePass "Lightmapped/VertexLitMod/BASE"
UsePass "Diffuse/PPL"
}
FallBack "Lightmapped/VertexLit", 1
}
New lightmapper Dependency
Shader "Lightmapped/VertexLitMod" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
_LightMap ("Lightmap (RGB)", 2D) = "black" {}
_LightMap2 ("Lightmap (RGB)", 2D) = "black" {}
}
// ------------------------------------------------------------------
// Three texture cards (Radeons, GeForce3/4Ti and up)
SubShader {
Blend AppSrcAdd AppDstAdd
Fog { Color [_AddFog] }
// Ambient pass
Pass {
Name "BASE"
Tags {"LightMode" = "PixelOrNone"}
Color [_PPLAmbient]
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
Bind "texcoord", texcoord1 // lightmap uses 2nd uv
Bind "texcoord1", texcoord2 // main uses 1st uv
}
SetTexture [_LightMap] {
constantColor [_Color]
combine texture * constant
}
SetTexture [_MainTex] {
constantColor [_Color]
combine texture * previous
}
SetTexture [_LightMap2] {
constantColor [_Color]
combine texture + previous
}
}
// Vertex lights
Pass {
Name "BASE"
Tags {"LightMode" = "Vertex"}
Material {
Diffuse [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
}
Lighting On
SeparateSpecular On
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
Bind "texcoord1", texcoord1 // lightmap uses 2nd uv
Bind "texcoord", texcoord2 // main uses 1st uv
}
SetTexture [_LightMap] {
constantColor [_Color]
combine texture * constant
}
SetTexture [_LightMap] {
constantColor (0.5,0.5,0.5,0.5)
combine previous * constant + primary
}
SetTexture [_MainTex] {
combine texture * previous DOUBLE, texture * primary
}
}
}
// ------------------------------------------------------------------
// Dual texture cards - draw in two passes
SubShader {
Blend AppSrcAdd AppDstAdd
Fog { Color [_AddFog] }
// Always drawn base pass: texture * lightmap
Pass {
Name "BASE"
Tags {"LightMode" = "Always"}
Color [_PPLAmbient]
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
Bind "texcoord", texcoord1 // main uses 1st uv
}
SetTexture [_LightMap] {
constantColor [_Color]
combine texture * constant
}
SetTexture [_MainTex] {
combine texture * previous, texture * primary
}
}
// Vertex lights: add lighting on top of base pass
Pass {
Name "BASE"
Tags {"LightMode" = "Vertex"}
Material {
Diffuse [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
}
Lighting On
SeparateSpecular On
ColorMask RGB
SetTexture [_MainTex] {
combine texture * primary DOUBLE, texture
}
}
}
// ------------------------------------------------------------------
// Single texture cards - lightmap and texture in two passes; no lighting
SubShader {
Blend AppSrcAdd AppDstAdd
Fog { Color [_AddFog] }
// Base pass: lightmap
Pass {
Name "BASE"
Tags {"LightMode" = "Always"}
BindChannels {
Bind "Vertex", vertex
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
}
SetTexture [_LightMap] { constantColor [_Color] combine texture * constant }
}
// Second pass: modulate with texture
Pass {
Name "BASE"
Tags {"LightMode" = "Always"}
BindChannels {
Bind "Vertex", vertex
Bind "texcoord", texcoord0 // main uses 1st uv
}
Blend Zero SrcColor
SetTexture [_MainTex] { combine texture }
}
}
Fallback "VertexLit", 1
}
And this is texture sample for lightmap and exposure slot
Now I think I can not do anything more because of lacking knowledge. :? . These thing need to be done:
- Add a control brightness and contrast for exposure texture. This will save tone of time open back and forth PS for editing picture. However, If, this affect much to FPS ?
- Fix code with the following
Vertex lights
Dual texture cards - draw in two passes
Single texture cards - lightmap and texture in two passes; no lighting - A simpler work flow for generate these kind of texture !!!