Lighting an irregular object?

Here’s one I can’t think of an easy way around.

Imagine a top down solar system. I have some rotating planets, over which I draw a kind of highlight mask, so I can produce the effect of the sun lighting the side of the planets facing the sun. It looks pretty good, even if I do say so myself!

But I’d like to do the same with some irregular shaped objects, for the sake of argument imagine a cone shape which is rotating, or tumbling. How would apply a a brightness mask without the mask lighting an object drawn underneath it? It’s impossible to make a mask for every possible position/rotation of the object.

The only way I can think of doing this is to render the object and highlight to a Render Target then draw the result, but then I get into the performance problems discussed in another post.

Can anyone suggest another way to achieve what I’m thinking of?

I hope I’ve explained this well enough.

It’s definitely easiest to do lighting in 3d. You’ll want your shapes to have normals so you can do some basic lighting in a shader.

You can use the built in BasicEffect or write your own. If you never wrote a shader and aren’t eager to start learning that I recommend you find some BasicEffect samples and try that. It should be more than enough for your purposes.

If you want to write it yourself, the basics are pretty simple and there are a bunch a of resources out there. If you don’t know where to start, I’m sure there are people on the forum that can help you on your way :slight_smile: