Download

Dynamic Damage to Textures

Hi Guys,

Does anybody know a good way to dynamically apply damage to a character so the texture shows blood on impact? I’m developing a sword fighting game and I would like to show cuts where the sword hit the enemy.

I tried with decals but with human characters you get a lot of “texture swimming” depending on the hit location.

Thanks!

Use draw to RT

I thought about that, but the problem is that find collision UV does not work with skeletal meshes:

https://answers.unrealengine.com/questions/533665/find-collision-uv-always-returns-zero-for-skeletal.html

Ryan Brucks got it to work somehow:

Try setting your trace to use trace complex and see if that helps.

It seems that the engine does not allow you to get the UVs on skeletal meshes by design:

[QUOTE=Wilkes;694426]
Ryan Brucks got it to work somehow:
https://youtube.com/watch?v=Jz050a2OMXE[/QUOTE]

Amazing! Thanks I will take a look and try to understand how he did it. I took a quick look and I did not find how he transforms the hit location to UV position, but he is clearly doing it somehow…

Hi guys,

I was able to follow Ryan Brucks’ tutorial to encode local positions to a render target, but I’m not able to apply the damage texture so it can be rendered to the render target.

This is the material I use to paint the damage based on hit position:
dc8a21ee48996972e057fae04bf66eb2e0dbd5da.png

When I set the view port to render the material on the character it correctly paints the area around the hit:
Model.PNG

But when I use this material to Draw Material to Render Target (or when I set the view port to render the material on a plane) it comes back pitch black:
0e11338684a2d3743a30ea60869c80b93a8bb8f4.png

Does anyone know what I’m doing wrong?

Thanks!

@jawatr - Just in case you’re still stuck on this, I’m pretty sure your issue is with local bounds calculation.

In your viewport everything works because the material has access to your character’s local bounds (via the ObjectLocalBounds node). But when you’re drawing this material to a render target the node will return nothing because it’s really just an additive brush material.

One way to solve this is to add two vector parameters - min bounds / max bounds and feed these values in from your blueprint for each mesh. You can go one step further by using the same parameter setup while generating your positions texture too, thus ensuring consistency across the board.


**A Plug for my plug-in:**

If you're looking for a single-node painting solution that works on any number of characters/landscapes/props, is network-ready and supports collisions, then do check out my mesh painting plugin :)

https://youtube.com/watch?v=MXrHfWu9vD0

Thanks VSZ! I solved this sending the local position instead of the world position, I did not realize the render target has no knowledge of the mesh

@jawatr Where did you find that tutorial? all i can find is a 26 second video demonstrating the end effect.

Thanks for your help.