Spotlights

http://evilman.netfirms.com/spot.jpg

How can I prevent this?

Actually this isn’t about spotlights, it’s more of a diffuse point light thing, but still.

Also, how does one go about calculating a larger area light (instead of the dull one infinitely small point light)?

Thanks.

And yeah, I could spend some time searching google, but I figured I’d ask here first, since you all are so smart.

Oh, and yes all of that in the screen shot is being calculated per-pixel (the vertex program is only passing variant data and transforming vertices).

This is a common problem, your light is too close to your surface. The solution I think is to give your light some dimension and don’t allow it closer than that to the surface. The real world does not have infinitely small lights and small lights tend to attenuate quickly but can be seen to produce the effect you have, although normally this question is posted without the spotlight cutoff and you get a very bright small point around the light which falls off rapidly. In your case turning off the L.N back side bump illumination clamp might also improve things a bit, but lifting the light is the more correct solution.

I believe that’s actually what it’s supposed to look like. Note that the the same light flux disperses over a wider area that far from the source.

Raise your spotlight a little bit above the surface if you want a more even distribution of light power (i e, make the difference in flux/area smaller :slight_smile:

I can’t really see what the problem is in the image you posted ( likely my dark monitor ). If the problem is with lights too close to surfaces appearing too dim, you could add some ambient light ( a per-light term ). To make this look good, you need to shine directly at the bumps ( an idea I got from one of Carmacks speeches, at least my interpretation of it ).

Now that I come to think of it, I think I know what you mean. The ambient light trick I mentioned above will work ( I have used this for quite a while now ).
What dorbie mentioned is what I used to do but it’s not a very good solution and won’t help much with spotlights.

A better solution would be to look into a special cubemap ( per-light shape/type ) that stores the ambient/diffuse light. You could use some advanced techniques to compute these per-light cubemaps ( offline of course ).
This one I haven’t tried but it’ll give you a more correct solution.

The cubemap idea sounds interesting, but using any kind of texture like that (other than the normal map - which is easier to get precision back on) will result in precision loss, at least 'til I get some kind of floating point texture access.

I think it’ll work nicely for ambient/diffuse lighting without floating point. Of course it would be much better with a high precision normal map ( used to look into the cubemap ) but normally mostly specular suffers from (noticable) precision problems. I’ll give it a try later and see how good/bad it looks.

Oh, and the nice thing about this technique is that it can be implemented as an improvement for better cards, with the “shining directly at the bumps” as the fallback for older, less capable cards.