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

Swift Shadows [RELEASED]

Discussion in 'Assets and Asset Store' started by ZimM, Feb 3, 2014.

  1. bromske

    bromske

    Joined:
    Sep 11, 2012
    Posts:
    28
    private void OnDisable() {
    if (!_isInitialized || _isDestroyed /*|| !gameObject.activeSelf*/)
    return;
    UnregisterShadow();
    }

    This change in SwiftShadow.cs would work...
     
    Meceka likes this.
  2. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Thanks, this is a known issue that was already fixed internally, just not released yet. There will soon be an update with this and some other included improvements.
     
  3. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    Thanks mate, I had the same problem.
     
  4. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    I would like to change opacity of all swift shadows on the scene when AO is enabled. With AO enabled, shadows should be more transparent or they get very black. Is there a way to set this without changing material color?
    Changing material color would make it over complicated as they're saved in project after exitting play mode.
     
  5. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Well, there are two options I can see:
    1) Set the color on each shadow individually.
    2) Clone the material, set the cloned material as the material for each shadow, change the cloned material color. That will avoid saving the changes to the project.
     
  6. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    Can you explain setting color on each shadow individually? Where will I set color?
     
  7. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Swift Shadows 1.2.2 is now live on Asset Store!

    Change log:
    • Added an option to generate the shadow material to the Shadow Texture Generator.
    • SwiftShadow.InitialColor renamed to SwiftShadow.Color to avoid confusion.
    • Fixed prefab instances not unregistering correctly in some cases.
    • Fixed shadows occasionally disappearing after assembly reload.
    • Fixed warnings in Unity 5.4 and Unity 5.5.
     
  8. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Use the Color public property of the SwiftShadow component.
     
  9. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Excuse me. I used this plugin and it works great if the surface is even. However, if the surface is not even and a little bit steep, the shadow looks like cut in the middle, totally discrete. I notice there is a description in the manual.

    "Each individual shadows only projects on one surface at a time. This leads to a discontinuity as shadow moves from one object to another"

    If the whole surface belongs to the same object and the surface is not even and a little steep somewhere, how can I get smooth shadow on the surface?
     
  10. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Hi,
    as it says in the manual, "Shadow can extend the edges of object it is being projected on. It can also clip inside complex-shaped objects.". There is no good way to make shadow look nice on an uneven surface. Depending on your situation, you can, however, do a trick where you render the shadow separately. To see this trick in action, see the included "Terrain Interaction" demo.
     
  11. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    ZimM,

    I'm using Swift Shadows for non shadow related uses, thanks to the ability to project a Sprite. It looks like it will be a decent option for sprites that I want to follow the contour of the terrain. (I tried to make Particles work but getting Horizontal Billboard particles to glide along the terrain is very challenging).

    I noticed you have a warning, "Packed Sprites are not allowed".

    Can you elaborate on why this is a limitation? If I understand why this is not an option, perhaps I can come up with a work around. My thinking is that using packed sprites would be better for Draw Calls but I may be mistaken. It appears to not be related to the shader but anything you can add would be helpful.

    Thanks
    Allan
     
  12. kosukito

    kosukito

    Joined:
    Sep 6, 2014
    Posts:
    8
    i wonder if there is a way to update the sprite on runtime to could make a shadow animation, the asset is great, that's the only thing i'm trying to add to your script.


    Nevermind i already manage to implement it on your code, could be a nice feature for a future release tough. thank you.
     
    Last edited: Mar 25, 2017
  13. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Good news everyone! Swift Shadows v.1.2.3 with improved Unity 5.6 support is now live on the Asset Store.

    Basically, the reason is that Swift Shadows uses sprites just as a more convenient way to select the shadow texture. The rendering of the shadow is still done entirely by Swift Shadows - SpriteRenderer is not used. Specifically, to have better control over draw calls, Swift Shadows also requires that sprites must come from the main texture of the material, which is basically impossible to do hen using packed sprites, since the texture is dynamic. As an alternative, Swift Shadows includes its own Sprite Packer (Tools → Lost Polygon → Swift Shadows → Sprite Packer) that is designed specifically for this case.
    Yes, is already possible for a long time. You can use SwiftShadow.Sprite and/or SwiftShadow.TextureUVRect to swap images in a succession, thus creating animation.
     
  14. zreek17

    zreek17

    Joined:
    Jun 2, 2013
    Posts:
    21
    ZimM, hello!

    I am using SwiftShadows for many enemies, and the main character on terrains, so I need to use second camera, as it is stated in Manual.
    But the problem is that these enemies are displayed above the terrain and obstacles. Take a look:

    04-24-ShadowBad.jpg

    That orc on the left is rendered above the fence and terrain, but should be rendered below.
    So is it possible to render objects via second camera in usual order, not above other objects, rendered by main camera?
     
    Last edited: Apr 24, 2017
  15. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    @ZimM -- hi man, I'm getting no shadows in the new Unity version 2017.2. Have you had time to test yet?
     
  16. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Unfortunately, it is not possible to avoid this issue with a setup like that. Perhaps you might do it with a three-camera setup, where camera 1 renders the landscape, camera 2 renders all objects with shadows, and then camera 3 renders all the other objects.
    Not yet. I'm on vacation right now, will be back at September 23 and check it out then. Did it worked in 2017.1 and stopped working in 2017.2? Try making a build to check if the issue is only when running from Editor.
     
  17. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    TagManager.GetFreeLayer(TagManager.LayerSearchDirection.LastToFirst);
    the result=-1 ?
     
  18. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Swift Shadows 1.2.4 is now live on Asset Store! It fixes some issues with Unity 2017.2 support.
    Please update to 1.2.4, the issue is fixed there.
     
    Akshara likes this.
  19. dearamy

    dearamy

    Joined:
    Mar 17, 2015
    Posts:
    68
    Does this shader support vertex color?
     
  20. isoya

    isoya

    Joined:
    Nov 16, 2015
    Posts:
    1
    Hi

    I am using this asset on unity 2017.3.1f1

    How can I cast a character`s shape shadow in this asset ?

    Now I cast only circle.

    Sorry for my poor English skill...
     
  21. ashishkushwaha

    ashishkushwaha

    Joined:
    May 12, 2015
    Posts:
    35
    Hi , working on 3d mobile game , so i wanted to ask something , is your plugin support light probe or work with real light ? because in my case i removed the light, after baking light in my scene.light probes work well lacking only shadow :(
     
  22. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Is this thread still alive?
     
  23. bromske

    bromske

    Joined:
    Sep 11, 2012
    Posts:
    28
    I hope so, 2018.3 and Swiftshadows do not work any more :(
    Sorry, no screenshots, i've removed 2018.3 and changed back to 2018.2
     
  24. Cato_xyz

    Cato_xyz

    Joined:
    May 18, 2013
    Posts:
    60
    Please update to newer versions of Unity, its totally broken
     
  25. IvyKun

    IvyKun

    Joined:
    Sep 28, 2013
    Posts:
    132
    Hi,

    Since Unity 2018.3.0, swift shadows starts throwing errors as soon as you open a project or import the package and it make unity crash in like 5 seconds.

    I wrote to support about this 3 months ago and still has no answer. So it's a pity but I think this asset is abandoned.
     
    ilmario likes this.
  26. viktorkadza

    viktorkadza

    Joined:
    Sep 4, 2018
    Posts:
    46
    Hi,
    Does this work with URP?