Search Unity

Sunshine! - Official Thread

Discussion in 'Assets and Asset Store' started by PolyVector, Aug 1, 2013.

  1. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It should be no different than other shader packages. Just follow the steps in the documentation for modifying shaders to support Sunshine in the Forward path. I would recommend using the SUNSHINE_PUREPIXEL define to simplify the process so you don't have to touch any vertex shaders since they can be complicated in RTP.

    Most likely, you'll add this (or similar) to the CGPROGRAM section of the shader:
    Code (csharp):
    1. // Do everything in the Pixel Shader
    2. #define SUNSHINE_PUREPIXEL
    3.  
    4. // Include Sunshine functionality:
    5. #include "Assets/Sunshine/Shaders/Sunshine.cginc"
    6.  
    7. // Multi-compile for different filters:
    8. #pragma multi_compile SUNSHINE_DISABLED SUNSHINE_FILTER_PCF_4x4 SUNSHINE_FILTER_PCF_3x3 SUNSHINE_FILTER_PCF_2x2 SUNSHINE_FILTER_HARD
    I hope this helps,
    Oren
     
  2. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    So ... it's kind of like reverse super-sampling? Maybe they just got their sources mixed up.
     
  3. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    Forgive me for being blunt, but, is this asset still under development or has Unity's lighting changes made it obsolete-ish? I'm very interested in buying it, but I don't want to buy something that is going to quickly be eclipsed by standard Unity features.

    Thanks :)
     
  4. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    What Unity features would eclipse Sunshine? (j/c)
     
  5. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    Unity's new Moon feature, of course ....
     
  6. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    link?

    Also, beyond the obvious feature set, Sunshine offers custom shadow mapping which some may prefer to Unity shadow cascades (etc.)
     
  7. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I'll have to look into it. Without taking time to setup an experiment to test, is Sunshine shadow mapping more performant than Unity shadows, in general?
     
  8. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    That's a good question, I'll try to put Sunshine into perspective: Sunshine was originally intended to be purely a Volumetric Scatter solution, but at the time Unity (3.x) didn't support any means of hooking into the underlying shadow mapping. This is why Sunshine implements a custom shadow mapping solution.

    In Unity 5.x they've added some cool features that allow for the possibility of a "pure" scatter solution. The Unity Tech Scatter sample on the Asset Store has never worked on my machine (Mac OS X), but I suspect that once they perfect this it will become a built-in part of Unity (or at least the standard image effects). There is also a 3rd party solution on the Asset Store (I forget the name) that supposedly has better compatibility, so this might be an alternative to look into.

    Sunshine seems to be mostly purchased for the custom shadowmapping these days, for people who have strange requirements that the built-in shadows don't meet (custom camera projections, massive scenes, etc). I can't say it's all-things-to-all-people, so it all depends on your requirements.

    Cheers,
    Oren
     
  9. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    Thanks for the reply, Oren - that's good information. I'm still going to look into the feature set as I'm working with a pretty big scene right now and it would be nice to have better distant shadows.
     
  10. TristanKubity

    TristanKubity

    Joined:
    Jul 20, 2017
    Posts:
    5
    Hi,
    My company is using sunshine to render shadows, and I'm trying my best but I can't display shadows ! I tried all of what is written in the documentation but it just doesn't work.. I'm using Unity 5.6.1f1 and I think that you guys can help me !
    Thank you for your attention !
     
  11. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hello,
    I'm sorry your having trouble with Sunshine. Here's what I would check first:
    1) Make sure you have the latest version on the Asset Store
    2) Make sure you have Sunshine's "Screen Deferred" shader selected in your Project Settings->Graphics settings.
    3) Make sure the Sunshine prefab is in your scene and "Custom Shadows" is checked.

    If it's still not working, feel free to PM me a small project and I can investigate any configuration or compatibility issues.

    I hope this helps!

    Cheers,
    Oren

    Edit: I misspoke about the deferred shader.
     
    Last edited: Sep 22, 2017
  12. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    Is Sunshine ready for use in 2017.1 yet?
     
  13. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It seems to be working, but let us know if you run into any issues and we'll try our best to correct them. :)
     
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    I'm not sure if this is a bug or if I'm doing something wrong, but when I click "Custom Shadow Mapping" my shadows in the game view disappear. Shadows in the scene view are still present.

    I put the Sunshine prefab in the scene, put the Sunshine Camera script on the Main Camera, linked the directional light in the Sunshine prefab, and plugged in the Sunshine-DeferredShading under Edit > Project Settings > Graphics.

    When I didn't get it working, I thought I would try adding Shadow Softener, because in the past I always used them together. So I added the ShadowSoftener-ScreenSpaceShadows.

    So for now I'm leaving Custom Shadow Mapping on the prefab unchecked, and I'm getting shadows.
     
  15. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I just ran a test with Unity 2017.1 on MacOS with the latest Sunshine sample scene and everything seemed to work. Make sure you have the latest Sunshine, and try restarting your editor. If the problem persists, feel free to send me a project (PM or email) and I'll see i there's some combination of settings that's causing problem.

    If you plan on using Shadow Softener with Sunshine, you can't use Sunshine's Custom Shadows anyway, but it should have worked with just Sunshine.

    Cheers,
    Oren
     
  16. TristanKubity

    TristanKubity

    Joined:
    Jul 20, 2017
    Posts:
    5
    Hello, thank you for your reply and sorry for the time I took to do so.
    I investigated a lot about my issues and it appears to be working with Unity 5.5.2f1. I also tested with the 1.8.5 version of Sunshine and it's not working neither. I'm still waiting for my leads to send me the 1.8.6 version, so I'll come back later to tell you if it's working fine or not.

    Thank you again, hope I'll be able to have it working soon !

    EDIT :

    Not working in 5.6.1f1 with Sunshine 1.8.6, I'm going to try with Unity 5.6.0f3 !
     
    Last edited: Sep 22, 2017
  17. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I just booted into Windows and tested 5.6.1f with Sunshine 1.8.6 and the test scene appeared to work fine.

    I tried it with Custom Shadows On/Off, with DX9 and DX11, and with Deferred/Forward. Deferred required configuring the Project Settings/Graphics/Deferred shader (I misspoke earlier when I said "Screen space shadows").

    Remember that using Custom Shadows with Forward rendering requires modified shaders (like the included "Sunshine/xxx" shaders).

    I'm sorry you're experiencing this issue, feel free to send me a project file and I'll investigate further.

    Cheers,
    Oren.
     
  18. TristanKubity

    TristanKubity

    Joined:
    Jul 20, 2017
    Posts:
    5
    I get it working with Unity 5.6.0f3, but not with 5.6.1f1 ! It's good enough for me, I'll investigate later to see what can change between those versions !
    Thank you for your reply and your attention !

    EDIT :

    I don't know if I told it, but I'm using Sunshine in an Android VR project, so maybe the changes between those 2 versions of Unity in VR are creating my problem ?

    The boring thing is that the Lightmap is well computed but it seems that it's not applied.. The sample scene works well !
     
    Last edited: Sep 25, 2017
  19. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    I've got sunshine working great, and successfully integrated into my forward shader.

    But it seems Volumetric Scattering does not work in Single Pass Stereo. Presenting a doubled image... I tried fixing this myself my adding stereo macros to the relevant part of the shader... But had 'weird' results, got close but not quite there.... Anyone who's got this working, or is there a fix for it?
     
  20. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Unfortunately, I worked exhaustively with a user the other month, and we couldn't find a reliable solution to this problem. I managed to fix it on my machine, but not his, so I didn't consider it solid enough for release. The only workaround at the moment is to use Multipass, which I know isn't as good with performance.

    Cheers,
    Oren
     
  21. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Ok, I'm already at my draw call limit... So multipass isn't much of an option...
    Would you be willing to share the version you got working locally, and I'll compare it with what I came up with...... And if I have any lightbulb moments with it after having a play I'll report back?
     
  22. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Of course, I'll PM you the most recent patch in a sec.
    Cheers,
    Oren
     
  23. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Does this support mixed mode lighting?

    My scene topology is a single directional light and everything else baked... But as soon as a bake a lightmap for a mesh Sunshine switches off shadow rendering for it.... Is this expected behaviour or did I mess up modding my forward shader?
     
  24. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    I should add for completeness, I made the vertex modifications to the Amplify Texture 2 shaders.... And it would not kill me to use Unities shadows.... I'm mostly here for the atmospheric scattering.
     
  25. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Sunshine doesn't support the newer Mixed Mode lighting features. I've found it nearly impossible to keep up with their internal lightmap changes since there's no provisions for custom shadowmapping. For these modes, I would recommend what you suggested and just use the Scattering effect on top of the built-in shadows. This is much easier to manage as well since you don't need to modify forward shaders.

    Cheers,
    Oren
     
  26. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I don't think I've ever noticed this, but Sunshine is not dynamic, is it?
     
    Last edited: Nov 1, 2017
  27. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It's definitely dynamic, and it should update every frame unless you're using an "Interval" or "Manual" update settings. If you mean rotation around the Z axis, it will ignore that as it works out it's own matrices based solely on the .forward vector of the light.
     
  28. fisherman_b

    fisherman_b

    Joined:
    Dec 18, 2014
    Posts:
    36
    R.I.P.

    Deprecated Project

    Unfortunately, the project you're looking for has been deprecated. This means it was no longer viable for us to continue development.
     
  29. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Yeah, it was a tough decision. Unity has come so far with the built-in shadows and Command Buffers, and now there are volume light packages that support all light types, Sunshine's approach is outdated.

    We'll do our best to support existing users, and you can still access Sunshine from the Asset Store if you previously purchased it.

    Cheers,
    Oren
     
    buttmatrix likes this.
  30. Seto

    Seto

    Joined:
    Oct 10, 2010
    Posts:
    243
    and now there are volume light packages that support all light types, Sunshine's approach is outdated.

    Could you please recommend some of them?
     
  31. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I don't have firsthand experience but the assets that look compelling to me (in no particular order) are:

    The use of CommandBuffers to integrate with the built-in shadowmaps is brilliant, I would have loved this ability when I designed Sunshine back in Unity 3.x. I'm thrilled to see how much progress has been made in this area, even if it obviates my old approach.

    Cheers,
    Oren
     
  32. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Oh man, i really planned a few month ago to buy it for my mobile game because there are no fast realtime shadows for mobile(which can be used for a large envirement)...and now its gone... is there no way to buy it anymore? or could you maybe post a dl link? I really need Sunshine, nothing else... please think about it :/
     
  33. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    which package do you recommend instead of Sunshine for mobile?
     
  34. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Sorry, we're not distributing copies.

    It depends on what you want to accomplish. For faster shadows I would look into Unity's new built-in shadow Light Modes, specifically the Shadowmask mode:


    For volumetric light, check out the packages I linked to in my last post. Since they're based on the built-in shadows they should benefit from the new Light Modes.

    Cheers,
    Oren
     
  35. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    I've just checked shadowmask and it's not fixable on mobile... if you have a large terrain, it would create a huge texture (like baking the lighting)... which looks horrible. Not sure how that can be a replacement of the old Sunshine which was fast and looked fine.
     
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    Sunshine was very good and I would like to see it continue too. But I can also see where after a few years maybe developer fatigue creeps in, and the desire to keep up with Unity's constant engine releases wanes.

    For shadows, probably the go-to plugin is NGSS. It's on sale right now, so it's a good time to buy and it's super cheap. Having said that, I believe there may be Unity bugs related to shadows on mobile that you might not be able to get around at this point. I'm a desktop-only developer, so I'm not on top of it, but I think it's been discussed in the NGSS thread.

    As for volumetric light ... the free versions have limitations related to transparency and aren't actively supported. I believe there are a few modestly priced versions of volumetric light that have recently been released in the store, but I haven't kept up with them. HX Volumetric Light is probably the only complete solution, where the advantage is it works with not just a single directional light (like Sunshine), but will work with directional, spot, and point lights, and it supports transparency (though transparency can be tricky in deferred, as a general rule).

    So yes, you have to get two different plugins to do what Sunshine did, but they work together and are cheaper than Sunshine.

    (EDIT: I just read on the NGSS forum that a fix for mobile is expected soon.)
     
    Last edited: Dec 5, 2017
    Rensoburro_Taki likes this.
  37. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    why this package is depreciated ? looks cool though. please come back.
     
    atomicjoe likes this.