New LightType

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
Posts: 15
Joined: Sat Feb 27, 2010 7:42 am

New LightType

Post by ImpalerWrG »

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.
Companions the creator seeks, not corpses, not herds and believers. Fellow creators, the creator seeks - those who write new values on new tablets. Companions the creator seeks, and fellow harvesters; for everything about him is ripe for the harvest.

Google Summer of Code Student
Google Summer of Code Student
Posts: 997
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 48

Re: New LightType

Post by Crashy »

When this comes to this type of things, do it yourself using shaders.

Even if such a light type would be added to Ogre, this is not a behaviour supported by the fixed pipeline, so a custom shader is needed.
Follow la Moustache on Twitter or on Facebook

User avatar
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
x 10

Re: New LightType

Post by lordsme »

I Think that this could be done using a large area light and the normal distance attenuation...
I'm looking for a way to implement area lights in OGRE: look at my thread if you want
My Portfolio

MESH - Mise-en-scene Helper

ASALab @ Virtual Reality & Multimedia Park

User avatar
Ogre Magi
Posts: 1142
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 61

Re: New LightType

Post by Zonder »

Sounds more like you need a lightmap to me
There are 10 types of people in the world: Those who understand binary, and those who don't...

Post Reply