Half-Life Bullet Decals

Blitz3D Forums/Blitz3D Beginners Area/Half-Life Bullet Decals

sigheye(Posted 2004) [#1]
hi,
Does anybody know how half-life's bulletholes are instantly drawn on the bsp's texture? Is it by sprite which checks the surfaces normals or does it paint the light map or w/e directly. its been puzzling me as the previous bullet holes ive seen have just been a 2 poly square angled on the wall, not really effective imo. thanks


eBusiness(Posted 2004) [#2]
I don't know how it's done in Half-Life, but sprites tend to do the job just fine, unless you want really really many of them.


sigheye(Posted 2004) [#3]
yes, i plan on having many of them on the screen (smgs and the like) but the sprites in half life look as if they've been drawn on texture itself. completely flat. and disappear after a certain time or limit.


Ross C(Posted 2004) [#4]
First thing to do is a line pick where the bullet will go. This will determine the normals of the surface the bullet has hit. Use PickedX,Y and Z along with AlignToVector, to rotate the sprite correctly. Then basically fade it after a certain time :)


sigheye(Posted 2004) [#5]
I'll try that, the surface normals make it completely flat regardless of angle right? if so and z-buffering does not mess it up you have solved my dilemma Ross. :) Thanks.


Gabriel(Posted 2004) [#6]
Z-Buffering won't mess it up. Just offset it very, very, very slightly in the direction of the normal to avoid Z-Fighting.


eBusiness(Posted 2004) [#7]
If the holes disappear, they must be sprites.

I think the easiest way to go about the hole sprites is to make an array of a suitable size (you can probably go up to some thousands). Stuff it up with handles for these sprites and then use them, starting out at one end. When you have used them all, go back to the first one. That way you will always use the oldest hole.


_PJ_(Posted 2004) [#8]

If the holes disappear, they must be sprites.

I think the easiest way to go about the hole sprites is to make an array of a suitable size (you can probably go up to some thousands). Stuff it up with handles for these sprites and then use them, starting out at one end. When you have used them all, go back to the first one. That way you will always use the oldest hole.


Why not use Types?

e.g.

Type Decal
Field X_Location
Field Y_Location
Field Z_Location
Field Fade_Time_Left
Field Decal_Sprite
End Type


This way, the 'array' size will match the number of decals you have, conserving some memory, and requires little maintenance. Also, they can be recycled simply.

I used a similar effect previously with my spaceship project, and had animated sprites that appeared on collision of lasers and structures. Worked okay with hundreds of them.


Mustang(Posted 2004) [#9]
Check Rob's "FPS Shell", it uses disappearing decals...

http://www.blitzbasic.co.nz/Community/posts.php?topic=32052