I need a light that acts sort of like a directional light, except that the light always shines directly away from the Y axis.
(This is for a space colony sim; the colony is wrapped around the Y axis, so towards the Y axis is always “up”, and the lights on the ceiling would produce a diffuse light that always comes from that general direction.)
I can do the math… I’m just not sure where to put it.
I know I could make a custom shader that ignores actual lights in the scene and just computes how things would be lit based on the angle they make with the local up (i.e. -x, 0, -z) direction. But then I lose the benefits of the standard shaders. OK, but not ideal.
I found this thread describing custom point lights, but I’m struggling to understand what it does, much less how it works. It appears to use the new command buffers.
I was kind of hoping there was a third option, where I could hook into something and say “OK, at this point, the light is coming from this direction with that strength.” And then have everything else work as usual.
Assuming there is no such simple approach, does anybody know of a “bar” or “line” shaped light source that’s already written somewhere?
I don’t think so. The issue is that you can see for quite a distance in either direction, and things further up the “curve” of the floor should be lit from their up direction (which is always -x, 0, -z), not yours.
Otherwise I’d happily just use a directional light that always rotates to point at the player from the Y axis. But though I haven’t tried it, I’m pretty certain you would notice the light changing direction as you move around.
You can check out a webGL prototype of the environment here, if it’s still not clear what I’m trying to do.
Thanks, that looks promising. I think I’m going to have to set aside an afternoon at some point and learn command buffers — I can tell that it really will be a whole new superpower once I get the hang of them.
No shadows, no baking, and only works with the deferred rendering path.
If you’re using forward rendering the only option is a custom shader; it’s not possible to add new forward light types with a surface shader or the built in shaders.