Search Unity

Question Mesh deformation for foot prints

Discussion in 'Shader Graph' started by sp312, Mar 20, 2024.

  1. sp312

    sp312

    Joined:
    Apr 29, 2017
    Posts:
    1
    Let me preface this by saying I'm very new to shader graphs, so hopefully I'm not being dumb... I'm trying to write a shader that creates footprints in sand as the player walks. Through a bunch of tutorials I've gotten to this shader below that does half of what I am looking for. Basically I have a script that uses a raycast to detect when a players foot touches the ground, when it does it adds an image to a render texture and then the shader below deforms the mesh to look like foot steps. What I'm trying to figure out now is how I can create a raised edge around the foot print so it looks more realistic, right now it just creates a hole. Can anyone help with that?

    upload_2024-3-19_20-34-29.png
     
  2. Ben_at_Work

    Ben_at_Work

    Joined:
    Mar 16, 2022
    Posts:
    83
    Can you show us what the mask and the result look like? My guess would be to make the stamp image you're placing on the render texture have the intended heightmap you're going for. You might need to remap it or use a second channel for the color if the softer shape of the normal indent isn't what you want.

    Your heightmap may need a more clear center value depending how you've set it up. You would want a situation where white values raise the normal and black values lower it. Basically expanding the (0, 1) range to be (-1, 1).
     
  3. icauroboros

    icauroboros

    Joined:
    Apr 30, 2021
    Posts:
    168
    With something like this you can control edge and inner displacement separately. Notice in this mask non changed areas 0.5, ups 1 and lows 0: snow2.png snow.png foot.png