# Brighter lights and more attenuation

I read this post from back in October, http://forum.otee.dk/viewtopic.php?t=826, and it leaves me with 2 related questions:

1. Is there any way to make a light brighter without having to go into the code every time? Can we just have a little “brightness” box that we can crank up as high as we like?

2. Second, can we also choose to attenuate the light a lot more? For instance, a bright light on the wall still floods far too much of the room with light for the effect we’re trying to achieve. For example, could we just use a begin falloff radius and total falloff radius? We could also then tell the light to fall off linearly or exponentially.

Again, we could just combine multiplie lights to work towards the same solution, but that seems inefficient–and going into a script every time we need to adjust a light also seems really tedious. Perhaps this belongs more in the “request” section, but I’m hopeful there’s already a way to do it, and I just haven’t figured it out yet.

Can’t you just increase the range value in a textbox in the inspector?

Since it diminishes in brightness the further you are away from the light, increasing the range makes more of it the centre brightness, if you know what I mean.

I think he explains why that is the opposite of what he’s looking for in #2 there… He’s asking for a brighter light and a quicker falloff.

I think using Aarku’s script solution isn’t too much of a pain… Just add this to the lights and you can still adjust the parameters in the Inspector. Bump the RGB past 1.0 and you should get brighter lights while maintaining small ranges.

``````var lightColorR = 1.0;
var lightColorG = 1.0;
var lightColorB = 1.0;
var lightColorA = 1.0;

function Awake ()
{
color = new Color(lightColorR,lightColorG,lightColorB,lightColorA);
light.color = color;
}
``````

Well, increasing the range value basically just stretches the light over a great distance. The light itself still only has a fixed maximum brightness (without scripting), which is much less than the kind of intensity we would like for a high-contrast dungeon scene.

But the second problem is that whatever you set the attenuation range to isn’t really the light’s maximum range. The light will still extend beyond that range, far more than we would like, leaving the dungeon very evenly lit.

We want very bright patches around the torches, but very dark areas in the corners and crannies. It’s a tough effect to achieve regardless, but it’s much easier if you can brighten and attenuate the lights more precisely–and without resorting to scripting.

Here’s the screenshot from our Unity testing so far–and the screenshot from our old engine that we’re basically trying to replicate. I just can’t get the brightness around the torches I need without washing out the rest of the scene. Part of that problem is also shadows, but we’re working on that in a separate thread.

aNTeNNa trEE,

Oh, I didn’t see your post while I was typing my other response. That sounds very good–let me try that.

I screwed up the script (didn’t test before posting it)… try it again now. The only bummer with this method is you can only see the adjusted light at runtime

Edit: hmmm, this still isn’t working right. You can turn the brightness through the roof, but the attenuation/range only seems to work in relation to the brightness. You can’t actually get the light to fall off quickly enough even if you change the range to like 0.1

Edit #2: Ok, after playing around a little more with this it seems to do the trick alright as long as you set the light to Force vertex. With Pixel lighting the light seems to go on for quite some distance.

Hmmm. I can’t get the script to brighten the light past one for some reason. It works for lowering it down to zero, but here’s a shot with R, G, and B all set to 1,000. Our programmer will be here in a minute. I’ll have to see if he can tell me what I’m doing wrong.

Hmmm. Our programmer guru couldn’t find any way to get it working either. Can anybody else use this code to get a light super bright, but then falloff quickly? Thanks!

As far as i can see this hack is only going to work on some shaders.
Most likely it will not work with vertex lit shaders.

We will at some point look at allowing brighter lights, but right now the only way to do it is by writing your own shaders. Or using baked vertex lighting.

You can always just increase the light range of course.

bigbrainz, I’m definitely seeing a difference past 1.0 on the RGBs, but they do seem to plateau at about 10.0.
And indeed this only works for Vertex lit.

But like Joe just said it’s a “hack” and probably not the best way to solve this problem.