- Home /
Use Reflection Map with Vertex Colors?
Hi, I am a new Unity user. I have a model that I baked Ambient Occlusion to Vertex Colors from within Blender. Since my model is supposed to be sort of plastic, I have created a cube map (in Unity). The problem is, I cannot mix a Reflection shader with the "Mobile>Vertex Colored" shader. I heard that ShaderLab is the way to go, so I tried it, but I can never mix the two! Des anyone know how to mix the two shaders so I can use Vertex Colors and reflection map?
GREAT THANKS in advance. ;)
Answer by OP_toss · Aug 16, 2013 at 01:20 AM
Here's a vertex-lit shader from Unity docs. Note that "primary" is the vertex color.
Shader "VertexLit" {
Properties {
_Color ("Main Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {
Combine texture * primary DOUBLE, texture * primary
}
}
}
}
And here's code from Unity docs for adding a reflection map using ShaderLab:
//in properties
_Reflections ("Base (RGB) Gloss (A)", Cube) = "skybox" { TexGen CubeReflect }
//in pass
SetTexture [_Reflections] {
combine texture
Matrix [_Reflection]
}
You should be able to strip out the stuff you don't want from the shader (spec, ambient, emission, etc).
Please check docs before asking questions. Hope this helps.
Thanks! Ins$$anonymous$$d of using the Vertex Lit shader, I used the $$anonymous$$obile Vertex Colored shader. :)