Block light

bamibal

L1: Registered
Aug 14, 2015
47
5
I've got a floor with some func_breakable floorboards in my map. It works like a charm, except that light goes right through it. I discovered the 'block light' texture which also does its job when I put it on a brush which I then put inside the floorboard brushes (doesn't feel good to put brushes inside of each other but I see no other way). It creates one problem, there's some light at the walls seeping through. I tried making the brush as big as possible but the light keeps coming through. See:
XFQZsNM.png


It's the white glow above the two windows. So that's my first question, how to solve this? Or is there a better way than putting 2 brushes inside of each other? It's like this now:

TCxanTM.png



The next problem is that when the floorboards are broken, the light blocking brush is still there. I tried to make it a func_brush and trigger it to disappear when the floorboards break, but as a func_brush it lost its light blocking function. So the second question is, can I make the light blocking brush disappear as soon as the func_breakables break?
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
Greetings.

Dynamic brush entities such as func_brush, func_breakable and func_door do not block light, like world brushes and func_detail do. Most of the time, they will not cast any shadows, and light will go through them, though it is possible to configure a func_brush to cast shadows.

The reason why you experience light bleeding through the floor on to the walls below is because the walls are all one brush face. Shading on brush faces is gradual, meaning it fades from light to dark, and the sharpness of that fade is determined by the qualities of the light source, and the resolution of the face's lightmap. What you should do is split the walls up by cutting them using the :clippingtool: clipping tool (Shift+X) so that they are divided in to two faces: one for upstairs, one for downstairs. The downstairs walls will have a separate lightmap to the upstairs walls, so their shading will not be a gradient between the two areas.

Block Light :blocklight: is a tool texture. Tool textures are designed to be used on their own, and not normally tied to entities (with the exception of Trigger, Area Portal and Occluder, which are just transparent, coloured textures for ease of working with those entities in Hammer). Tool textures have special compile parameters that control their solidity to players or projectiles, whether they cut visleaves and so on. If you tie a tool texture to an entity, then those special compile parameters are lost and it just becomes an ordinary texture, which is what is happening when you turn your Block Light in to a func_brush. Unfortunately, the vast majority of light and shading in TF2 is baked in to maps, which means it is static and never changes. This means that you won't be able to simulate the effect of increasing light, and separate shading patterns for multiple floorboards. The best you can do is have a second set of light entities beneath the floorboards, which have each been given the same name (for example, light_downstairs) and are controlled by logic. Note that ordinarily, light entities should not be given names, and that you should use named lights scarcely, as they will generate much more shading data for the brush faces they hit, and their visual appearance will be uglier.

EDIT: Don't worry about putting brushes inside other brushes. They don't collide with each other. Overlaying brush faces like that is sometimes necessary and perfectly acceptable. You can do it with tool textures most of the time. You'll notice that :nodraw: sometimes runs along a displacement, or that a prop has been covered with :playerclip:.
 
Last edited: