Game Development Community

Near attenuation on spotlights

by John Doppler Schiff · in Torque Game Engine Advanced · 07/01/2008 (7:35 am) · 2 replies

Hi folks,
I've got a character with a dynamic spotlight mounted on her head. Works great, except when the player gets too close to a wall; then, rather than getting brighter as a real flashlight would, the lighting fades to zero.

I suspect there's some sort of near attenuation setting, but I can't seem to find it in the datablock.

Can anyone point me in the right direction?

Thanks,

-- JohnDopp

#1
07/01/2008 (8:36 am)
Spotlights in TGEA are done using a volume texture that is shaped according to the chosen lighting model. Unfortunately, the algorithm that creates these volume textures does not light the voxels all the way up to the origin of the light and this creates a sudden dropoff artifact near the light origin. The artifact gets worse as you increase the light radius. I think this is what you are observing.

See the image below of a cross-section of the volume texture for the Original Advanced lighting model. Notice the row of black voxels to the right of the green dot which marks the origin of the light.

arcane-fx.com/visuals/forums_pics/spotmap_crosssection.jpg
A quick fix for this might be to offset the spotlight backwards a bit from where it's attached to the player.
#2
07/02/2008 (3:50 pm)
That's spot on, Jeff! Er, no pun intended. =)

Decreasing the radius and offsetting the source works great, as long as volume textures aren't enabled.

Thanks for the help!