- Home /
Question by
Predominant · Jan 12, 2014 at 11:16 AM ·
shadermesh color
Shader Shininess based on vertex color
Hey,
So I have a sphere thats deformed somewhat, and I use a vertex shader to set colors on the mesh, and have it render certain colors based on the offset from the center of the sphere.
What I'd like to do now is change the Shininess based on the color set to the vertex, or to set shininess through a C# script that handles terrain painting.
Is this possible? Does anyone have any samples on how I would allocate shininess based on other factors on a vertex basis?
Example so far:
Simple Vertex Color Shader that I am using:
Shader "VertexColor" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_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 {
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
ColorMaterial AmbientAndDiffuse
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {
Combine texture * primary, texture * primary
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant DOUBLE, previous * constant
}
}
}
Fallback " VertexLit", 1
}
screenshot.461.png
(128.3 kB)
Comment