New LightType
Posted: Sat Jan 01, 2011 9:49 am
Currently Ogre defines 3 Light types,
LT_POINT Point light sources give off light equally in all directions, so require only position not direction.
LT_DIRECTIONAL Directional lights simulate parallel light beams from a distant source, hence have direction but no position.
LT_SPOTLIGHT Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff.
I was recently trying to apply a light to my terrain which would create a gradient from dark in the valleys to bright at the top of the hills and mountains. I realized none of the existing lights could do this. My somewhat messy solution will likely involve a large number of Directional lights and lightMasks. But it gave me an idea for a new light type which could avoid this issue in the future. Call it 'Gradient Light" if you like, it would simply be a combination of Directional and Spotlight, having the infinite planar and parallel rays of Directional light along with the position and Attenuation of a Spotlight. The light intensity at a point is simply the distance to the plane modified by attenuation. Alternatively Directional light could be able to receive attenuation and position (with the default being none thus maintaining the present behavior), though I suspect this might not be possible given the likely implementation of Directional light.
I'm not sure how much effort is involved in writing a new light type but I figured if I found a need for something like this then others would too and some one out their might be inspired in to give it a try.
LT_POINT Point light sources give off light equally in all directions, so require only position not direction.
LT_DIRECTIONAL Directional lights simulate parallel light beams from a distant source, hence have direction but no position.
LT_SPOTLIGHT Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff.
I was recently trying to apply a light to my terrain which would create a gradient from dark in the valleys to bright at the top of the hills and mountains. I realized none of the existing lights could do this. My somewhat messy solution will likely involve a large number of Directional lights and lightMasks. But it gave me an idea for a new light type which could avoid this issue in the future. Call it 'Gradient Light" if you like, it would simply be a combination of Directional and Spotlight, having the infinite planar and parallel rays of Directional light along with the position and Attenuation of a Spotlight. The light intensity at a point is simply the distance to the plane modified by attenuation. Alternatively Directional light could be able to receive attenuation and position (with the default being none thus maintaining the present behavior), though I suspect this might not be possible given the likely implementation of Directional light.
I'm not sure how much effort is involved in writing a new light type but I figured if I found a need for something like this then others would too and some one out their might be inspired in to give it a try.