Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Colored Shadows in Unity?

Discussion in 'Editor & General Support' started by Fresh_Laundry, Feb 14, 2012.

  1. Fresh_Laundry

    Fresh_Laundry

    Joined:
    Feb 14, 2012
    Posts:
    2
    Hi there,
    I am trying to create blue shadows in Unity.
    Here's the exact Lighting I want to reproduce:
    $stock-photo-wood-piles-in-sunset-light-in-winter-snow-field-elk-island-national-park-alberta-can.jp
    However, I have not found any way of doing so with the default tools of the Pro version. Any idea as to how to do it directly in Unity?
    Thanks in advance
    Regards,
    Marc
     
  2. Morning

    Morning

    Joined:
    Feb 4, 2012
    Posts:
    1,141
    Edit > Render settings
    Change ambient light color
     
    KokodokoGames likes this.
  3. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    This.
     
  4. Fresh_Laundry

    Fresh_Laundry

    Joined:
    Feb 14, 2012
    Posts:
    2
    Thanks a bunch guys :)
    I owe you one!
    Regards,
    Marc
     
    Last edited: Feb 14, 2012
  5. Ntero

    Ntero

    Joined:
    Apr 29, 2010
    Posts:
    1,436
    Add blue ambient light, and make your lights yellower to balance it out.
    There is no such thing as coloured shadows, shadows are a lack of light. A coloured shadow just means that other types of light are reaching that point.

    You'll note in that stock scene the lighted areas are quite yellow. You do the same thing in a virtual world.
     
  6. kropcke

    kropcke

    Joined:
    Nov 20, 2009
    Posts:
    11
    That's not true, shadows are filled with the reflection of the sky and surrounding environment - you have warm shadows and cool shadows. Shadows most definitely *DO* have color. As photons (or radiosity in terms of cg) bounce, they pick up the surrounding color.

    Having shadow color separated out from the ambient light will certainly give more leverage to your lighting artists.
    Does anyone have knowledge of scripts that enable shadow color?

    Thanks,
    kropcke
     
  7. Zenchuck

    Zenchuck

    Joined:
    Jun 2, 2010
    Posts:
    297
    So how do you change the shadow color?
     
  8. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Read the thread. Although the menu is in a different place now, it's the same principle. Window>Lighting.
     
  9. Mr-Papaya

    Mr-Papaya

    Joined:
    Dec 13, 2015
    Posts:
    2
    Setting the ambiance washes the whole scene (including shadows) with a color. That's not the same as attributing a color to a specific shadow. In other words, it would be further defining the parameters of a specific light source. Naturally, the color of the shadow is opposite to that of the light, so that parameter could be default, but standard is just black.
     
  10. Lukey_BlueNose

    Lukey_BlueNose

    Joined:
    Aug 7, 2015
    Posts:
    2
     
  11. Mar_thew

    Mar_thew

    Joined:
    Sep 23, 2019
    Posts:
    1
    try this in shader fragment function:
    fixed shadow = SHADOW_ATTENUATION(i);
    return fixed4(lerp(color* _ShadowColor, color, shadow),1);
     
  12. Ashley93

    Ashley93

    Joined:
    Jul 30, 2020
    Posts:
    1
    I came up with another way to do coloured shadows without code... duplicate your directional light so you have 3 of the same thing... in the inspector, set the colour of each light to be completely red green and blue respectively. (so the colour codes will be R:255 G:0 B:0, R:0 G:255 B:0, R:255 G:0 B:255). now, the lights combined will be the same as a white light... but if you reduce the shadow strength on just one of the lights (in the inspector), the shadows will have take on the hue assigned to that light.
     
    PutridEx, AlgolStar, mfegley and 2 others like this.
  13. strangerattractor

    strangerattractor

    Joined:
    Oct 4, 2019
    Posts:
    4
    oh wow this is hilarius! And awesome. Was looking for a way to face colored shadows for an SSS object. This works just fine. THX!
     
  14. AlgolStar

    AlgolStar

    Joined:
    Mar 15, 2020
    Posts:
    9
    genius idea
     
  15. Deleted User

    Deleted User

    Guest

    That doesn't make since; Because it's the same as having only 1 directional light; Same result. You still can't color a shadow on a specific object without affecting the whole scene and other objects! And if you're using HDRP, you're doomed, because HDRP still (for some odd reason) doesn't support more than 1 directional light(casting shadows)! And if you're using URP/Built-in, you're also doomed, you can't change a specific object's shadow without affecting the whole scene and other objects -as I already mentioned-.

    The only proper thing I found about colored shadows is this one, called: Ray-tracing: Colored shadows in the HDRP Roadmap.