Tips and Tricks On Getting Realistic Bullet Hole And Blood Decals?

Hello, everyone!

I’m wanting to create a decal system that functions in the same way as Half Life 2, or any other game that has decals in it. The best example of this I can find is this video of Roblox World War 2, by @orange451.

Not sure how he obtained the effect, where the bullet holes don’t go off the part, as mine does currently. Any tips and tricks on this would be greatly appreciated. :slight_smile:

Screenshot:
image

3 Likes

http://robloxdev.com/api-reference/property/SurfaceGui/ClipsDescendants

I believe this is what you’re looking for.

12 Likes

So it’s not even a decal to begin with.

Thanks, Tom! :slight_smile:

By the way, is there anyway I can do this for MeshParts, Unions, and wedges? Or will I have to be stuck with them floating?

4 Likes

That’s a good question. Not entirely sure how it works but as long as it is a Roblox mesh like a ball of cylinder, it should work. If you want mesh parts I recommend separating them in blender or C4D and using Roblox shapes to your advantage, you might just pull it off if the mesh is the same shape as the Roblox part!

2 Likes

Alright.
Thanks again, dude!

Now I just have to implement this into my raycast system somehow. :thinking:

1 Like

Raycasting is my weakness :disappointed_relieved: Also did I solve your issue?

2 Likes

Yup yup.

Now I just have to figure out how to make it so each decal is the same size.

That’s currently the only problem I’m having right now.

The bullet holes, at least in this game, also adhere to certain surfaces like terrain and logs.

I’m assuming there’s still parts being created.

1 Like

As far as I know, SurfaceGuis are always flat :frowning:

3 Likes

Depends what type of blood he would like, if he’s trying to make it similar to before the dawn he would use billboard and surface Gui.

1 Like

I’m just wanting it so decals clip when they come to an edge of a part.

1 Like

Scale the GUIs with offset instead of scale. You might also need to dynamically adjust the CanvasSize of the SurfaceGuis. I guess you could make it smaller the larger the part or something.

3 Likes

Is there a way to resize, say, a 4x4 block depending on where the edges of a block are?

I think that’s how Roblox WW2 does it, since they’re able to be conformed to terrain surfaces & meshparts.

1 Like

EDIT: Sorry I see what you want to do. I’m bad at math but I think you could compare the part’s position with the size of the part to make the effect on. If its position is larger than the part’s size on a certain axis, resize it by that amount? Something like that.

Summary

If you position and scale the SurfaveGui correctly it should give you the effect you want. It should be as simple as making a new SurfaceGui on the part you hit and then making positioning the effect at the spot it’s supposed to be. With ClipsDescendants true it will cut off what’s outside of the part.

1 Like

Does his properly clip with terrain and meshparts too? The only way I can think of doing this is having those be handled differently and not be clipped, while shots on regular rectangles do get clipped (to an extent)

It’s the kind of thing you’ll probably have to make compromises on if you want it to be performant

An alternative is doing what I used to do, which conforms to everything, but it isn’t a texture (I scripted this in 2014 so it isn’t amazing)

What would be even better than above though is if you used a part (optionally with a decal) and using a cross product to make the hole appear flush with the surface. This is what I would assume the system you’re talking about uses for meshes and terrain. The wiki had an amazing tutorial on how to do it but unfortunately it seems to have died due to the push from the wiki over to the devhub

Cross product - Roblox Wiki (dead link)

2 Likes

That’s very unfortunate that article is down. :frowning:

1 Like

cc @Maximum_ADHD

maybe he has a way to bring it to life

2 Likes

Hope so! :slight_smile:

1 Like

We do have that article on our server, but it’s currently shelved due to broken images.
The article was originally written by @EgoMoose. I’d be happy to restore it if he has the original images.

Not sure if this is the same one, but this one has images:

http://webcache.googleusercontent.com/search?q=cache:YPs1XSpS1cUJ:wiki.roblox.com/index.php%3Ftitle%3DUser:EgoMoose/The_scary_thing_known_as_the_cross_product+&cd=1&hl=en&ct=clnk&gl=us

Edit: Also, would be nice if those articles were still accessible even with broken images, as the textual part is useful as well.

I don’t have the original images b/c they were deleted. That being said, uncannily I was working on redoing that particular article today.

If you’re allowed to and willing you’re more than welcome to use that to update the page.

4 Likes