Hi guys,
I’m starting to get a grasp of the shader side of things but I was hoping someone could help me with this.
I managed to get this simple reflective shader together for an iPhone project, but I can’t seem to get the tint to have any effect.
Shader "My Shaders/UnlitReflective" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_EnvMap ("EnvMap", 2D) = "black" { TexGen SphereMap }
}
SubShader {
// Base pass: Reflection
Pass {
Name "REFLECT"
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
}
SetTexture [_EnvMap] {
combine texture
}
}
// Second pass: Base
Pass {
Name "BASE"
BindChannels {
Bind "Vertex", vertex
Bind "texcoord", texcoord0 // main uses 1st uv
}
Blend One OneMinusDstColor
Fog { Color (0,0,0,0) }
SetTexture [_MainTex] { combine texture }
}
}
}
Can anyone see why the tint might not be working here?
Are you using a different version? That last line doesn’t compile. You need two passes in the fixed function pipeline, to get your exact results, but do you need the texture for anything else? If you can just adjust it in Photoshop, you can do this in one pass. (The adjustment is to duplicate the texture, invert it, and then multiply the inverted version with the original.)
Not sure why it doesn’t compile for you. I have the second pass because I wanted to have a base texture, then a tinted reflection over that. I wanted to be able to change the tint on the fly.
Hey Jessy,
I just put your code in a shader and it works great. Weird, I thought you would have to separate reflection and base texture into passes. Tint still works fine in yours too
Thanks
Pete