Search Unity

Dynamic Scarring along Surface

Discussion in 'Shaders' started by Ben_Iyan, Sep 5, 2019.

  1. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    The picture below is from Star Wars: Jedi Outcast. Does anyone know how to recreate the scar created by him dragging his lightsaber along the wall? Thanks

     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    First. That's not a screenshot, that's artwork that was used to promote the game.

    Second, while you could leave scars in the wall, they were far less impressive looking than that. Here's what they looked like (taken from this youtube video)
    upload_2019-9-4_17-5-37.png

    How was it done? Pretty straight forward. They drew a line of geometry wherever the player's lightsaber intersected with the collision geometry. The game came out 18 years ago and the world geometry was super simple, so just drawing straight lines over everything worked pretty well. Overlapping slashes just looked like overlapping lines and did not interact with each other line in the promotional image. They also didn't last very long by default (though you could tweak some settings to make them hang around longer).


    Modern takes on the effect would be done exactly the same way, but probably using some kind of deferred decal system so that it can more effectively cut through more complex geometry. I think Force Unleashed 2 probably worked like that.
     
  3. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    I stand corrected: artwork.

    The reason I ask is because I've seen someone do something like this in UE4 and I was wondering if anyone in the Unity community has done something similar I'd like to know if anyone has an idea how it would be done today with something being dragged across a non-smooth surface, like a sphere
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Same way. Test a short ray against collision. If hit each frame draw a line across the surface using some kind of projected decal.
     
  5. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    I'll give it a shot; thanks for the help.