Search Unity

[RELEASED] Super Fast Soft Shadows

Discussion in 'Works In Progress - Archive' started by Andy-Korth, Jun 5, 2015.

  1. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    270
  2. Asusralis

    Asusralis

    Joined:
    Oct 27, 2016
    Posts:
    11
  3. Zims_

    Zims_

    Joined:
    Aug 8, 2017
    Posts:
    2
    Hey! I checked out the new feature about the boxcolliders. Feels like I'm asking for too much, but could you add it to Tilemap Colliders aswell? And make it work with Composite Collider? Also, the shadow "box" seems to be bigger than the actual object/sprite. Besides that, I must say that this is one of the best assets in Unity.
     
  4. leisim

    leisim

    Joined:
    Dec 13, 2016
    Posts:
    5
    Hi,
    Thanks for this amazing asset, I hope it will be still supported in the future. I have a small problem. I have to sprites, one in the background and one in the foreground. The sprite in the background casts a shadow on the foreground sprite. How can I solve this? I need both of them to cast shadows but the background sprite's shadow should be beneath the foreground sprite... Thanks :)
     
  5. leisim

    leisim

    Joined:
    Dec 13, 2016
    Posts:
    5
    I have a big problem when I try to copy multiple paths from a polygon collider. In the scene view, everything is fine, all paths are being copied and all shadows are correct.
    When I start the game, only the first path has a shadow in game. When I stop the game, all paths apart from the first one are gone. Sometimes there is a message "Invalid verts, attempting to set up from collider." but not always. Please help me...
     
    Last edited: Feb 3, 2019
  6. leisim

    leisim

    Joined:
    Dec 13, 2016
    Posts:
    5
    Sorry I have another question, is there a setting that a sprite does not cast a shadow on itself? Sometimes it looks super weird and I'd like to disable that.
     
  7. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    270
    Is this on Windows, and are you using system UI scaling? I had somebody local show me something that looked like that. They said they've been ignoring it since it only happens in the editor, and he figured it was because they had system UI scaling on. That's about the only lead I have to go on, and I haven't been able to replicate it myself...

    Will have to see about that. The tilemap APIs are still changing pretty fast from version to version and a version or two ago there wasn't enough information available to actually build the outline. Thanks. I know SFSS is far from perfect, but we try to make nice things. :)

    Unfortunately no. SFSS works strictly in 2D space. All of the shadows are blended together, and there is no way to separate them, and no depth information for individual shadows. A good alternative is to use the "unshadowed" material so an object receives light, but not shadows. Not quite what you want, but usually looks quite nice.

    Can you make a small replication project and PM it to me? I've never run into issues like that before.

    This is the same issue as from your previous question. There is no depth information available in the shadow map to filter out just one of the shadows. For convex objects, you can turn them inside out. For concave objects, using the unshadowed material is an option.
     
  8. duMAU

    duMAU

    Joined:
    Oct 23, 2017
    Posts:
    2
    Hi there,

    I've been using the SFS plugin for a few months now and I'm afraid I might have ran into a deal breaker issue. Our game contains several pieces of furniture at the screen at any time, each of these are divided into at least front and top sprites, and to achieve a good effect we NEED one SFSample for every one of these sprites.

    My problem is that each of the Sprites with SFSamples seem to be creating a batch of their own. I assume it's because it is altering it's material on the Start(), so creating a new instance of the material and a batch in the process.

    Is there is ANY way to go around that? Currently we have like 250-300 batches at any time and I feel like this should be about a quarter of what it is now...
     
  9. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    270
    Not really. :-\ I mean if I was writing it from scratch today I might have supported instancing off the bat. At the time instancing support in Unity was still just a dream. (It's still a crap situation on Android)

    You could modify it to pass the information through vertex attributes maybe, but IIRC it makes managing the materials a lot more convoluted. I also seem to remember running into problems making it work at all with batched geometry since the transforms get all mucked up. Like we had to explicitly disable it to prevent it from batching sprites with the same settings and destroying the transform information we needed for the effect. (I think?)

    It's certainly not impossible, I just remember running into a number of Unity constraints that I couldn't find a workaround for.
     
  10. luislodosm

    luislodosm

    Joined:
    Apr 26, 2016
    Posts:
    26
    When two shadows overlap the result is a dark black. Can it be avoided?

     

    Attached Files:

    Last edited: Feb 7, 2019
  11. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    270
    It looks like you are using semi-transparent shadows, in which case it's working as intended? Each object would block a little bit more of the light. If you just want to soften the shadows on the background layer, edit it's material and change the shadowed/unshadowed mix.
     
  12. luislodosm

    luislodosm

    Joined:
    Apr 26, 2016
    Posts:
    26
    Yes, you are right. I can reduce de shadow opacity of the boxes to less than 0.5. Thanks. 0.5 + 0.5 = full black.

    Also It would be nice to control how the opacities are added. Like: (0.8 + 0.8) * factor = 0.9. I think the result could be more realistic.

    Captura de pantalla 2019-02-12 a las 11.58.42.png
     
    Last edited: Feb 12, 2019
  13. _Morgenstern_

    _Morgenstern_

    Joined:
    Sep 29, 2015
    Posts:
    3
    Hey there! Really unspecific bug here, so you may not be able to help but I figured it's worth a shot. Perhaps you could even provide a few suggestions as to possible causes that I could look into.

    Currently working on a game where you move between various different rooms, fighting enemies as you go. The player character has a SF light under them. In the FIRST room of the level, the light flickers on and off as you move to certain areas of the room, for no apparent reason. It looks like it might be getting culled by something? In all other rooms the light remains on consistently. If I exit and re-enter the first room the light works just fine, as if the issue had never existed.

    It's probably something specific to my game, but I was wondering if there were any known issues that might be causing it? e.g. does it sometimes get angry when objects change layer?
     
  14. GKiernozek

    GKiernozek

    Joined:
    Nov 16, 2013
    Posts:
    39
    Hello, I have an issue of shadow behaving weirdly on some devices (i. e. Samsung Galaxy S8), on my Samsung Galaxy S7 it works fine. The issue is that shadow sometimes splits into few shadows on the edges like on screenshot:
     

    Attached Files:

  15. luislodosm

    luislodosm

    Joined:
    Apr 26, 2016
    Posts:
    26
    Hello. Our upcoming game, Void Mine, is made using SFShadows. The ambience improve a lot with dynamic shadows. Thanks.
     
  16. GreenPixel-ltd

    GreenPixel-ltd

    Joined:
    Jul 17, 2016
    Posts:
    17
    Hi, I'm working on the strategy game with top down camera view (RimWorld or Prison Architect like)
    and very recently I've bought your plugin since I read on the forum what it supports sunlight like effect, but I can't find the way to setup the height(aka length) of the shadows.

    So, my questions is - how could I achieve it?

    Thank you.
     
  17. GreenPixel-ltd

    GreenPixel-ltd

    Joined:
    Jul 17, 2016
    Posts:
    17
    Today I was trying to do the same things as in example of Directional light and increase the radius of light, but it doesn't work for me because I use sprites with pixel per unit = 1(don't ask why, but I have no choice) which make my scene bigger and at the same time break your algorithm.
    And I'm still hope that you have an option which I could use to setup the height of individual object
    Still waiting for any response on my email or here
     
  18. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    230
    Is there anyway of changing the Z depth in which the shadows are drawn?
     
  19. GreenPixel-ltd

    GreenPixel-ltd

    Joined:
    Jul 17, 2016
    Posts:
    17
    When I build a game for the android I see the following errors:

    RenderTexture.Create failed: format unsupported - BGR5A1 UNorm (6).
    UnityEngine.RenderTexture:GetTemporary(Int32, Int32, Int32, RenderTextureFormat)
    SFRenderer:GetTexture(Camera, Matrix4x4, Single) (at Assets/SFSoftShadows/SFRenderer.cs:336)
    SFRenderer:OnPreRender() (at Assets/SFSoftShadows/SFRenderer.cs:420)

    ArgumentException: Graphics.SetRenderTarget called with bad depth RenderBuffer.
    UnityEngine.Graphics.Internal_SetRTSimple (UnityEngine.RenderBuffer color, UnityEngine.RenderBuffer depth, System.Int32 mip, UnityEngine.CubemapFace face, System.Int32 depthSlice) <0x1512a4380 + 0x0007a> in <a875d0f2a5c44098a5bc22b856177090>:0
    UnityEngine.Graphics.SetRenderTargetImpl (UnityEngine.RenderBuffer colorBuffer, UnityEngine.RenderBuffer depthBuffer, System.Int32 mipLevel, UnityEngine.CubemapFace face, System.Int32 depthSlice) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Graphics.cs:191)
    UnityEngine.Graphics.SetRenderTargetImpl (UnityEngine.RenderTexture rt, System.Int32 mipLevel, UnityEngine.CubemapFace face, System.Int32 depthSlice) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Graphics.cs:196)
    UnityEngine.Graphics.SetRenderTarget (UnityEngine.RenderTexture rt, System.Int32 mipLevel, UnityEngine.CubemapFace face, System.Int32 depthSlice) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Graphics.cs:208)
    UnityEngine.Graphics.SetRenderTarget (UnityEngine.RenderTexture rt) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Graphics_BindingsOverloads.cs:365)
    SFRenderer.RenderLightMap (UnityEngine.Matrix4x4 viewMatrix, UnityEngine.Matrix4x4 projection, UnityEngine.Matrix4x4 vpMatrix, UnityEngine.RenderTexture target, System.Collections.Generic.List`1[T] lights, System.Collections.Generic.List`1[T] polys, UnityEngine.Color ambient, System.Boolean hdr) (at Assets/SFSoftShadows/SFRenderer.cs:286)
    SFRenderer.OnPreRender () (at Assets/SFSoftShadows/SFRenderer.cs:421)


    How could I fix it?
    I use unity 18.3.9f

    Hope thread is nod dead ...
     
  20. GreenPixel-ltd

    GreenPixel-ltd

    Joined:
    Jul 17, 2016
    Posts:
    17
    it is dead... ok, looks like I have to change my review on that plugin
     
  21. tuqire

    tuqire

    Joined:
    Mar 3, 2019
    Posts:
    10
    Hi, I bought this plugin yesterday and seems good so far.

    However, I am having a problem that should have a simple fix, but I seem to be massively struggling.

    I am trying to attach my light source to a object so have made it its child. This bit is working fine, the light source follows the object and emits from its position. However, I presumed that would also mean when the object went our of sight so would the light source, but this does not seem to be the case. It always lights the object obstructing the parent from view, which obviously is not what I want. Can someone help with this please?
     
  22. aidenwain

    aidenwain

    Joined:
    Jun 1, 2019
    Posts:
    10
    This plugin is super awesome. The shandow is real and easy to set.
    but i have some problem. When i open the DEMO scenes in SFSoftShadowDemos folder, the light seems like only works in each block area. Light cannot cover the full picture. So how to solve the problem?Please see this . THX
     

    Attached Files:

    • 2.PNG
      2.PNG
      File size:
      224.3 KB
      Views:
      591
  23. jkaloger

    jkaloger

    Joined:
    Nov 8, 2018
    Posts:
    1
    Hi is there any way to create a 2.5D effect similar to the SFSampler on a tilemap? since theres only 1 sample point, the whole tilemap changes.
     
  24. Sharlatan

    Sharlatan

    Joined:
    Jul 23, 2013
    Posts:
    111
    Now that this project has officially practically been abandoned according to the asset store page

    , I hope you don't mind me asking in this thread: Does anyone know if there currently exist any similar products that fill this void?

    I understand this project being abandoned if it costs more than it makes the devs, everyone needs to eat at the end of the day.
    But it's a real shame none the less. It's exactly what I was looking for for my project but since my project will take a few more years until it's completed, I really don't have much use for an asset that might stop working even with the next update and will never support current and upcoming Unity technologies like LWRP, HDRP, etc :(
     
  25. XxPleYxX

    XxPleYxX

    Joined:
    Jul 26, 2011
    Posts:
    41
    The shadows seem to be displaced and turned vertically in device (iOS / 2019.3.0f3), does anyone know why? It seems to be ok in editor
     
  26. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I have sort of managed to get the collder path info from composite collider 2d for tilemap, but I get bunch of errors and no shadow.. sad

    Also... I want shadow casting without scatter color enabled.. enabling scatter just makes everything foggy.
     
    Last edited: Feb 13, 2020
  27. vvvey

    vvvey

    Joined:
    Aug 13, 2016
    Posts:
    7
    Is it possible to see how "lit" a pixel on the screen is?

    For example
    • If there is no light at all, decrease chance of enemies spotting you
    • If there is lots of light, increase chance of enemies spotting you

    Thanks!
     
  28. maltakereuz

    maltakereuz

    Joined:
    Mar 29, 2015
    Posts:
    53
    Hi, i have some strange warning on start. Actually everything works fine, but some Init code makes RenderTextureFormat.ARGB1555 textures, which are not supported (at my nvidia960 at least). Can i workaround/fix this somehow?



    Indeed, SFRenderer.cs has two fields defined like that:

    Code (CSharp):
    1.     private RenderTextureFormat lightmapFormat = RenderTextureFormat.ARGB1555;
    2.     private RenderTextureFormat lightmapFormatHDR = RenderTextureFormat.ARGB1555;
    Should i just change them to R8G8B8A8_UNorm? Is it safe?
     
  29. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    270
    That's odd... The only reason why the 16 bit format was set as the fallback is because some old Android devices didn't even support 32 bit framebuffer formats at all. It's really suspicious that your desktop GPU wouldn't support 32 bit RGBA formats if it's from the last two decades. Also really weird that Unity is listing the GraphicsFormat enum names from the experimental packages.