Announcement

Collapse
No announcement yet.

❀ DoN's Dynamic Mesh Effects ❀

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

    #76
    I did some extensive testing of the different settings and between the Windows and HTML5 platforms and with two versions of the same model. I'm using a basic helmet model that originally had two sides with a thin separation between them. I noticed some bleeding from painting from one side to the other and some of the decal/stamping being applied to the inside when I clicked on the outside. I duplicated the mesh and deleted the inside polygons for further testing.



    Helmet with two sides:
     
    Spoiler



    Helmet with one side:
     
    Spoiler




    Originally posted by VSZ View Post
    @DanimalsOnParade

    Question 2. (HTML5)
    (For other readers - please note that HTML5 is not currently supported. This discussion is more of a feasibility study at this point; Of course I would love to support as many platforms as possible, where feasible)

    Going by your description your test subject sounds like a static mesh using the fast-path (Collision UVs). That would explain the brush-size discrepancy as brush size is fully UV-island dependent in the fast-path.

    It sounds like Lightmap projection (seamless workflow) is not working in HTML5.

    The most obvious suspect here is the Scene Capture component used to capture position UVs. If you can do a quick test with any Scene Capture in HTML5 we can confirm that theory straight away.

    I added a SceneCaptureComponent2D to my helmet but I don't know what else to do with it. It compiled fine and I saw no errors in the log in the HTML5 build.
    Last edited by DanimalsOnParade; 09-05-2017, 10:38 PM.

    Comment


      #77
      Originally posted by DanimalsOnParade View Post
      I added a SceneCaptureComponent2D to my helmet but I don't know what else to do with it. It compiled fine and I saw no errors in the log in the HTML5 build.
      For testing this you need to invoke "CaptureScene" on the scene capture component and see whether a texture/RT is generated. Doesn't matter where your camera is facing, we're interested in knowing whether scene captures work in HTML5 at all; compilation is not the issue here btw.

      ~~~

      For your other query I'll get back to you - that's a lot of information to process
      Last edited by VSZ; 09-06-2017, 01:07 AM.

      Steam Early Access: Drunk On Nectar - The Nature Simulator

      UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

      Comment


        #78
        Originally posted by DanimalsOnParade View Post
        I did some extensive testing of the different settings and between the Windows and HTML5 platforms and with two versions of the same model. I'm using a basic helmet model that originally had two sides with a thin separation between them. I noticed some bleeding from painting from one side to the other and some of the decal/stamping being applied to the inside when I clicked on the outside. I duplicated the mesh and deleted the inside polygons for further testing.
        Thanks for the detailed report! Let's track HTML5 feasibility separately to allow for focus on the core issues first.

        Questions:-

        1) Are you using the latest 4.17 version? That has some changes to the way UV0, UV1 nodes work for static meshes.

        2) Do you have a screenshot of both your UV0 and UV1 channels? (think you included UV1 only)

        ~~~

        Clarifications:-

        * Brush size difference for static meshes on UV0 ("fast path") is expected. This is a typical limitation of collision UV projection.

        * "Splashing" effect between inner/outer faces happens in UV1 (seamless workflow) because it uses a world-distance based brush that indiscriminately paints any pixels that satisfy the distance criterion (brush size). This makes it great for seamless painting, but to make it work for a two-sided helmet we'd need some mechanism that uses the "Impact Normal" of your Hit Result and compares that with the "Pixel normals" of the helmet to filter out the inner or outer faces by a tolerance factor. This will have to be investigated as a separate feature.

        * There's no point turning off "Support UV from Hit Result" if you're using UV0 with a static mesh. I'm surprised that even worked. The 4.17 version blocks users from even trying that. Similarly, "TraceComplex" only matters when Support UVs is on, you don't need to bother about it if it isn't.

        ~~~

        Issues observed:-

        #1 - Text projection via Fast path for static meshes:
        A) Try the 4.17 version, I'll try to reproduce this locally as well.

        #2 - Two-sided helmet decal/text projection:
        A) Need to see both your UV0 and UV1 to get a better picture. Shelled meshes haven't been tested much so it may be possible we're running into an edge case. UVs will help verify.
        Last edited by VSZ; 09-06-2017, 01:11 AM.

        Steam Early Access: Drunk On Nectar - The Nature Simulator

        UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

        Comment


          #79
          Originally posted by VSZ View Post
          Issues observed:-

          #1 - Text projection via Fast path for static meshes:
          A) Try the 4.17 version, I'll try to reproduce this locally as well.

          Yes I am using 4.17. I immediately switched over (started a new project too) when the plugin update was released.


          Originally posted by VSZ View Post
          #2 - Two-sided helmet decal/text projection:
          A) Need to see both your UV0 and UV1 to get a better picture. Shelled meshes haven't been tested much so it may be possible we're running into an edge case. UVs will help verify.
          Here's UV0 for the double sided helmet:
           
          Spoiler


          UV1 from double sided helmet (automatically computed by UE4 when I imported the mesh):
           
          Spoiler


          UV0 for single sided helmet:
           
          Spoiler


          UV1 for single sided helmet (automatically computed by UE4 when I imported the mesh):
           
          Spoiler


          It's weird that Support UV from Hit Result being ON makes the text stamping not work. Getting text stamping to work with Support UV from Hit Result ON would be ideal because then I might be able to get it to work on HTML5 too!
          Last edited by DanimalsOnParade; 09-06-2017, 06:45 PM.

          Comment


            #80
            Major Bugfix Available (Text stamping & Static Meshes)

            An issue with text stamping for static meshes has been identified, fix is available in this post.

            Scope: This bug affects only the "fast-path" (Collision UVs) which DanimalsOnParade explains why you had text projection issues when "Support Collision UVs" was turned on.

            Patch Instructions:
            1. Migrate the plugin to your project folder (see this post for details, you only need Steps 1-4)
            2. Open the file <YourProject>/Plugins/DonMeshPainting/Source/DonMeshPainting/Private/DonMeshPaintingHelper.cpp
            3. Go to Line 54 and replace that entire line with the following snippet: FDonPaintStroke stroke = FDonPaintStroke(Hit.ImpactPoint, 1.f, 0.f, Color, Hit.FaceIndex, strokeParams, Text, Style);
            4. Build your project from Visual Studio, the plugin will be recompiled along with it and now carries the fix!

            I can't submit these changes to the marketplace yet as Epic has still not officially processed my previous updates from August (thankfully they added the 4.17 files, but none of the accompanying changes and no response to the ticket either!). Besides, the 20-30 day wait time for processing an update is too long IMO for important bugfixes like this.

            If you are a plugin user who isn't familiar with modifying plugins from Visual Studio, just drop a support email (link) for assistance with installing this patch.

            Thanks again to DanimalsOnParade for reporting this issue
            Last edited by VSZ; 09-08-2017, 09:22 AM.

            Steam Early Access: Drunk On Nectar - The Nature Simulator

            UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

            Comment


              #81
              It's working perfectly and in HTML5 too! Thank you for the quick fix!

              One thing to note is I had to close the Editor and delete the contents of the Binaries folder for the plugin to recompile.

              I'm excited about the next update with infinite undo functionality!

              Comment


                #82
                I'm displaying a preview of the decal above the mesh in 3D space where the decal should stamp and its rotation of how it should look when stamped. However, I can't get the stamped decal rotation part to work correctly because the UV island rotates itself (as suggested in the PaintStroke() comment). Do you know how to get the BrushDecalRotation to compensate for mesh UV islands that may be rotated?

                Seeing as how the decal is always oriented the same way as the UV map gives me hope that there's a way. For example this arrow decal on the helmet:







                There has to be some way to get the UV map's current rotation at a given point (where I want to stamp) in the containing triangle's coordinate system (normal, bitangent, tangent). I'm not good at this kind of math but I feel like there should be a way. If I cast three rays into the triangle and find those world space coordinates and UV coordinates, there has to be some kind of mapping between the coordinate systems that I can use, right? Any ideas?

                Comment


                  #83
                  @DanimalsOnParade - One workaround I can think of is to let the preview itself be driven by the plugin and have the user control BrushDecalRotation (for the preview decal). When the user confirms the decal placement you will have obtained the correct rotation offset needed for BrushDecalRotation and can use that in a second pass (for stamping the actual decal) and it should look right.

                  The first task will be to switch between a "preview mode" and "normal mode" in your material, where the preview mode uses an additional Don UV node that is overlayed on top of the regular material. The next challenge will be to "animate" the decal preview every tick instead of "painting over" with it (default behavior). To achieve that you can supply a custom render brush (instanced from the default M_PaintBrush_Regular), but with blend mode set to "Opaque" so that it will effectively overwrite (and animate) the position of the preview decal each tick (a brute-force alternative is to clear the render target for your preview layer for each new preview pose, but that's not elegant).

                  Re: your rotation mapping idea - I'm not sure, though I can say it wouldn't work for skeletal meshes because UV coord/mesh data is optimized out for them (that's incidentally the reason why the "fast-path" / collision UV workflow is only supported for static meshes)

                  ~~~

                  A systemic way to address this would be to somehow implement seamless decal/text projection, which would make all image projection UV-independent and thus make rotation a non-issue.I haven't found a way to do this yet.
                  If anyone reading this knows how to "project an image seamlessly across a mesh at a desired world location", I would dearly love to know
                  Last edited by VSZ; 09-09-2017, 08:37 AM.

                  Steam Early Access: Drunk On Nectar - The Nature Simulator

                  UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                  Comment


                    #84
                    Originally posted by VSZ View Post
                    @DanimalsOnParade - One workaround I can think of is to let the preview itself be driven by the plugin and have the user control BrushDecalRotation (for the preview decal). When the user confirms the decal placement you will have obtained the correct rotation offset needed for BrushDecalRotation and can use that in a second pass (for stamping the actual decal) and it should look right.

                    The first task will be to switch between a "preview mode" and "normal mode" in your material, where the preview mode uses an additional Don UV node that is overlayed on top of the regular material. The next challenge will be to "animate" the decal preview every tick instead of "painting over" with it (default behavior). To achieve that you can supply a custom render brush (instanced from the default M_PaintBrush_Regular), but with blend mode set to "Opaque" so that it will effectively overwrite (and animate) the position of the preview decal each tick (a brute-force alternative is to clear the render target for your preview layer for each new preview pose, but that's not elegant).
                    I actually thought of a similar idea of having another mesh slightly larger than the original with a transparent texture except for where the decal is painted and then animate it every tick by clearing the render target. I like your idea more but I am already using all 3 layers of UV0 (paint, decal, and text). Is it possible to have more than 3 layers for the UV0 workflow? Can I make a Don_Mesh_Paint_UV0_Layer3, Don_Mesh_Paint_UV0_Layer4, and so on? That's probably the workaround method that I will take on confirming how to make a 4th layer on UV0. I could always put the decal and text on the same layer, freeing up the third default layer to use for the preview, but I kind of like having them separate if possible.

                    Edit:
                    I think I figured out how to make new layers. Just make a new folder in DonMeshPaintingContext/Materials/UvFunctions/MeshSpace for Layer3, Layer4, etc. and then duplicate the existing materials from one of the existing layers and move them into the new folder and change the Tex Object parameter name in the Materials.
                    Last edited by DanimalsOnParade; 09-09-2017, 10:30 PM.

                    Comment


                      #85
                      Your proposed method of previewing is working great on decals! I can rotate them freely using the arrow keys before stamping in the same rotation as the preview.

                      The rotation on the PaintText node doesn't seem to be working. Regardless of what number is fed into the Rotation variable on the blueprint node, the text isn't rotating. Might be a bug?

                      Comment


                        #86
                        Hotfix v2.2 Available (Text rotation fixed)

                        Scope: Text rotation does not work while stamping text, the Rotation parameter is not applied. This was a regression that popped up in a recent build.

                        Patch Instructions:
                        1. Migrate the plugin to your project folder (see this post for details, you only need Steps 1-4)
                        2. Open the file <YourProject>/Plugins/DonMeshPainting/Source/DonMeshPainting/Private/DonMeshPaintingHelper.cpp
                        3. Go to Line 54 and replace that entire line with the following snippet: FDonPaintStroke stroke = FDonPaintStroke(Hit.ImpactPoint, 1.f, Rotation, Color, Hit.FaceIndex, strokeParams, Text, Style);
                        4. Build your project from Visual Studio, the plugin will be recompiled along with it and now carries the fix!


                        Hotfix Marketplace ETA: As with the previous hotfix, I am unable to submit this to the marketplace until they officially clear the current backlog of updates for this plugin.

                        If you are a plugin user who isn't familiar with modifying plugins from Visual Studio, just drop a support email (link) for assistance with installing this patch.


                        Thanks again to @DanimalsOnParade for reporting this

                        Fun-fact: Both hotfixes so far have occurred in the same file, in the same line of code

                        Steam Early Access: Drunk On Nectar - The Nature Simulator

                        UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                        Comment


                          #87
                          That fixed it for me. Thank you for the speedy fix again!

                          Comment


                            #88
                            How would I go about making an eraser paint brush for decals? I don't want to clear the whole render target, I just want to be able to erase whatever part of the decal is under the paint brush. I would expect to be able to paint to decal layer with all black color and white on the alpha but that doesn't seem to work. The alpha channel of the render target doesn't seem to be changing when I try this.

                            Code:
                            FLinearColor EraserColor = FLinearColor(0, 0, 0, 1.0f);
                            That just paints solid black over the decals on the model. Any idea what I'm doing wrong?

                            Comment


                              #89
                              Originally posted by DanimalsOnParade View Post
                              How would I go about making an eraser paint brush for decals? I don't want to clear the whole render target, I just want to be able to erase whatever part of the decal is under the paint brush. I would expect to be able to paint to decal layer with all black color and white on the alpha but that doesn't seem to work. The alpha channel of the render target doesn't seem to be changing when I try this.

                              Code:
                              FLinearColor EraserColor = FLinearColor(0, 0, 0, 1.0f);
                              That just paints solid black over the decals on the model. Any idea what I'm doing wrong?
                              Some background is necessary: The default render brushes use AlphaComposite and Additive blend modes. These allow us to use just a single texture (per layer) for creating effects instead of storing one extra texture (for reading) and a main texture (for writing) as seen in some other techniques.

                              Erasure requires the second setup and that hasn't been built in the plugin yet as the the early focus was on gameplay usecases (which usually only accumulate effects).

                              Implementing this requires both code changes and a new render brush. The code will need to accommodate dual textures (read texture, write texture) per layer and the new render brush needs to read from the read texture, mask out the erased areas and render it out to the write texture with an opaque blend mode.

                              This is just theory though as I haven't tried this out, there could be complex edge-cases involved. I can try targeting this for the next engine version update whenever that is...
                              Last edited by VSZ; 09-19-2017, 11:03 AM.

                              Steam Early Access: Drunk On Nectar - The Nature Simulator

                              UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                              Comment


                                #90
                                Originally posted by VSZ View Post

                                Some background is necessary: The default render brushes use AlphaComposite and Additive blend modes. These allow us to use just a single texture (per layer) for creating effects instead of storing one extra texture (for reading) and a main texture (for writing) as seen in some other techniques.

                                Erasure requires the second setup and that hasn't been built in the plugin yet as the the early focus was on gameplay usecases (which usually only accumulate effects).

                                Implementing this requires both code changes and a new render brush. The code will need to accommodate dual textures (read texture, write texture) per layer and the new render brush needs to read from the read texture, mask out the erased areas and render it out to the write texture with an opaque blend mode.

                                This is just theory though as I haven't tried this out, there could be complex edge-cases involved. I can try targeting this for the next engine version update whenever that is...
                                Ah that makes sense. Thank you for the explanation. I hope you do add this feature and the infinite undo/redo in the next version. Epic seems to release new engine versions every 3 months or so and I expect 4.18 to be released in October or November at the latest.

                                I have another feature request. I'd like something similar to Photoshop's Clone Stamp tool. So I give the BP paint node a texture and it paints directly from the texture, translating the HitResult's UV coordinates to the provided texture and then paints on to the RenderTarget. I'd like it to paint to the RenderTarget (like decal stamping) so that I can swap out multiple textures to clone from on one model. An example would be if I wanted to clone stamp a camouflage texture onto my model and then stamp a different pattern elsewhere on the same model. This would be affected by UV seams, but that can be worked around. Unlike the sample project painting a lava material, that happens after the Render Targets so we couldn't have unlimited dynamic textures. If I'm wrong and this is already possible, please correct me!!

                                Comment

                                Working...
                                X