Light_spot cone shape on wall

  • If you're asking a question make sure to set the thread type to be a question!

bamibal

L1: Registered
Aug 14, 2015
47
5
Would it be possible to make a spotlight throw a nice cone-shaped light parallel to the wall? Whatever I do it's always an ugly square. Or is this beyond the scope of TF2's abilities?

G6NlwGw.png

(these are 2 light_spots, one upwards and one downwards)
 

Idolon

they/them
aa
Feb 7, 2008
2,105
6,106
You'll want to decrease the lightmap scale on that wall.

When you compile your map, VRAD.exe will basically create light "images" for all of your brushes that get put on top of the base texture. However, they're also a low resolution by default. Making the lightmap scale value on a face lower will tell the engine to make a higher resolution lightmap for that face, which will allow you to get a nicer looking spotlight.

You can read more about lightmaps here.
 

bamibal

L1: Registered
Aug 14, 2015
47
5
Thanks a lot! Still so much to learn. How low can I go with this number? At 2 it starts to look good although still jagged, but I guess that's going to be very bad for my compile times and map size?

Could I get rid of the jagged edges?

IMTln0K.png
 

tyler

aa
Sep 11, 2013
5,102
4,621
The better your lightmaps are, the larger your filesize is. And it adds up pretty fast. So only use it where you really need it and players will appreciate it. Not in random hallways, for instance.
 

Idolon

they/them
aa
Feb 7, 2008
2,105
6,106
Also, things start to break with low numbers. VBSP will puke if you put an overlay on a face with lightmap density 1. I think I remember reading that 4 is the lowest you should ever go, though I don't have the source for that handy.
 

hutty

aa
Mar 30, 2014
538
444
if jaggies are really that much of a problem, perhaps faking it with a glowing overlay would be a better solution.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Except that doesn't help much if you want it to actually light up the area. That wouldn't even project light onto the floor and ceiling.
 

bamibal

L1: Registered
Aug 14, 2015
47
5
Think I will settle with this, 4 units/luxel. Now let's hope it doesn't break my map:)
Thanks for the help guys!

XHgPQMi.jpg
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Except that doesn't help much if you want it to actually light up the area. That wouldn't even project light onto the floor and ceiling.

Which is why you combine it with a fake light entity to light the room and do the heavy lifting in the wall, while the overlay does the fine details on the wall
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Here are some things to remember:

  • The closer you place a light_spot entity to a brush face, the 'harder' the 'edges' of the cone will be, and the more jagged they will look. If you move them away, their cone edges will be softer but you will have less control over the shape of the cone and the pattern of brightness.
  • When a cone hits a dark wall, the contrast between the dark surface and the light cone's edges can exaggerate the jagged effects. You can improve the look by including more light entities in the area to brighten up the wall, so that the jaggedness becomes less noticeable.
  • The light thrown out by bulbs in those light fixtures probably don't look like that in real life. You can afford to be a little messy.

If you want to simulate an attractive cone effect, without increasing the lightmap resolution so much, and you don't mind so much what the shape looks like, then you can move the light_spot entity a bit further away from the prop, in a 45-degree direction. And as YM says, put in a 'phantom'/fake light entity near the prop to simulate the brightness of the bulb.

oXHxWgw.png


This wall has a lightmap resolution of 16 luxels (default).
Kkl73bH.jpg


This wall has a lightmap resolution of 8 luxels. Notice the smoothness of the cone's edges.
2y7Qx4L.jpg


In the screenshots I used a point_spotlight entity above and below the prop to simulate the point of light that is the bulb.
 

tyler

aa
Sep 11, 2013
5,102
4,621
Putting the light cones in the opposite direction farther away is something I wouldn't have thought of. I'm impressed.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
A solution best done further away from where players can walk, since they'll get a stupidly bright spot as they walk through the light entities. The lightmap looks great, but the dynamic prop lighting will look very weird near that setup.

Just something to keep in mind as you're putting light entities in crazy wild spots to get beautiful lightmaps