Download

POM Decal | Decal rotation screws up POM effect

Hello everyone,

Lately I was “playing around” with POM (Parallay Occlusion Mapping) Materials for 3D Skidmarks for our vehicles. The POM Material works fine for Static Meshes, but when used in a Deferred Decal Actor, the Rotation has to be (0,-90,0), otherwise the Texture (Material) gets stretched and the POM effect disappears. Hard to describe how it deforms, it has no clearly recognizeable pattern, but it seems that the Parralax Occlusion assumes a different viewing angle than it actually is.

My question is what could cause this and how would I fix it. For a better understanding of the problem, here a few pictures of the Material itself and the working POM on Static Meshes and the POM on Deferred Decals, one in the default Rotation (0,-90,0), and one with modified rotation.

The working POM Decal on the Landscape, not rotated (Default Rotation is applied: 0,-90,0)
POMDecalWorking.PNG

The POM Material
def43553cd53121e2c14c3bce6be210e27e6686c.jpeg

When Rotated, the POM effect doesnt work anymore, the texture looks distorted
POMRotated2.PNG

The effect increses with wider angles (more rotation)
POMRotated.PNG

On Static Meshes it works fine (the rotation)
rotatedStaticPOM.PNG

Hi, this is because the tangent space transform does not work for decals. It is possible that changing it from world-tangent to world-local may work in this case. I will give it a shot as soon as my current compile finishes.

edit so that is definitely the source of the problem but so far no combination of local transform is fixing it. Going to require some more debugging.

Passing the transform through the custom UVs did not work, seems to have just returned noise.

Thanks for your investigation. Good to know the cause of the problem. I will try to come up with a workaround or solution too.

Greetings,
Mykon (OmaManfred)

Sorry to bump this - but did you have any success finding a workaround? Or maybe an advice for a different technique to acchieve similiar results (3D looking skidmarks)?

Thanks very much, really appreciated your livestream from which I mostly “copied” the POM Material.

I’m also curious if there’s an answer to this issue.

Did anyone find a work around for this? We’d love to include POM bullet hole decals in our game.

There is a solution with limitations.

You need to make a blueprint for the decal actor, and you need to create an MID for the material and pass in the three local space vectors, and then the camera vector needs to be transformed into that custom vector basis. There is a material function “Transform 3x3 Matrix” that can do it based on the 3 vectors. That part would replace the Tangent Space transform inside of the POM function.

The limitation is that the coordinates of the decal will basically be planar.

Thanks for getting back to me. This is really good info, thanks! May I ask how I get the local space vector? Blueprints are not my strong point.

You can simply do “Get Actor Rotation” and then from the rotation you can drag off and type “Break Rot into Axes”. The X, Y and Z vectors would be what you need.

Thanks! This is what I’ve got setup. Not sure of the issue, but this is resulting in nothing showing. I don’t suppose you can see what I am doing incorrectly?

3bf3c718a6.png
cb5a2aaded.png
e491805974e793c63aab54a7988ce1e0ccf43451.png

they need to be vectors. you have them hooked up as scalar parameters.

And you might have to multiply some of the vectors by -1 if you see flipping issues.

Ah that was a silly mistake by me :slight_smile: I can manually modify the appearance of the decal now, changing the vectors by hand. But the blueprint is still not working correctly, it seems it is not changing the material or maybe the parameters. I added in a value I could change by hand in the blueprint to test this, and it does indeed not change anything. I added a “set material” node to be safe, but that changed nothing. Is there some issue with decals and MIDs? Or should I do something different?

Sorry for all the questions, and thanks for your time. This will be killer for our game Squad if we can get it working! :slight_smile:

ah, I think its because you are creating the MID on tick instead of on begin play. Doing it on tick doesn’t really make sense and it would be pretty expensive as well.

for things that are not spawned during gameplay you would normally do that part in the construction script.

also just keep in mind the above assumes that the decal component has the same rotation as the spawning actor. if the decal component is relative and you only modify the parent it will work fine.

Can anyone drop here right node system? Please.

Hi there ppl :slight_smile:

So … try as I might, I can’t seem to get this working correctly :frowning:

Here’s the construction script (I’ve tried in BeginPlay, same thing)


here’s the custom POM function:


Here’s the parameters in the material:


And here’s the unfortunate result:

If anyone can please help, if you spot any errors … I’ve tried following the explanations on this thread as best as I could :frowning:

Thanks!

Edit: to clarify, this is the components structure:
Actor.PNG

So what was the actual outcome for this? Did you ever get it working? I’ve been randomly plugging stuff around to try to make a POM decal on landscape slopes work but not having much luck. I can get everything looking good, but not from angles lower than the decal itself.

Since we have hear a nice POM talk @RyanB are they any plans to improve the POM shaders in near future ? They are still a lot of issues/limitations especially when using the POM with silhouette sahder…

I seem to of cracked it with some slight changes.

POM_Decal_rotation_test.gif

What I currently have seems to work regardless of the rotation, or the rotation of the mesh I parented the decals to. the colors are per-pixel normals connected to emissive.

I basically followed RyanB’s advice with ultimately one change, using an **InverseTransformMatrix **instead of a Transform3x3Matrix.

This is what my POM matfunction looks like, everything outside the box is identical to the default epic parallax matfunction:


Heads up though, I did multiply my X vector by -1 to flip it (but not Y and Z), you may also have to flip vectors depending on what the rotation of your decal actor looks like inside the blueprint (my decal actor was 0,-90,0 inside the root).

And this is what my blueprint looks like, I just got this working so I didnt optimize this between construction a event instructions yet.


In this case, I am using GetActorTransform, of the decal actor (Decal Dent) inside the BP and breaking it, **GetActorRotation **also works, I just needed the full transform for other things elsewhere on my BP.

could you drop the blueprint as some of us don’t know how to make them in the first place? :stuck_out_tongue: