Search Unity

Question Casting a silhouette of an object

Discussion in 'General Graphics' started by blackchakram, Jun 5, 2023.

  1. blackchakram

    blackchakram

    Joined:
    May 27, 2018
    Posts:
    4
    As a fun project, I've been seeing if I can create something that mimics the Ultrahand from the recent Tears of the Kingdom Zelda game. It's been going well so far, but I'm a bit stymied on how to replicate the green "shadow" effect seen below


    Essentially, I want a profile of the grabbed object to be cast downward onto other objects and terrain as you move the grabbed object around.

    Any ideas on a way to approach this? My only thought was some sort of bright directional light pointing straight down that only affects the grabbed object and colors the shadow with an unlit shader of some sort?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Fresnel is a really quick method to get most of this, I am guessing they use this for at least some part.
    Then make it transparent, add shader vfx, etc
     
  3. blackchakram

    blackchakram

    Joined:
    May 27, 2018
    Posts:
    4
    If I'm reading what you're saying correctly, Fresnel effects would get me the green glow on the object itself. What I'm looking for is how to approach the green shadow it casts on the ground under it.

    The shadow functions as a placement guide so the user knows exactly where the object will fall if they drop it.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Ahhh got it, my bad.
    This could be done with a 2nd directional light, maybe combined with lighting layers? Or a spotlight? Maybe decals would be a fast and easy way to fake this.
    Never tried something like this however
     
  5. blackchakram

    blackchakram

    Joined:
    May 27, 2018
    Posts:
    4
    Decals could be an interesting approach. I'd somehow have to capture a top-down silhouette, convert that to a material, then use a decal projector pointed straight down. Every time the player rotates the held object, it'd have to recreate that material for a new silhouette... sound expensive.

    I was looking into the lighting layers idea. I'd have to somehow create a directional light that causes objects to cast shadows but doesn't actually illuminate the object itself. Not sure if that's even possible. hmmm.
     
  6. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    I think the mesh won't change its shape, so perhaps it's possible to prepare textures of each wood block and use emissive decals (attached to each wood block) to project it to the ground.

    I'm not sure which pipeline you're using, but URP decals don't support transparent surface (water) yet, so you need to use a 3rd party decals solution for it or just let it project to the bottom of the water.
     
  7. ZYM35

    ZYM35

    Joined:
    Jun 10, 2020
    Posts:
    8
    I think you can use a second camera set up directly above, and use its depth texture to achieve the silhouette texture. (Much like a shadowmap approach).
    Btw, could you show a bit on how you did the glow on the object itself? I'm trying to achieve a similar effect, like the rewind ability
     
  8. Arithmetica

    Arithmetica

    Joined:
    Feb 11, 2019
    Posts:
    44
    It's a technique called stencil shadow volume.
    Unity does not support this technique in the build-in.
    You have to implement it yourself or use third-party assets.