It’s not actually a decal- it’s a material that offsets a radial gradient, draws it to a render target, then uses the target as the opacity mask. I don’t know how to rotate the uvs based on the location of the gradient, since using a custom rotator with skewed coordinates doesn’t work, at least from my experience.
Try to start with some primitive. Maybe capsule. Spawn it in impact location and rotate by impact normal. This will give you more visible results to understand.
I think texture’s stretching depends on dot product between surface normal and impact normal, with some limits, to prevent it’s scale to infinite value.
And it’s rotation must be calculated with surface up vector and impact normal.
You need UV rotation between 0 and 3.14 I think, so it’s just some linear formula there.
Yep that’s what I came to after some trial and error- although the impact normal just returns the surface normal, so I took the trace and projected it onto the surface normal, which I’m sure is wrong but wouldn’t know since not math genius.
Could you explain why it would be between 0 and 3.14? The custom rotator takes 0 - 1 with 1 being a 360.
That’s an interesting thought- can’t visualize the best way to set it up but there’s no reason that wouldn’t work, but that would only work for planes unless it were a cube capture- which would really hit performance in an actual bullet time scenario on multiple objects.
Yep that’s true, but even then they would leave a scratch mark. High velocity things that pen at a high-ish angle would leave a long-ish hole too, enough that it should ‘be a thing’.
What would really be nice is if there were a way to make 3d material traces draw to a render target, then you wouldn’t have to mess with uv skewing nonsense.
Wow, thanks! I’ll be sure to pick apart all the math to see where I dun goofed. That puts an end to that conundrum
Still fantasizing about 3d material traces being drawn to the render target, but this will certainly do for now.