Unity 2019 lighting ambient color
Also, the edge between dark and light looks a bit sharp, but we'll deal with that later. This looks good, but the dark side is too dark right now it is completely black. NdotL is in the -1.1 range, so we transform it to be 0.1, and invert it so that the most illuminated surfaces map to the left of the texture, and the darkest to the right. We then sample the ramp texture with NdotL transformed to a UV coordinate that maps to the ramp, lightest to darkest. The simplest way to implement this is with a ramp texture. To render more than two bands of shading, we will need a function with more than two steps.
#Unity 2019 lighting ambient color code
Right now our line of code above using the ternary operator is a step function with two steps, light and dark. The amount of light is proportional to the direction, or normal of the surface with respect to the light direction. The first step is to calculate the amount of light received by the surface from the main directional light. To calculate our lighting, we will use a common shading model called Blinn-Phong, and apply some additional filters to give it a toon look. The first line requests some lighting data to be passed into our shader, while the second line further requests to restrict this data to only the main directional light. Add the following code at the top of the Pass, just after its opening curly brace. We will set up our shader to receive lighting data. However, as our shader will only interact with a single directional light, it will not be necessary to use surface shaders. Surface shaders use code generation to automate the object's interaction with lights and global illumination. When writing shaders in Unity that interact with lighting it is common to use Surface Shaders.