I have been experimenting with shader forge for a bit, but, I cant seem to create lighting for an object that just calculates lighting attenuation and not shadows.
To be specific - When an object gets close to a light source it gets brighter (evenly across the entire surface), when it moves away it gets darker in the same manor.
I cant seem to get it right. Any ideas?
Replies
The code's in AutoLight.cginc...
Ok, so maybe I can use the custom code node in shaderforge and dump just the AutoLight.cginc code into it?
It should be obvious where the light and shadow values are gotten from, but be aware that they're nested in defines depending on the light and shadow types.
Hook both of those up to a distance node.
Divide that by a VALUE (// light range) node.
Plug that into a Power node A slot, and plug a new VALUE (// attenuation) into the B slot.
Multiply by Light Color
Clamp 0-1
Into Emission.
If you want it to take into account the curvature of the object...change the Object Position to World Position, and multiply by (DOT: Normal, Light Direction) at some point before the clamp.