Hey everyone,
I am just starting on the whole custom shader thing, and while I try to wrap my head around this, I wanted to see if anyone could help me with generating a shader that has a spot for:
Color Texture map, Bump map, Spec map, and Glow map (Emissive/Self Illum? not sure which is analogous to Glow)
Basically what I’m looking for is a real simple Blinn setup like in Maya (without reflection etc of course, also in Maya the glow would be incandescence).
I have been looking in the forums/other sites but I can’t wrap my head around making File Input nodes, rather than some slider… I’m tired of seeing the defaults in Unity have JUST two of the four inputs I need.
Thanks for any help.
You should read the Shaderlab documentation, and then take a look at the source code for this shader. It is available in the shader source package at the top of this forum. Then look at how the channels of the two input textures are used to generate the final colour, and try and extend the other properties to use textures as you need.
Hey so this is what I have so far, but it has a problem after the first Pass.
Syntax error in Sagar: Bump at line 14
I am not sure why this is the case since the demos out there use this syntax.
Shader "Sagar" {
Properties {
_MainTex ("Diffuse", 2D) = "Diffuse" {}
_BumpMap ("Normal", 2D) = "Bump" {}
_SpecColor ("Spec", 2D) = "Spec" {}
_Emission ("Glow", 2D) = "Glow" {}
}
SubShader {
Pass {
Lighting Off
Material {
Diffuse [_MainTex]
Bump [_BumpMap]
Spec [_SpecColor]
Glow [_Emission]
}
SetTexture [_MainTex]
SetTexture [_BumpMap]
SetTexture [_SpecColor]
SetTexture [_Emission]
}
}
}
You could always just use the Self-Illum/Bump Spec shader… the spec map is stored in the diffuse texture’s alpha and the glow is stored in the bump texture’s alpha.
Yea it’s a good backup Ant, but the problem I have is that my Glow and SpecColor maps do have color in them, so they only turn out grayscale, unless there is a way to do this differently?
Thanks for this though, at least I have something now.