So I am trying to add some sliders to have more control over my shaders for each different mesh. I’m adding them to the Toon/Lighted Shader so I can control the ramp sizes.
For some reason though, it’s giving me an error saying that the variables do not exist. I put them there, so I’m not sure why it can’t access them. I am using Toon/Lighted Outline as the actual Shader, but I know the lighting is affected from this one. Could someone tell me whats up?
Shader "Toon/Lighted" {
Properties {
_Color ("Main Color", Color) = (0.5,0.5,0.5,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_Ramp ("Toon Ramp (RGB)", 2D) = "gray" {}
_LightSize ("Light Size", Range (0, 1)) = 0.75
_MidSize ("Mid Size", Range (0, 1)) = 0.75
_DarkSize ("Dark Size", Range (0, 1)) = 0.25
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf ToonRamp
sampler2D _Ramp;
#pragma lighting ToonRamp exclude_path:prepass
inline half4 LightingToonRamp (SurfaceOutput s, half3 lightDir, half atten)
{
#ifndef USING_DIRECTIONAL_LIGHT
lightDir = normalize(lightDir);
#endif
half d = dot (s.Normal, lightDir)*_LightSize + _MidSize + _DarkSize;
half3 ramp = tex2D (_Ramp, float2(d,d)).rgb;
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * ramp * (atten * 2);
c.a = 0;
return c;
}
The Inspector sprays them at you, hiding the original error, way up on top, which at least gives you a line number. Your
– Owen-Reynolds_darkSizelines near the top say to create a slider for_darkSizein the Inspector, but you never actually create a darksize. Notice how_Rampis also declared down below. Toss infloat _Darksize, _MidSize ...and it should work (or comment out a bunch and just try adding 1 darkSize by itself.)That worked, Owen. Thank you very much :).
– XatokuIt is working. No idea about the memory efficiency, but I never encountered any hiccups.
– ChernoThat's not an answer. Don't use an answer for a question, instead add a comment on the post your question is from.
– VoidChicken