Real-time damage effect by altering texture

-Hi everyone! I’ve tried to find an answer to my request, but I couldn’t find one.
►What I was trying to achieve is to project a texture upon a “target’s” texture - as an example(see the screenshot), the tank from the picture has been hit by 3 bullets coming from its Front. ◄The holes are random “bullet-hole” textures which are applied(projected, therefore “taking into account” the shape(mesh) of the tank and the Trajectory of the bullet) to the texture.Since they are projected, a bullet hole would appear streched if the tank would have been hit by a bullet coming from its sides(but which would hit the front) - but if you look from the last(the one from the side) bullet’s view, the hole would appear correctly(round with no distorsion).
►Is it possible to achieve this damage effect in blender:confused:?(all I could find was by creating planes with textures on the point of impact between bullet and target)

Attachments


You have looked at the lot of FPS Projects that , when you shoot on a wall , the bullet perforation texture appears? If you can apply this to the tank , you will have your question solved, right?

Try it.

@midgardh
He said that he doesnt want a plane to be created above it, which I believe is the technique used on those demos…

@christiani_if
You could achieve an effect like that using nodes and script.
Using script, you would find the vertex closest to the collision, and set its colour property to 1,0,0,0 (red).
Then using node materials, you create a simple texture splatting, using vertex colours as the mask.
The downside with this is that the bulletholes would only appear where there is a vertex in the mesh.

@smeagle - that’s a good idea of an approach:yes:. Have you thought about the “mechanism” as being a simple real-time texture painter?(perhaps anyone has a better idea if this type of damage effect can be made with blender:confused:)

You could do this using the bge.texture module to change the tank’s texture as its damaged. It won’t be simple, but if you do a rayCast() function, you can get the hit UV points of your mesh. Using that, you can alter the texture of the tank. If you can visibly do that easily, then you can copy the bullet texture and paste it over the tank’s texture, and force it to reload. That process won’t be the simplest (it might slow down either the game, or just the reloading process would take a little time), but it might work.

@SolarLune - you’ve just solved half of the problem:yes:, and also described the entire mechanism(by using more accurate terms). Regarding the “adding” of the bullet hole, I don’t think that you have to actually reload the entire texture - stencils could be used, or an extra texture layer(of some kind) could be automatically added for each hole(therefore reducing the processing power required to do that).
►All that remains now is - how to project a texture from an object upon the one belonging to another object

Well, using the bge.texture module, you can get an array representing the image. So, you can get the array for the bullet hole and copy that onto the array representing the tank image - like I said, you’ll have to re-apply the texture to the tank, but it would work.