Problems with lighting low polygon models

The example spotlight from disco is jaggedy even when the Exponent is set at 128.

Is there any way to make the spotlight’s illuminated area a finer circle?

I tried making a point light just above the tutorial with the “model/environment” and the panda pacing back and forth in the environment. When light rendered on the floor, it does not render as a circle but instead lights up the entire square. I suspect that this is due to the environment model’s floor being created as a single polygon.

Is there any way to create lighting that spreads and fades in a circular manner on low-polygon models?

Thanks so much, i’ve been working on this for about a week and i really cant find a solution.

The easiest solution is not to use low-polygon models. Add a bunch more vertices to your floor and to your wall, and the spotlight and the point light will look great. Modern graphics cards can handle thousands of vertices per model with no sweat; in fact, they prefer it to having only a few dozen vertices per model.

There are other solutions that are less excellent. One is to fake it with texture: you can get a decent spot cone effect using projective texturing. Project a white circle onto your polygon from the point of view of the spotlight. NodePath.projectTexture() wll do this almost automatically. This works, and can give a good convincing effect, but requires some by-hand finesse to handle low-poly and hi-poly models differently.

Another solution is to write a custom shader to perform the lighting calculation on a per-pixel basis rather than on a per-vertex basis–but simply adding more vertices would probably be easier, and would render faster.


So does that mean when using per-pixel based shaders, they are going to take longer to render and load as opposed to a per-vertex shader?

Im wondering since my load times are still long since Ive reduced the polys on my models (say from 120,000 to 25,000) but kept the per-pixel shader I was using. Could the per-pixel shader be the cause of the continued load times? Thanks.

Pixel shaders are not inherently expensive, but the lighting calculation is not trivial. It requires less computation to perform the lighting calculation once at each vertex and linearly blend the result at each pixel, than it does to perform the lighting calculation once at each pixel. So it follows that if you write a pixel shader to perform the lighting calculation at each pixel, it will have to do more (and hence render more slowly) than the default fixed-function pipeline, which performs the lighting calculation only per each vertex.

That’s not meant to suggest that simply having a pixel shader at all will render more slowly than the default fixed-function pipeline. It all depends on the shader you write. Some shaders may render more quickly than the default pipeline.

None of this has much to do with load time, however.