How to splat an image on on face

I want to paste a bullet hole image onto a geometry face when a bullet (or a ray, to be precise) hits it. How would I do that?

with a decal

Please correct me if I’m wrong but there’s currently no built-in utility for making decals, it has to be done from scratch mostly.
There are many alternatives depending on the specific requirements, this is one alternative that’s been mentioned in the past: How to project decals - Wolfire Games Blog

I have this in my todo list and I haven’t done it myself yet.
How do others do it?

1 Like

im also interested about best apprach into this.

There was/is one lib, not sure if still working one:

But generally im also curious what would be best way to achieve this for a character for example.
I could create quads assigned to bone links, use mentioned lib, but im still not sure about best way. (on animated character)

1 Like

I’ve made a decal system based on that article a few years ago, and it’s been on my priority list to clean the library up to make an alpha/beta release of it available, but the one big feature I left out was vertex-cropping for parts of the decal that are outside the dimensions, and instead I just discard the pixels in the shader as a quick fix, which was sufficient for my project where I was using decals for effects on the ground that don’t last very long. But the vertex cropping is definitely necessary for rendering many static decals that last for a long or indefinite duration, and for decorative decals that could be batched together in the scene design process.

It has been a long time since I updated my code on github to match the progress I’ve made with decals on my local project, and I was fairly new to JME when I wrote this. But here is the repository if anyone is interested in taking a look at the code, or if anyone is possibly interested in contributing to the repository or helping with testing sometime in the near future to make this a finished decal library.

I have not implemented any code to solve this yet, but my plan for placing a decal on an animated character (like a tatoo, for example) is to transfer over the bone weights from each vertex (if possible) when I’m copying over the rest of the vertex/index/texcoord buffers for generating the decal, and then the decal should be able to be added to the character’s node/spatial with the animComposer (similar to a piece of clothing that has bone weights matching the character) and should follow the animations fairly accurately.

6 Likes

And here we fall off the edge of the cliff of “hundreds of ways to do a thing each with their own trade offs”… which is why I suspect sgold gave a simple answer to a simply worded question. Especially since “decal” is the appropriate key word for searching (especially on the forum).

In google, you may also search for ‘splat’… because most of the ‘projection’ approaches can bog down after a few hundred bullet holes… if that’s a realistic use-case for OP.

2 Likes

well, for a tatoo, i just overlay another transparent texture(like phong one) and blend with default one.

Yeah, for an animated character it’s really the only feasible way for tattoos.

1 Like

yup, but about bullets on animated character you say i need search “splat” keyword?

No, I wasn’t answering any questions about animated characters because that’s not what OP asked.

If you want to put thousands of bullet holds around your level then ‘splat’ or ‘splatting’ may be a better keyword to search for. It could may be adapted to character animation also, I guess. Never really thought about it. Depends on which splat approach is taken but the one I always think of is a shader trick.

I think one of the GPU Gems books had something about it. I remember thousands of random flowers on a surface or something. My books are not handy.

1 Like

To make things clear, the geometries I want to splat are completely static, no moving parts or anything.

There’s an idea, but it’s not fully mature, you can remove the bullet from the physics space when it collides with the geometry face, it would stick to the object, then change the bullet color to completely black(or leave it as it’s or change its texture as you want ), it is a little bit of deceiving option, but it wonot satisfy you, if you want an advanced option.

I think @capdevon has made a more dynamic progress in this option(sticking bullets) :

EDIT : I realized that you are using rays & not geometric shaped bullets, this way would work only if your bullets are Spatials.

1 Like