Announcement

Collapse
No announcement yet.

POM Decal | Decal rotation screws up POM effect

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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)
    Click image for larger version

Name:	POMDecalWorking.PNG
Views:	1
Size:	439.0 KB
ID:	1171745

    The POM Material
    Click image for larger version

Name:	POMpr1.PNG
Views:	1
Size:	485.5 KB
ID:	1171746

    When Rotated, the POM effect doesnt work anymore, the texture looks distorted
    Click image for larger version

Name:	POMRotated2.PNG
Views:	1
Size:	531.6 KB
ID:	1171748

    The effect increses with wider angles (more rotation)
    Click image for larger version

Name:	POMRotated.PNG
Views:	1
Size:	247.0 KB
ID:	1171747

    On Static Meshes it works fine (the rotation)
    Click image for larger version

Name:	rotatedStaticPOM.PNG
Views:	1
Size:	689.9 KB
ID:	1171749
    Last edited by MykonCodes; 02-08-2016, 07:35 AM.


    Freelancer for UE4 and more! www.mykoncodes.com

    #2
    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.
    Last edited by RyanB; 02-08-2016, 01:17 PM.
    Ryan Brucks
    Principal Technical Artist, Epic Games

    Comment


      #3
      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)


      Freelancer for UE4 and more! www.mykoncodes.com

      Comment


        #4
        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.


        Freelancer for UE4 and more! www.mykoncodes.com

        Comment


          #5
          I'm also curious if there's an answer to this issue.

          Comment


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

            Comment


              #7
              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.
              Ryan Brucks
              Principal Technical Artist, Epic Games

              Comment


                #8
                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.

                Comment


                  #9
                  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.
                  Ryan Brucks
                  Principal Technical Artist, Epic Games

                  Comment


                    #10
                    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?

                    Click image for larger version

Name:	3bf3c718a6.png
Views:	1
Size:	116.3 KB
ID:	1102996
                    Click image for larger version

Name:	cb5a2aaded.png
Views:	1
Size:	121.4 KB
ID:	1102997
                    Click image for larger version

Name:	a9c59531a0.png
Views:	1
Size:	105.4 KB
ID:	1102998

                    Comment


                      #11
                      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.
                      Ryan Brucks
                      Principal Technical Artist, Epic Games

                      Comment


                        #12
                        Ah that was a silly mistake by me 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!

                        Comment


                          #13
                          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.
                          Ryan Brucks
                          Principal Technical Artist, Epic Games

                          Comment


                            #14
                            Can anyone drop here right node system? Please.

                            Comment


                              #15
                              Hi there ppl

                              So ... try as I might, I can't seem to get this working correctly

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

                              Click image for larger version  Name:	ConstructionScript.PNG Views:	1 Size:	185.2 KB ID:	1576447
                              here's the custom POM function:

                              Click image for larger version  Name:	CustomPOM.PNG Views:	1 Size:	204.3 KB ID:	1576448
                              Here's the parameters in the material:

                              Click image for larger version  Name:	POMParameters.PNG Views:	1 Size:	159.8 KB ID:	1576449
                              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

                              Thanks!

                              Edit: to clarify, this is the components structure:
                              Click image for larger version

Name:	Actor.PNG
Views:	1
Size:	50.6 KB
ID:	1576452
                              Last edited by AF01; 01-24-2019, 08:12 AM.

                              Comment

                              Working...
                              X