Half-Life Re-imagined competition results on their way...
Check out Skewing textures in Hammer, our newest tutorial!
Welcome, w1Lo, our newest member!


Site Stuff






Feeling Blue

What's your favourite shade of blue?














5 mins


30 mins


32 mins


35 mins


41 mins


44 mins


1 hours



A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

Specifics of Decal Rendering


Forums > HL Engine Discussion

05 Feb 13, 11:04
By Penguinboy
Haha, I died again!
I was wondering if any Goldsource veterans could enlighten me about how decals are supposed to work when they appply to multiple faces. I've been messing with Hammer for a little while now and I still have no idea what behaviour Hammer and the engine use for decals, aside from the fact that the two are quite different.

Let me demonstrate (please excuse my silly example map):

Both behaviours seem illogical. Sometimes the decal is applied to multiple faces, sometimes it isn't. And when you try some different angles:

The VDC and a few other places say that the decal texture is projected outwards from the infodecal entity, however this explanation seems inconsistent with the screenshots above. Hammer seems to be projecting to all faces in the first and last screenshot, but didn't project at all in the second one. The reverse is true for the in-engine screenshots.

Does anybody have any idea how the engine renders decals like this?
05 Feb 13, 12:09
By kraken
I really can't answer your question. But I do recall in CS 1.6 that the spray tag decal inherits the texture's scale and rotation properties when applied to a surface.
05 Feb 13, 14:41
By Daubster
Vault Dweller
In the game code it determines the world geometry affected by tracing along the min/max of a 10x10x10 bounding box centered around the origin of the infodecal.

That makes sense on the left, as the bottom brush might be more than 5 units away from the infodecal origin. It's not as clear in your other screenshots, but I'd start from that figure.
05 Feb 13, 22:05
By DiscoStu
Never made sense to me either.

Time to dig through the HL source code tongue - :P
06 Feb 13, 09:21
By Penguinboy
Haha, I died again!
@Daubster: Awesome, that makes a lot of sense, the engine behaviour does seem consistent with your explanation. I don't even know what Hammer is doing, but what the engine does is the important thing in the end. Is the decal code you mentioned available in the SDK? Can you point me to the file so I can take a look?

Edit: I tested this theory and it seems correct, except it looks to be an 8x8x8 box rather than a 10x10x10 one. This screenshot has a bunch of brushes with a decal applied to the bottom side of each brush. The decal is applied to the floor for the first three, but doesn't when the distance from the floor is >= 4, which suggests a bounding box of 8 units.

06 Feb 13, 19:03
By Daubster
Vault Dweller
World.cpp in the server project, CDecal class. Forgot the exact name of the method, but I referenced the one for static decals.

It's interesting how the bounding box appears to be smaller than the one defined in the game code. Then again, there's probably stuff to do with projecting the decal in the engine that changes things. Either way, good to see some consistency. smile - :)
08 Feb 13, 03:33
By Penguinboy
Haha, I died again!
I checked out the code, and it looks like the 5-unit box is for testing against something else (my best guess would be perhaps decals showing on models), and then it sends the decal across to the engine regardless of whether that test succeeds or fails. So it looks like the engine itself determines what faces the decal is visible on. I'm going to stick with the 4-unit radius because that's how the engine is behaving in my tests.
09 Feb 13, 21:24
By Bruce
I always had one idea how to have almost Source-like RGB decals in HL without any mods. Simply make 3 separate textures for each of the RGB channels and put all 3 decals into same spot. A bit expensy but u have fully RGB, 768 color ^^ decals.

Also I just found the working of env_sound very interesting. Believe it or not but it affects the player in a very similar manner explosions does in HL! Turns out you not only need to be in it's radius, but you also have to see the env_sound entity itself for it to affect you. This way it doesn't affect you through walls, even if you're inside the radius...

EDIT: I just also noticed that for the transition from one env_sound to another to be successful you have to stay in the new one for at least half a second or something. If the radius of the new env_sound is so small that by longjumping or gaussjumping you can pass through it in miliseconds, the new env_sound won't take effect. The solution is to simply set a bigger radius for the new env_sound so you stay longer in it. Thanks rufee for testing.

09 Feb 13, 22:15
By Captain Terror
when a man loves a woman
Who is portrayed in the image above?
a. A. Cooper
b. Capt. J. Sparrow
c. A Potato
d. I don't know
e. All of the above
09 Feb 13, 23:00
By rufee
Sledge fanboy
Captain Jack Sparrow onboard the black dozer
12 Feb 13, 16:43
By Bruce
There are many entities we can investigate deeper
12 Feb 13, 21:48
By DiscoStu
Love seeing this type of research, even if it's a 15 year old game engine. Wonder if there are people doing this with newer engines too.

Forums > HL Engine Discussion

Login to Reply

You must be logged in to reply.