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
    You could try changing the values with a script using Sunshine.Instance.xxx. This way you could blend between some predefined values to make it look better at specific times of day.

    Cheers,
    Oren
     
  2. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    After a long time of gazing at this adoringly i'm looking forwards to acquiring it after the 5.4 update is done and i have the money, it still seems the most dependable flexible option for what it provides.

    One question is: The music for your assetstore video is from a demoscene release isnt it? I recognise it but I can't remember where from and it's amazing, can you say where it's from?
     
  3. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    We'll be happy to have you on board, my tests with the 5.4 beta have gone pretty well so I'm hoping to get the update out within a week of the 5.4 release.

    The music is actually just something I put together for that video, and I was going for a demo scene vibe. :)
    It probably sounds familiar because it uses loops that come with Logic, which are probably used in a lot of other songs.

    Cheers,
    Oren
     
  4. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    I'm trying to Sunshine! with marmoset skyshop but it is not simple as it looks as it is mentioned at the document.

    First, just including 'Sunshine.cginc' cause the following error:

    I guess the error pop from missing SUNSHINE_INPUT_PARAMS inside the input struct. But hard to find right input struct.

    Marmoset vert function looks as the following:

    Code (CSharp):
    1. void MarmosetVert(inout appdata_full v, out Input o) {
    2.     UNITY_INITIALIZE_OUTPUT(Input,o);
    3.     ....
    Where can I find appdata_full struct? (even not sure it is right place to put SUNSHINE_INPUT_PARAMS though)

    By the way I know I'm not the first one who try to integrate sunshine into marmoset skyshop. Is there anyone successfully integrated that?

    Thanks,

    -Kim
     
  5. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Hmm, found the appdata_full struct in the "UnityCG.cginc" file.

    Sorry for the redundant question.
     
  6. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Where the surfIN came from? Where can I find that?

    line 512 in Sunshine.cginc file
    Code (CSharp):
    1. #define SHADOW_ATTENUATION(IN) SunshineLightAttenuation(surfIN.sunshine_lightData)
     
  7. Hexaedre

    Hexaedre

    Joined:
    Jan 23, 2015
    Posts:
    110
    Hi,

    Thank you for sunshine, it fixed a bug that I have been fighting for several month.
    It's a 'must have asset' for us.

    Can you make a shader Relief Terrain Pack compatible, please ?
    Or explain how to make them work together ?
     
  8. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    surfIN is normally generated behind-the-scenes by Unity's Surface Shader system. If you're having trouble integrating Sunshine into a complex shader pack, there is a slightly easier mode in Sunshine called PUREPIXEL that allows you to skip vertex shader related code when the shader already makes use of worldPos (which Skyshop probably does). Basically you would include this code at the top of a shader's CGPROGRAM block:

    Code (csharp):
    1. #define SUNSHINE_PUREPIXEL
    2. #include "Assets/Sunshine/Shaders/Sunshine.cginc"
    3. #pragma multi_compile SUNSHINE_DISABLED SUNSHINE_FILTER_PCF_4x4 SUNSHINE_FILTER_PCF_3x3 SUNSHINE_FILTER_PCF_2x2 SUNSHINE_FILTER_HARD
    Try that, and if you are still having trouble, PM me a small project with the shader you're having trouble with and I'll try to help you integrate it with Sunshine.

    Hello,
    The PUREPIXEL suggestion I gave to kimsama probably applies to the RTP as well, try it out and see if that helps you integrate it. Of course if you're still stumped, PM me a small project and I'll try to help integrate it for you.

    Cheers,
    Oren
     
  9. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Very much thanks for that things!

    By the way where should I send the demo project? It cannot be posted here due to it contains some sorta of marmoset shaders even including sunshines and approximately over 18M. I could not find any email address on the UnitySunshine.com site.

    Let me know that where should I put the demo project.

    -Kim
     
  10. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You can either PM me a dropbox(or similar) link that you can take down after a short while, or email it to contact_AT_punklabs.com

    EDIT: I spoke too soon, just checked my PMs.

    Cheers,
    Oren
     
  11. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I've just tried out your demo project and managed to convert a few Marmoset shaders using the PUREPIXEL mode I described earlier. Here are the steps:

    • Enable Custom Shadows in Sunshine. If you don't want to use custom shadows, then the following steps aren't needed and you're already good-to-go.
    • Take a Marmoset shader such as Diffuse IBL.
    • Change the Shader name at the top to prepend "Sunshine/Marmoset/Diffuse IBL" so it's not to be confused with the original copy.
    • On the line directly under CGPROGRAM add the following code:
    Code (csharp):
    1. #define SUNSHINE_PUREPIXEL
    2. #include "Assets/Sunshine/Shaders/Sunshine.cginc"
    3. #pragma multi_compile SUNSHINE_DISABLED SUNSHINE_FILTER_PCF_4x4 SUNSHINE_FILTER_PCF_3x3 SUNSHINE_FILTER_PCF_2x2 SUNSHINE_FILTER_HARD
    I hope this helps.

    Cheers,
    Oren

    Edit: Fixed code spacing.
     
  12. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Thank you so much!

    By the way I got some bias related problem after the integration.

    sunshine-bias.png

    How can it be fixed?

    Already tried to chang to other Shdow filter setting then got the clean result, I mean without bias problem with Hard and PCF2x2 settings but those does not have the quality what I want to.
     
  13. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You'll have to adjust the Bias, and Normal Bias on your Directional Light, as well as Sunshine's Light Resolution, Light Distance, Cascade Count, and Shadow Filter settings. All 6 of those settings will affect shadow acne artifacts like the ones in your picture, and there's no one right way to configure them.

    If you focus on the settings I mentioned you should be able to eliminate the artifacts.

    Cheers,
    Oren.
     
  14. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Thank you. Forgot to adjust Bias of Directional light. Just changing directional light's bias from 0 to 0.1 solved the problem.

    sunshine-bias-solved.png

    Thanks again. It would be great if those settings are mentioned on the document. (As I remember, none of setting about directional light are mentioned on the document)
     
  15. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Sunshine 1.8.3 is Now Available in the Asset Store
    • Unity 5.4 support
    • Fixed Scatter not appearing on Android when not using 32bit buffers
    • Upgraded Standard and SpeedTree shaders
    • Upgraded Deferred and PrePass shaders
     
  16. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Screenshot (233).png Having some issues where SpeedTree cast shadows (Conifer Desktop and Broadleaf Desktop) are not animating in response to windzone (works in Editor, but not in Game view). In addition, you can see this pixelation / aliasing occurring in the above image and I have not yet discovered a way to correct it. I should note this only occurs with Sunshine shadow mapping. Suggestions?
     
    Last edited: Aug 9, 2016
  17. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It appears you've found a regression bug in the latest version. I'll submit an update, but you can fix it by editing Sunshine's SpeedTree shader, and edit the RenderType to read like this:
    Code (csharp):
    1. "RenderType"="SpeedTree"
    This RenderType is needed by Sunshine to trigger a custom SubShader in the shadow occlusion.

    I hope this helps.

    Cheers,
    Oren
     
    buttmatrix likes this.
  18. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Thanks for the suggestion Oren, I'm afraid it did not completely resolve the issue (?) Just to be clear the reference change occurs in:

    [Shader "Sunshine/Nature/SpeedTree"], Line 22 and 59 - Unity 5.4.0f3 / Windows 10 / Deferred / Linear

    You can see that the shadows are now correct (in some cases; see first image), but not in others (see second image) where light must pass through multiple occluders - in this case, several trees (?). That being said, the shadows are still not updating in realtime (in play mode) as would be expected given the windzone. Using the built-in shader, instead of 'Sunshine-DeferredShading', but keeping the Sunshine Postprocess effect on the camera, still results in higher quality sunshafts than Unity sunshafts, plus atmospheric scattering, which is nice :)
     

    Attached Files:

    Last edited: Aug 10, 2016
  19. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Interesting, maybe I jumped the gun on the RenderType fix. Make sure you are using the "LOD Fix" option in Sunshine (under Advanced). This setting is required for getting shadows to match objects that use a LODGroup.

    If that doesn't sort out your problem, feel free to PM me a small project that reproduces the issues, and I'll dig deeper into the cause.

    Cheers,
    Oren
     
  20. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I noticed you guys pushed an update with the RenderType fix, which I imported. I would be happy to send you a project, but if you just import the Standard Assets - Environment package, add a plane, and add the Conifer and Broadleaf, you will likely reproduce the effect (see Screenshot 241).

    For the attached image:
    1. Shadows update in realtime in Editor, but not in Game view (see Capture3). It's as if two shadows groups are being rendered into the Editor, but only the pixelated shadow group appears in Game view.
    2. No other image effects in stack
    3. I've extracted the LOD_0 from the SpeedTree prefab and deleted the other LOD groups
    4. Graphics = Sunshine-DeferredShading
    5. Unity 5.4.0f3 / Windows 10 / Deferred / Linear
     

    Attached Files:

  21. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I was able to reproduce the pixelated bug from your screenshots in the Scene View. Sunshine is always disabled for the Scene View because there is no way to get it properly running there, but there is a bug in Sunshine-DeferredShading making it still attempt shadows when disabled (creating glitchy pixelated shadows).

    Here's the fix for Sunshine-DeferredShading.shader on Line 51:
    Code (csharp):
    1.   // =================================== BEGIN SUNSHINE SUPPORT ===================================
    2.    #if !defined(SUNSHINE_DISABLED) && (defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE))
    3.    atten *= SunshineLightAttenuation(SUNSHINE_LIGHTDATA_FROM_WORLD(wpos));
    4.    #endif
    5.    // =================================== END SUNSHINE SUPPORT ===================================
    6.  
    This should prevent the Scene View from glitching out (I'll hold the update though until we sort this out).

    As for the Game View, Sunshine appears to work perfectly for me after I edit each of the 4 tree materials to use Sunshine/Nature/SpeedTree. For Conifer_Desktop they were:
    • Fronds_2
    • Branches_1
    • Branches_0
    • Leaves_3
    Let me know if this helps.

    Cheers,
    Oren

    Edit: Corrected the line number, OOPS!
     
    Last edited: Aug 12, 2016
  22. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    1. With Sunshine/Nature/SpeedTree shaders on trees
    2. If you wanted the change to appear as in the attached image (see Capture), then I get the following (see Capture2). Note: If I replace the lines as indicated by your response, I get pink.
    I should note that the shadows are updating according to the windzone now (+1)
     

    Attached Files:

  23. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Oops, that should have been Line 51, my mistake! It would be easier to share a project and avoid my communication errors. :)
     
    Last edited: Aug 12, 2016
  24. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Well done! Definitely working now. Thanks a lot Oren, really tremendous support :)

    EDIT: I should note the functionality starts to break down at very large light distances (>150).
     
    Last edited: Aug 15, 2016
  25. PartyBoat

    PartyBoat

    Joined:
    Oct 21, 2012
    Posts:
    97
    Hey PolyVector, I just randomly stumbled upon Sunshine today and it has me very intrigued. Specifically my eyebrows shot up at "Manually update shadows! Think of it as "baking" at runtime for level editors!" This sounds like the solution to the problem I have been thinking about for a while now.

    My scenario is that I'm making a VR game, but I want to have an in game level editor. The issue is that you pretty much have to bake lighting to have a game run well enough for VR, but at the same time there is no way to dynamically change the level and update the lighting without real-time lights.

    So I guess I'm wondering if I can get some more detail about this in-game light baking and if it would fit my use case. Is it really baked or just some kind of optimized real-time light? What is the performance like vs regular light maps or regular real-time lights? How long does the baking take? Does it only work with certain kinds of lights or a certain number? Is my scenario the primary use case for this feature or am I reading into it incorrectly?

    Sorry to ask so many questions but this has me very excited about being able to do something I thought was impossible in Unity.
     
  26. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hi PartyBoat,
    The manually updated shadows are basically the second half of a "realtime shadowmap", so the shadowmap is no longer generated every frame, but is still read from every frame. For example, this means the shadow filtering you use would affect performance.

    The benefit of this technique is that rendering a shadowmap only happens when you want it to, saving you any additional passes required by rendering shadowmap cascade(s) for when you want to perform an update. You might utilize this by updating after a level is generated using "Custom Bounds" to cover the entire level, or simply updating when you travel a certain distance. The update would be as fast as any realtime shadowmap, so in the worst case there'd be a ~1 frame hickup.

    If it's something you want to experiment with, feel free to pick up a copy as a trial. If it's not well suited for your game I can put in for a refund, no risk. :)

    Cheers,
    Oren
     
  27. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Forgive me if these questions have been asked before, but it is quite a chore to go through 22 pages of the asset thread to see everything.

    Will this run on consoles like Wii U? This seems to have it's own shadow system. Does it replace Unity's shadow system and what is the performance comparison between the two?
     
  28. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I have seen it running on Playstation 3 and 4 games, as well as the Xbox One. I'm unsure about the Wii U, but I don't see why not.

    The performance is simply different from built-in, so with different bottlenecks you will see different performance. I've noticed fill-limited games often see a benefit, but I do not have statistics. One of the reasons I designed Sunshine was a fill-limited project.

    It can replace a single Directional shadowmap, but you also have the choice to use Sunshine for Volumetric Scatter only and leave the built-in shadows untouched. This is a simpler path to integration, and allows you to use a much lower-resolution shadowmap, but can be less performant depending on the game.

    I don't want anyone stuck agonizing over the decision, so feel free to buy it on a "trial" basis. If it doesn't work out for your game I'll put in for a refund.

    I hope this helps.

    Cheers,
    Oren
     
  29. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks for the information. I may give this a try at some point once my budget allows for it.
     
  30. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    When I enable "Custom Shadow Mapping" I lose all shadows on my scene! how can I use this custom shadow?
     
  31. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It depends on if you're using Forward or Deferred rendering. You'll want to follow the steps in the documentation PDF.

    Quick version:
    Deferred: Select Sunshine's replacement Deferred shader in Project Settings/Graphics
    Forward:
    Use the provided forward shaders instead for your materials, you may need to modify any shader packages you've downloaded.

    I hope this helps.

    Cheers,
    Oren
     
  32. pgeorges-dpt

    pgeorges-dpt

    Joined:
    Apr 7, 2016
    Posts:
    43
    Hey guys,

    Will Volumetric Light Scattering only be applied to the light coming from my Directional Light or can I get the same feel from point lights, spot lights and emissive light?

    Cheers!

    Paul
     
  33. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Sunshine only works with a single Directional light, it doesn't deal with point/spot lights at all.
     
  34. pgeorges-dpt

    pgeorges-dpt

    Joined:
    Apr 7, 2016
    Posts:
    43
    OK! Thanks!
     
  35. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    Is anyone able to confirm that this is compatible with SteamVR?

    Call me lazy, but I'd rather not crawl through 22 pages with these broken forum search queries...
     
  36. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    I'm getting errors on sunshine occluder shader : undeclared identifier 'samplerunity_SpecCube1'
    if I try to add the samplerCUBE to sunshine.cginc it then tells me that there's a redefinition of the sampler.
     
  37. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    What version of Unity and Sunshine are you running?
     
  38. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    unity 5.4 p4 and sunshine 1.8.5
     
  39. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    also looks like Sunshine-DeferredShading needs an extra ../ to include Sunshine.cginc
     
  40. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I haven't had this problem in 5.4 f3, I'll investigate this and see what's changed in Unity.
     
  41. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    after reimporting all and add an extra ../ to include Sunshine.cginc in Sunshine-DeferredShading it's working now.
    Thank you!
     
  42. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    The path is correct in that file, I'm wondering if something strange has happened over the course of updating Sunshine. Maybe you should try deleting Sunshine and re-importing it.
     
  43. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Haha, you keep beating me to the punch! Glad it's working now. :)

    Cheers,
    Oren
     
  44. laergor2345

    laergor2345

    Joined:
    Jan 4, 2016
    Posts:
    7
    Just wanted to double check after seeing a post here that Sunshine! requires Unity Pro, so it won't work for the Unity Free edition?

    Also, sorry if this is repeating questions others may have asked, but I'm pretty new to the workflow of doing Lightmapping and very frustrated with Enlighten bake times and poor quality for mobile/GearVR, so I was wondering if Sunshine could substitute for the vanilla Unity lights and shadows? (do we still need to have Shadows enabled on the Unity light objects with Sunshine?)
     
  45. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I believe new versions of Unity support all graphics features now, so you should be able to use Sunshine with Unity Free.
    Sunshine only substitutes a single Realtime Directional Shadowmap. It's not really a replacement for Enlighten/Baking. You still would need the shadows enabled so that Sunshine can take over and replace them.

    I hope this answers your questions.

    Cheers,
    Oren
     
  46. Xander93

    Xander93

    Joined:
    Feb 22, 2013
    Posts:
    14
    Why would i buy sunshine can you convince me?

    Thank you,

    Xander
     
  47. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    I would love to buy Sunshine. but i need to know: does it offer raytraced realtkme shadows, how is the shadow acne compared to built in unity lighting, does it have point and spot light support and does it work with shader forge? if these are all yes then you have yourself a patron!! from what ive seen it looks amazing. sorry if my questions are redundant.
     
  48. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hello,
    I'll try my best to answer your questions:
    • The shadows are not raytraced, they are "Bilinear PCF" shadows.
    • Acne is pretty similar to built-in shadows
    • No Point or Spot light support, Sunshine is for a single Directional light.
    • It can work with shader forge, but you would need to edit the shaders it produces
    I hope this helps.

    Cheers,
    Oren
     
  49. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92

    Thank you
     
  50. lionroot

    lionroot

    Joined:
    May 1, 2014
    Posts:
    8
    Hello,

    I searched the forum for orthographic camera support, and saw that you brought it up. I couldn't tell though if you finally implemented support for orthographic cameras. Were you able to?

    Thanks!