We like to have a pointlight per character, that only lights that specific character, to get a nice “light from above” kind of look.
I can get this to work by assigning each character to a different layer, and using the light’s culling mask, but I was wondering if there is a better way to do it.
I might want to have more than 32 characters for instance, or I might at some point need my 32 layers for something else.
Hmm, yeah, that could work. I would like to use a directional light in the scene as well, but maybe I can just hardcode the direction of that light in the pixelshader, and have only one “unity light”.
note to self: try to grab aras during unite to talk about most suited lighting model.
If all characters have a single light above them, with fixed position with respect to the character, then yeah, hardcoding lighting from that light directly in the shader would probably be best. This way you can even use fancy lighting models, like Trilights for example.
I think all characters will have one, but the art dudes will love to be able to specify different positions. (our HUGE stone monster will need its light higher than our regular warriors). However, I can probably pass that sort of limited parameterability (lets make that a word), trough shader constants. as well as color maybe… hmmm…
I’ll defenitely try some of tom forsyth’s described lighting models though. Sounds a lot easier to make something look right than any other method I know of.
I still think hardcoding that light into shader is the best approach. For the material, expose a vector4 that is tweakable for the light position (relative to something), and do direct calculation in the shader.