Announcement

Collapse
No announcement yet.

How to highlight the intersection between two meshes (4.13 video - Procedural Mesh Slicing)

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

    How to highlight the intersection between two meshes (4.13 video - Procedural Mesh Slicing)

    I'm trying to work out how they did the mesh intersection highlight in the UE4.13 video for the procedural mesh slicing as seen here;

    https://youtu.be/fiIx9CXtr0M?t=1098

    There appears to be a green transparent plane controlled by the right-hand controller which shows where the slice will take place. The intersection between the slice plane and any meshes within range is highlighted orange. How do you go about creating that highlight?

    Thanks for any help!

    #2
    My guess would be that they apply a different material ID to the newly-created triangles, and give that ID a different material. In theory very easy to do, once you have the slicing working.

    Comment


      #3
      Thanks for the quick response. Are you talking about the end caps of the newly created polys? I'm trying to work out the highlight before slicing. The bit that projects where the cut will take place.

      I've managed to get the slicing bit working but it needs a projected cutting highlight to make it more accurate. There's actually a neat option to change the material on the end caps of the newly created polys in the function itself. They've used an orange material for the new end caps which fades to the original color after a few seconds. Using the same color for the projected cut highlight and end caps after slicing may have caused some confusion.

      Comment


        #4
        I think they're using the Distance To Nearest Surface Material Expression. I'll go investigate!

        https://docs.unrealengine.com/latest...nearestsurface

        Comment


          #5
          i dont think that they use DistanceToNearest because procedural mesh dont have distance fields

          Comment


            #6
            Plane with depthfade and some clamping / thresholding used to drive whatever effect you're aiming for will do the job, if I'm right to think that all you need is for it to visualise where on the mesh the plane is intersecting?

            Comment


              #7
              Thanks for all the input. I ended up using a material function (MF_OccludedPixels) from the VR Template to highlight the slice plane. On a second look it seems they're highlighting all occluded parts, not just a small band at the intersection.

              Comment


                #8
                I would probably have just done a Dot product using WorldPosition as the input A and the normalized plane normal as B. then by taking Absolute Value you should have a gradient that is the world space distance from the plane. You could divide by the desired edge width, clamp 0-1 and then do 1-x to make it white on the plane and black elsewhere.
                Ryan Brucks
                Principal Technical Artist, Epic Games

                Comment


                  #9
                  I'm using an orthogonal camera view to look at ny scene, so depth fade doesn't work for me. Is there any other way?
                  Ryan, could you elaborate on where the final pin goes in your suggestion? I'll try that.

                  Comment

                  Working...
                  X