Increasing bounce lighting with $reflectivity

by | February 14th, 2011 | Articles | 7 Comments »

So you’re putting in lights and you find the perfect settings to light the room, but there’s a problem: the ceiling is almost pitch black! A surprisingly common problem, so what do you do? increase the light’s brightness and suffer a blinding floor? Nope.

Default reflectivity values, the ceiling is way too dark but the ground is a nice brightness.

All too common, the light level in the room is enough to illuminate the floor and lower walls but the ceiling is far too dark, all the effort you put into detailing it is going to waste!

Just edit the $reflectivity value in the .vmt for your floor material. Most materials wont have this by default but you can add it to the .vmt after extracting it using GCFscape. Once you’ve put it in the same folder it was in in the .gcf and renamed it something sensible you can start playing with the values.

$reflectivity works like a vector; followed by “[R G B]” where R, G and B are the tint values between 0 and 1. For example: the line “$reflectivity” “[0.75 0.75 0.75]” would reflect back 75% of the light that hits it. Each vtf will have a default reflectivity built into it, I haven’t the know-how to work it out exactly but I’d assume it averages the RGB values of the entire texture and divides by 255 to get a value between 0 and 1. The wood floor above would have [.38 .33 .30] if my my assumption is correct.

Animated gif showing the default reflectivity values compared to 0.5, 0.75 and 1

The default reflectivity compared to 0.5, 0.75 and 1 where 100% of incident light is reflected back.(animated gif, click to view)

As you can see, using values of 0.5, 0.75 and 1 all have the same floor brightness but considerably brighter  ceilings than the default. This per-texture increase in bounce lighting is incredibly useful, it’s easy to implement and you only need to include a single .vmt per texture changed, only a few kB. You can also use this to put a different tint into your environments, since you can set each colour value independently of the others. To demonstrate I’ve used values of [.25 .25 .75] to add an extreme blue tint on the reflected light. Be aware though that this only effects reflected light so the floor texture itself is not tinted blue.

A heavy blue tint created by reflectivity values only, the lights are white.

With white lights you can still tint the environment with reflectivity, I hope you don't use anything this extreme though, yuck.

Thanks to Acegikmo for experimenting with this back in the summer.

Tags: , , , ,

7 Responses to “Increasing bounce lighting with $reflectivity”

  1. Artfunkel says:

    Nice explanation, this in a really useful trick. :) (There’s no need to ship the modified VMTs by the way; it’s all permanently baked into the map’s lighting.)

  2. If the filename is exactly the same you can leave it out and save a few kb, yes, but you would need to pak in the vmt if you’ve renamed it, for example if one room needs the boost but another doesn’t and they both use the same texture. You’d need to rename the new vmt so only one of the rooms had the refelectivity boost.

  3. Sulsa says:

    Oh man these articles are so great. I really hope you keep delving into the more arcane aspects of source for us! Thanks for all the effort :)

  4. […] In other news, I’ve written up the .vmt feature $reflectivity and its uses for increasing the amount of light bouncing off a given texture. Give it a read. […]

  5. Dabu says:

    Thanks! It’s super effective!

  6. Kev_Boy says:

    All that light, just by editing a single value in a .vmt file? Sweet!
    The purpose of a million omni bounce lights swept away, just like that.

  7. Vordwann says:

    Well, it doesn’t look like the ceiling is any more lit in the blue example, just the tint on the walls. I’m sure if you made it just something like .60 .60 .60 that would work though…

Leave a Reply

*