having a light only affect one object.

Hey.

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.

Thanks, Lucas

Just a suggestion but you could Lightmap them (then you wouldn’t need all those lights).

The characters are normalmapped. So the dynamic light really makes their detailedness come out as the characters animate.

Bye, Lucas

How about just having all the characters in one layer, and putting a number-of-lights limit to 1? Depending on the setup, it could work.

d.

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.

Bye, Lucas

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.

Bye, Lucas

Maybe I’m missing something, but wouldn’t a directional light work for this? That way you’d just need one light for an unlimited number of characters.

–Eric

maybe 1 directional light could do the trick. I think the art guys would like the light to always “hang in front of” the character though.

Bye, Lucas

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.