- Home /
 
               Question by 
               Przekopinator · Dec 29, 2016 at 08:31 AM · 
                unity 5shadershaderscel shadingcellshading  
              
 
              Single tone shadows in forward rendering
Hello, i am new to shaders but i want to achieve celshading toon effect with forward rendering (beacause I am using ortographic projection), I modified shader from here http://www.gamasutra.com/blogs/DavidLeon/20150702/247602/NextGen_Cel_Shading_in_Unity_5.php for it to accept multpile light sources, and here I stumbled upon new problem, every lightsource add a new shadow as I wanted, but shadows seem to add up.
 #pragma surface surf CelShadingForward fullforwardshadows 
     #pragma target 3.0
             
         float _Range;
 
         half4 LightingCelShadingForward(SurfaceOutput s, half3 lightDir, half atten) {
              
             half NdotL = (dot(s.Normal, lightDir)) * atten;
             half4 c;
             if (NdotL <= _Range){ NdotL = 0;
                     
             }
             else NdotL = 1;
                     
             if (s.Alpha < 0.01)discard;
             c.rgb =s.Albedo*(NdotL)*_LightColor0.rgb;;
             c.a = s.Alpha;
             return c;
         }
Is there a way to keep shaded areas in one "level of darkness"?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                