1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

[RELEASED] Super Fast Soft Shadows

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

  1. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    174
    Super Fast Soft Shadows is currently on sale. Get it while it's hot! https://www.assetstore.unity3d.com/en/#!/content/38682

    @Haapavuo Sorry about the cookie texture confusion. We didn't realize our colored light cookie changes broke some texture configurations and it sort of got rushed to release along with the Unity 5.6 fixes. :-\

    On a somewhat exciting note, I've potentially come up with a way to do normal mapped lighting in SFSS using Fourier series instead of forward rendering. It should be also have good performance when rendering many lights, since an object won't require a separate rendering pass for every light. It, won't work for sure on GLES 2 mobile devices, but I'm optimistic about performance on Metal/GLES 3 capable devices.

    There's some more information on how it works here: https://www.shadertoy.com/view/ld2cW1
    [​IMG]
     
    Zehru and Haapavuo like this.
  2. Lechuza

    Lechuza

    Joined:
    Oct 3, 2014
    Posts:
    10
    Was wondering, how difficult would it be to not render any lights or light cookies when inside a fsplolygon? Where should I start about doing that? Any pointers are welcome. Thanks!

    Also, I wanted to praise your work, my game wouldn't look half as good if it wasn't for this!
     
  3. Andy-Korth

    Andy-Korth

    Joined:
    Jun 7, 2013
    Posts:
    117
    We just got a bug report where a user was getting garbage shadows when excluding polys and lights using the Shadowed Layers feature. The fix is to add the if and continue to SFLight.cs, line 135.

    Code (CSharp):
    1.     public Mesh _BuildShadowMesh(Mesh mesh, List<SFPolygon> polys, float minLightPenetration){
    2.         var segments = 0;
    3.         for(int i = 0; i < polys.Count; i++){
    4.             if( (polys[i].shadowLayers & this.shadowLayers) == 0){
    5.                 continue;
    6.             }
    7.             var poly = polys[i];
    8.             segments += poly.verts.Length - (poly.looped ? 0 : 1);
    9.         }
    10.  
    You don't really need to worry about this unless you're using the shadowed layers in your project and seeing problems with them. This fix and cleaning up some of the 5.6 warnings will be in the next point release.
     
  4. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    174
    @Lechuza Do you mean when a light intersects a polygon, the shadows can go haywire? Unfortunately there really isn't a good solution to that other than not letting lights go inside of polygons. I don't really know of a lighting system at all that does handle it, properly, or what the "proper" way to handle it is. :-\
     
  5. Lechuza

    Lechuza

    Joined:
    Oct 3, 2014
    Posts:
    10
    I just wanted to say thank you for such a great system you guys have built here. I particularly found it really easy to use and a breeze to integrate with other systems in our game, specially how easy it was to create SFPolygons from the collision data created by the Tilemap System. Lights are really easy to configure and setup too!

    Here is an in development screenshot from our game, hope you guys like it!

    [​IMG]

    Addendum:
    Couldn't help to make a comparison screenshot with the SFRenderer enabled and disabled. Let's play a game, you have to guess on which side it is enabled :D

    [​IMG]

    [​IMG]

    What a difference it makes!
    Thanks again for such a wonderful asset and a fast and efficient support!

    -The Aphellion Team
     
    Last edited: Apr 27, 2017
    Andy-Korth likes this.
  6. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    174
    Very nice! :D Your art is good by itself, though the shadows certainly add a lot. Maybe I'm just biased though. ;)
     
  7. Lechuza

    Lechuza

    Joined:
    Oct 3, 2014
    Posts:
    10
    Is there a way to have shadows on any XY plane, not just the one where Z == 0?
    Working on orbits right now and they are on 3d, the spaceships normal always is (0, 0, -1) though, so it always looks along the Z. Just wondering if there's anything I can do about that? Parallax lights don't seem to work on my case. The camera always needs to be on Z < 0 to see the shadows.
     
    Last edited: May 5, 2017
  8. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    174
    Unfortunately not yet, though it's basically at the top of the to do list at this point.

    I'm currently mildly crunching on a console contract for my day job, and we have a deadline coming up in 2 weeks, so I'm unlikely to look at it before then. Maybe @Andy-Korth wants to take a crack at it though. ;)
     
  9. Lechuza

    Lechuza

    Joined:
    Oct 3, 2014
    Posts:
    10
    Happy to know that it is planned and on top of the list! You guys are amazing! I'll wait for one of you to take a crack at it, you will definitely do a better job than what I can come up with messing around with it, so I will wait. Good luck with the contract!
     
  10. Epsilon2

    Epsilon2

    Joined:
    Apr 24, 2016
    Posts:
    7
    Hello, guys! Thanks for your great asset again!

    I am using it for about an year and I feel it very wonderful and confortable to use.

    One question: how can I have additional "stencil mask" input texture for SFShadowed and SFUnshadowed materials? I need to have my Sprites initially cutted by mask texture and then correctly lighted by SFSS.

    Do you have shaders modified for additional mask or may you tell me how can I add this thing?

    My first idea was to get your SFShadows shader and add stencil mask support to it. But I am very bad in shaders and also I think you could be already have better solution for this.

    Thanks.
     
    Last edited: May 13, 2017
  11. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    15
    Awesome! :) Any news on that normal mapping feature? Will you be implementing it into SFSS?

    Also, are you going to fix the cookie texture bug any time soon? I am still waiting for a solution to fix the problem.
     
  12. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    174
    @Epsilon2
    Do you mean hardware stencil masking like in the UI system, where a separate game object masks your sprite? Or do you mean just having a second alpha texture on the material that also masks the sprite? Stencil masking is kinda complicated to do, your best bet would be to look at how the UI system does it and modify that to your needs. Adding an extra alpha texture would be a few lines of changes, I could walk you through that.

    @Haapavuo
    Yeah, I'm pretty excited about the normal mapping feature, but it's going to take a while. I have to rewrite about half of SFSS to do it, and I'm coming up on a lot of deadlines on a console game project at work. It's also sort of blocked by a couple Unity bugs with rendering to array textures. Until that's fixed, it would have to be implemented in a really inefficient way. :( When the game ships in August, I'll have some free time to work on it, and hopefully the Unity bugs will be fixed too.

    As for the cookie bug. You just have to change your texture import settings like was discussed earlier (as RGB(A) instead of an alpha texture). The "bug" was that we meant to make the transition seamless, and it's too late for that...
     
  13. davrm

    davrm

    Joined:
    Jan 31, 2017
    Posts:
    2
    Hello guys,

    First of all, tell you that you have a fantastic asset which is helping us to create a very good game. I was wondering how it would be possible to change the code so that the ambien light was a grayscale while the light zone continued to have color, like a type of fog war.

    Example:

    Original:
    [​IMG]

    With GrayScale:

    [​IMG]

    Thanks
     
  14. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    174
    It would certainly be possible, but you'd have to modify the SFSoftShadow shader.

    Off the top of my head, you'd want to replace this line:
    color.rgb *= (lerp(light, _SFAmbientLight, _AmbientOnlyMix) + _Glow) *_SFExposure*color.a;

    with something like this:
    float grey = dot(color.rgb, float3(0.3, 0.6, 0.1));
    color.rgb = lerp(grey.rrr, color.rgb, saturate(light.r));

    Basically it uses the light level as a mask to let the color through. So you'll want to use plain white lights, and no ambient. You could also use something like the code above to make a variation that fades the alpha of a sprite that isn't lit. If you want to mix this effect with regular lights, that will require a lot more custom modification, but it could also be done.
     
  15. davrm

    davrm

    Joined:
    Jan 31, 2017
    Posts:
    2

    Thank you, Looks very good. Now I have to fix the problem you discuss with the alpha of a sprite that isn't lit.
     
  16. jonijoba

    jonijoba

    Joined:
    Jul 17, 2013
    Posts:
    7
    Hi!
    Got some troubles with the last version 4.0.2 on Unity4.7.2.
    Simply create a new project with only Super Fast Soft Shadows and try to launch a demo scene.
    I'm currently stuck on a black screen.
    Please let me know if you meet the same trouble, your asset is unusable at the moment.
    Thanks by advance for the solution,
    Joni
     
  17. Andy-Korth

    Andy-Korth

    Joined:
    Jun 7, 2013
    Posts:
    117
    Hi jonijoba, Unity 4.7.2 is pretty old, the last version of Super Fast Soft Shadows that supported Unity 4 was the October 7, 2015 upload. Unity has changed their API very significantly since then, so new versions of SFSS definitely won't work in Unity 4.

    If you download the asset from within Unity, you should get the proper version of the asset for your version of Unity. I'm not sure if that actually works all the way back to Unity 4.7.2.

    The version number should be SFSS 1.4 for that unity version. If you aren't able to get that old version, let me know and I will send you the SFSS for your version of Unity. Keep in mind all the new features mentioned in this forum post aren't in the Oct 2015 version of SFSS.
     
  18. Andy-Korth

    Andy-Korth

    Joined:
    Jun 7, 2013
    Posts:
    117
    Super Fast Soft Shadows version 4.0.2 was posted last week! It contains a bunch of warning fixes for Unity 5.6.x and adds a little bit of profiling information.
     
    Zehru likes this.
  19. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    63
    Wow! this will be awesome!