Does anyone know how to make an outline shader that is affected by light? Basically what I mean is I want a material that makes a line on the outline darker depending on how far it is from the light source.
There are many ways to make an outline shader.
One is to have two versions of the mesh, with one inside out, and backfaces turned off. I guess you could give the outline material a translucent shader, might give the right result.
how might i do that?
Generally, you can’t light an outline shader (in a raytracer, without compositing tricks), mostly because doing so blocks light from reaching the interior (outlined) mesh.
Also, lighting depends heavily on normals, which aren’t a concept that make any sense with an outline mesh.
If you want, you can use outlining techniques with a camera-ray-only emissive shader that emits based on the distance to a light source. That’s not quite the same thing as a diffuse, which also uses surface normal to determine lighting. And it doesn’t give you occluding shadows. But it would make the outline change color based on light falloff from a single light source, which is what you say you want. (Trick: object coords from light -> dot product of itself -> pow 0.5 = distance from light.)
You could also composite two renders, one with an outline mesh visible to everything including lights, one with no outline mesh, and replace the first with the second if and only if an object index render showed both on the output. You’d get occlusion shadows that way, and you’d get normals, even though it wouldn’t really make any sense. (If you want to eliminate the contribution from normals while keeping occlusion, use a diffuse shader and set the normal from geometry/incoming.)
What is an “outline shader”? How would you construct such a thing? Scene lighting can only be accessed from within “shaders”. Using layer weight/facing will also let interior show through if the geometry is such. Using diffuse or glossy (reacts to lighting) based on that color may be possible, but unless you’re in Eevee with Shader2RGB, you can’t use it for anything like this.