Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

ALWAYS display shadow UNDER character (3d platformer)??

Discussion in 'General Graphics' started by QbAnYtO, Feb 27, 2021.

  1. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    I'm working on a 3d platformer. What is the best way to display a shadow on the ground UNDER the character regardless of lighting position? this is essential for 3d platformers and I'm wondering how to implement this. Perhaps using a ray cast? and move the "shadow object" to where the hit is detected?
    For that matter, what should the shadow made of? a 3d object? with a feathered/transparent type of shader?
    Thanks guys!
     
  2. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,711
  3. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
  4. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    Ok so I noticed the shadows go through all ground surfaces. I mean I COULD limit the length /distance of the shadow but is there another way to automated the shadow to just show on the current ground only? Right now I have layered 3 platforms and if I stand at the top one, the shadow bleeds down across all three platforms.

    Any ideas?

     
  5. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,711
    Look at Ignore Layers option. You can specify what gameObject layers the projector is applied to.

    Ignore Layers Objects in Layers that you specify here will not be projected upon. The default value is None.

    TO read up on layers:
    https://docs.unity3d.com/Manual/Layers.html
    Generally, setting layer options on components allow you to override default behaviour of a component.
     
  6. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    Yes I tinkered with this but the don’t want the layers to be ignored as I need shadows on those too. Just not all at once. Only when I’m directly on top of it.

    for example if I’m on the top platform, the shadow will show down through middle and bottom platform. So I see the shadows on all platformswhen I’m only on the top platform. Same thing happens if I am on the middle platform, it’ll go through and also show on the bottom platform. (New drinking game idea: take a shot every time I say platform lol)
     
unityunity