Hi, I’ve pretty much zero knowledge on shaders, but I managed to cobble together a couple I found online.
The shader is working well until after I tried changing this:
o.Emission = texCUBE (_Cube, IN.worldRefl).rgb * 0.5;
to this:
o.Emission = texCUBE (_Cube, IN.worldRefl).rgb * _Reflectiveness;
The _Reflectiveness is always zero regardless of the amount I set on the material itself. What did I do wrong?
Full shader code below:
Shader "Custom/Mobile/Vertex Color Unlit Water" {
Properties {
_SColor ("Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
_Cube ("Cubemap", Cube) = "" {}
_Reflectiveness ("Reflection Amount", Range(0,1.0)) = 0.5
}
Category {
Tags { "Queue"="Geometry" }
Lighting Off
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
// ---- Dual texture cards
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float3 worldRefl;
};
samplerCUBE _Cube;
float3 _Reflectiveness;
void surf (Input IN, inout SurfaceOutput o) {
o.Emission = texCUBE (_Cube, IN.worldRefl).rgb * _Reflectiveness;
}
ENDCG
Pass {
Blend One One
SetTexture [_MainTex] {
matrix [_OffsetTex]
combine texture * primary
}
SetTexture [_MainTex] {
constantColor [_SColor]
combine previous lerp (previous) constant DOUBLE
}
}
}
// ---- Single texture cards (does not do vertex colors)
SubShader {
Pass {
SetTexture [_MainTex] {
matrix [_OffsetTex]
constantColor [_SColor]
combine texture lerp(texture) constant DOUBLE
}
}
}
}
}
Thanks!