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
    That demo looks pretty awesome, nice job!

    And yup, I can confirm that Sunshine now works with the free Personal edition. ;)

    Edit: Oops, bumped the announcement off the page...

    Sunshine 1.7.0 is Available in the Unity Asset Store!
     
    superme2012 and LampRabbit like this.
  2. LampRabbit

    LampRabbit

    Joined:
    Jan 31, 2013
    Posts:
    30
    Just bought Sunshine and it's pretty sweet so far.

    Was wondering if there is a way to offset where the lightmap renders from the camera. So in the image, the red area isn't seen by the camera and is wasted. If we could offset this we could increase the resolution.
     

    Attached Files:

  3. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
    Hello,

    We are trying to use your solution with Unity 5. It gives some errors every time we changed a value on configuration inside Editor/Inspector
    "This custom render path shader needs to have at least 2 passes."

    Also, selecting the "Sunshine-DeferredShading" it gives us this error only.
    Can you help us? I cannot find a support email anywhere.

    EDIT: with Forward as render it does not give me any error, but also it does not work at all (but we need Deferred instead)

    EDIT 2: if we do not use "Custom Shadow Mapping" then it gives no errors. But it does not work at all also...
     
    Last edited: Mar 6, 2015
  4. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Edit: My response here vanished! Oops.
    Yes, you can manually control the shadow bounds by using the "Custom Bounds" feature. It is limited to a single cascade and shadows no longer fade out. If these restrictions are suitable, you simply need to make sure that the Custom Bounds center/radius fully encompass the visible area of your level.

    Hope this helps!

    Strange. I've tested on both Mac+Windows and can't seem to reproduce this. This version is a pretty big overhaul, if you had a previous version I'm wondering if some of the files were imported as duplicates like "Sunshine 1.cginc".

    You could try deleting the Sunshine folder and import it again from the Asset Store.

    If that's not a solution, please feel free to PM me a small project that demonstrates the issue, and I'll see if I can find the cause. In the mean time I'll try to reproduce the error.

    -Oren
     
  5. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
    Hello Oren,

    We just got back trying what you said and yes... import again fixed the problem. But we still don't know what happened, it was the first time we used. Anyway, thanks, we should have tried this before.
     
  6. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Strange that it was your first import, but glad it fixed it.

    I had a somewhat similar problem with 'pink' deferred shaders that made no sense as they were compiling error-free. That mysteriously resolved itself without intervention, so maybe these are just Unity 5 growing pains.
     
  7. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
    Yes Oren, thanks.
    And we had that "pink" deferred problem also =) (it was the first problem, then we had that other I told before). Now all solved.
     
  8. PatataFrita

    PatataFrita

    Joined:
    Oct 17, 2014
    Posts:
    50
    I need something as seen in the scene window of this video:



    Obviously the asset of this video is much simpler than what you've created, but it is for you do an idea of what I need, see the rays from any perspective of the camera, not necessarily in first person. So I could use Sunshine in an isometric or Top-Down game.

    If you plan to add this feature in the future, I'll buy without hesitation. :)

    Thanks for the help.
     
  9. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Sunshine's light rays should be viewable from any angle using orthographic cameras, my only compatibility concern is if you're manually customizing the projection matrix it may not work properly. Another issue is that Sunshine might look "washed out" in an outdoor top-down game, since most of the volume is open to sunlight.
     
  10. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Hi there PolyVector,

    A question about performance:

    In Unity 5, if im using Volumetric Scattering from sunshine, is better to use the custom shadow mapping from sunshine or the integrated shadow system from unity5?
     
  11. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    If you're using Volumetric Scatter, then you will probably see better performance using Custom Shadows. This is simply because the same lightmap can be reused for both Scatter+Shadows. I say 'probably' because Unity appears to have improved performance of their shadows quite a bit, so it may depend on where your game's bottlenecks are.
     
  12. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Ok, thanks for the point.

    Im trying to use custom shadows in unity 5, but they dont work. They should work in the official release or you are still working on it? (using deferred render).
     
  13. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    If you're running the latest Unity and Sunshine, they should work together. We got Sunshine all up-to-date last week. Make sure you've selected Sunshine's Deferred shader in Edit->Project Settings->Graphics.
     
  14. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Yes I did, but is very buggy and the fps drop is huge. The projected shadows in alpha cut shaders like SpeedTree dont work coprrectly. Im running latest unity 5.
     
  15. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I'll look into this, sounds like I may have missed some changes in the CameraDepth shader that need to be adapted for Sunshine's Occluder shader.
     
  16. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    After taking a look it does appear they've added a "DisableBatching" Tag which isn't in Sunshine's Occluder shader, so that may be causing problems. I've added this for the next release.

    As for performance, Sunshine's Inspector can cause some slowdown, especially with the Lightmap debug view, so make sure you don't have this open.

    Edit: I've been digging into the SpeedTree shaders, and it appears they are doings something fairly odd. They are clipping just like a TransparentCutout, but reporting the RenderType as "Opaque". They also don't define a custom RenderType making it impossible for Sunshine to differentiate and make sure shadows match the object.

    The only solution I can think of is to offer replacement SpeedTree shaders, which I'll certainly look into including in a future update. For the time being, it might be best to use Scatter without Custom Shadows.
     
    Last edited: Mar 10, 2015
  17. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Thanks for all the efforts you are doing to fix this issues!
     
    Last edited: Mar 10, 2015
    hopeful likes this.
  18. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Sunshine 1.7.1 is Available in the Unity Asset Store
    • Added SpeedTree Shader Replacement
    • Added "LOD Fix" option that solves a number of issues related to LODGroups and similar features of Unity.
    • Improved Light Bias and NormalBias integration with Unity 5
    • Cleaned up old TerrainShaders, removed unnecessary Overrides and Fallbacks...
    • Updated Documentation
     
  19. Rico21745

    Rico21745

    Joined:
    Apr 25, 2012
    Posts:
    409
    Hmm is anyone else having problems getting Sunshine to work at all in Unity 5? Ever since the upgrade my old version of Sunshine stopped working due to shader errors. I went to download the latest version since I saw it was Unity 5 ready, but now all I get is this, and pointing it to the right shader (I assume, Hidden/Sunshine/Occluder) and clicking fix does nothing.

    upload_2015-3-13_2-36-42.png

    Further digging, this is what I see after I reimport Sunshine's latest version:
    upload_2015-3-13_2-37-45.png

    I wanted to try a reinstall/install but sadly I cannot use the Sunshine uninstall since as you can see, the option is not there due to the shader message replacing the whole interface for the prefab, thus no uninstall option. I tried deleting the whole folder in Unity and reimporting, but same results.

    I'm assuming Sunshine is placing some shaders in other areas outside of it's own folder, and I'm guessing the uninstall feature removes those. Any instructions for manual cleanup perhaps?

    Any ideas? Kind of a showstopper :-/
     
  20. timbo89

    timbo89

    Joined:
    Oct 7, 2012
    Posts:
    3
    I'm also having issues with sunshine 1.7.1 and unity 5. Bizarrely everything seemed to be working as expected, but for some reason its just totally stopped working today. The sunshine post process script isn't enabling itself (no matter how many times I try to click) . It appears I can't uninstall sunshine as there's no button to do so anywhere. I also dont have the button to install forward shaders as an attempt to fix the problem. I'm working on a commercial project that has a looming deadline ... so a prompt response would be appreciated.
     
    ill_tonkso likes this.
  21. Stiffx

    Stiffx

    Joined:
    Oct 27, 2014
    Posts:
    455
    Beautiful :rolleyes: keep it up
     
  22. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Well I installed the new sunshine 1.7.1 in a new project and I get this on console:

    Code (CSharp):
    1. Sunshine 1.7.1: Occluder Shader Not Supported...
    2. UnityEngine.Debug:Log(Object)
    3. Sunshine:LogMessage(String, Boolean) (at Assets/Sunshine/Scripts/Sunshine.cs:17)
    4. Sunshine:Setup() (at Assets/Sunshine/Scripts/Sunshine.cs:728)
    5. Sunshine:Start() (at Assets/Sunshine/Scripts/Sunshine.cs:907)
    Then every time I hit play the sushine script is disabled and i cant enable it.

    So yes, there is something worng with this update in Unity 5.
     
    ill_tonkso likes this.
  23. ill_tonkso

    ill_tonkso

    Joined:
    Jun 12, 2013
    Posts:
    8
    I am working alongside timbo89 and I have just performed a full libraries clear and rebuild + fresh install of the Sunshine package.

    Worthy of note, the bug is persistent across scenes, including the sample scene included. My colleague has also tried a fresh project and the same thing occurred. If I could direct your attention to the attached screenshot, you may notice that we do not have the install forward shaders button as denoted in the documentation.
     

    Attached Files:

  24. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Hi there ill_tonkso,

    To enable the custom forward shaders button you have to enable first "Custom Shadow Mapping". Then more options will appear.
     
    ill_tonkso likes this.
  25. ill_tonkso

    ill_tonkso

    Joined:
    Jun 12, 2013
    Posts:
    8
    Thanks Mysh, I've done that now and I have the button. Shaders are being installed as I type.

    Edit: Righto, we are now on par with you. Just got the Sunshine Script deactivating on runtime, and we are unable to activate the Sunshine Postprocess component.
     
  26. Rycons

    Rycons

    Joined:
    Nov 23, 2013
    Posts:
    31
    I can also confirm that at runtime the Sunshine script gets disabled and cannot be enabled back.

    The Unity console is also showing the below information..

    Code (CSharp):
    1. Sunshine 1.7.1: Occluder Shader Not Supported...
    2. UnityEngine.Debug:Log(Object)
    3. Sunshine:LogMessage(String, Boolean) (at Assets/Sunshine/Scripts/Sunshine.cs:17)
    4. Sunshine:Setup() (at Assets/Sunshine/Scripts/Sunshine.cs:728)
    5. Sunshine:Update() (at Assets/Sunshine/Scripts/Sunshine.cs:924)
    6.  
     
  27. ill_tonkso

    ill_tonkso

    Joined:
    Jun 12, 2013
    Posts:
    8
    I have some progress which may help identify the source of the bug.

    I have forced the occluder error to return true in Sunchine.cs...

    Code (CSharp):
    1.         if(!OccluderShader.isSupported)
    2.         {
    3.             LogMessage("Occluder Shader Not Supported...");
    4.             if(Application.isPlaying)
    5.                 //enabled = true;
    6.             return true;
    7.         }
    ...and removed the if statment in SunshinePostprocess.cs...

    Code (CSharp):
    1.     void OnRenderImage (RenderTexture source, RenderTexture destination)
    2.     {
    3.         if(sunshineCamera == null)
    4.             sunshineCamera = GetComponent<SunshineCamera>();
    5.  
    6.         //if(sunshineCamera != null && sunshineCamera.enabled)
    7.             sunshineCamera.OnPostProcess(source, destination);
    8.         /*else
    9.         {
    10.             //This should never happen! But just in case...
    11.             //Copy the buffer this once, then disable self!
    12.             Graphics.Blit(source, destination);
    13.             enabled = false;
    14.         }*/
    15.     }
    ... and I have sunshine in the viewport, but not at runtime.
     

    Attached Files:

  28. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Looks like a problem with the DX11 variant of the Occluder shader. I may have had the "Skip Unused Variants" enabled and missed this. It is fixed for the next release which I hope to get out today.

    Sunshine never places anything outside of its folder, in fact Sunshine needs to be in its default location to work properly "Assets/Sunshine/" due to the way Unity handle's .cginc includes.


    The Post Process script enables/disables itself as needed, so if Sunshine can't do its job (ie. the Occluder shader not compiling) it will be forcibly disabled. This is perfectly normal in the event of a problem and is done to save an expensive call to OnRenderImage() by Unity, since there's no way to stop this behavior without disabling the PostProcess effect. Merely an optimization.

    Are you using the DX11 renderer by any chance? This may be the same problem Rico21745 had, and is fixed for the next release.

    Can do.
    Is this on DX11? Might be the same problem Rico21745 had again which is fixed for the next release.

    Edit: Marvelous, forum borked my reply, I'll fill it back in... :/
     
  29. ill_tonkso

    ill_tonkso

    Joined:
    Jun 12, 2013
    Posts:
    8
    Could I ask when the next release is due? We have a project deliverable coming up in the very near future and it would be very prudent to demonstrate our graphical fidelity at it's fullest.

    We are on DX11, yes :)
     
  30. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hopefully in the next hour.
     
    ill_tonkso likes this.
  31. ill_tonkso

    ill_tonkso

    Joined:
    Jun 12, 2013
    Posts:
    8
    Oh, fantastic! Thank you.
     
  32. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Sunshine 1.7.2 is Available in the Unity Asset Store
    • Fixed Occluder Shader error with DX11 variant
    Thanks everyone for your patience while we got this fixed.
     
  33. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Now sunshine is working but not correctly:
    LOD fix (wich is enabled by default) is breaking scatter effect (is like there is no occluders). If I disable LOD fix, Scatter works correctly.
     
  34. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Quick question, if you disable DX11 support and turn back on the LOD fix, does Sunshine behave properly?
     
  35. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    No, with DX9 its doing the same.
     
  36. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Strange, I've tested on Mac+Win and haven't seen this issue. Perhaps it would be safest to disable this fix by default in a quick update.
     
  37. Rycons

    Rycons

    Joined:
    Nov 23, 2013
    Posts:
    31
    @PolyVector Can you confirm that Sunshine! custom shadows are working with the deferred renderer?

    We tried testing it with the new version but only overcast shadows work.
     
  38. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Yes, it should be working in the latest Sunshine+Unity, I've been testing each release on OS X and Windows (virtualized). I'm not able to virtualize DX11 unfortunately.

    If you have "Custom Shadows" enabled and have selected the "Sunshine-DeferredShading" shader in "Edit->Project Settings->Graphics", it should be good-to-go. If you use some forward-only shaders, these will have to be swapped out for a Sunshine equivalent.
     
  39. Rycons

    Rycons

    Joined:
    Nov 23, 2013
    Posts:
    31
    @PolyVector We still can not get Sunshine! custom shadows to work with the deferred renderer. I sent you a pm with a
    sample project to troubleshoot this issue.
     
  40. Rico21745

    Rico21745

    Joined:
    Apr 25, 2012
    Posts:
    409
    Hey Polyvector,

    I downloaded the latest update, looks like the error is now in the Sunshine Post Scatter shader. Still using Windows and DX11

    upload_2015-3-13_18-59-26.png

    Noticed because Sunshine script was now telling me it couldn't find the scatter shader instead of the occlusion, so progress maybe?
     
  41. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Very strange, I just compiled every permutation of the Scatter shader and saw no errors. Have you tried reimporting it (Right-click->Reimport)?
     
  42. Logan_Booker

    Logan_Booker

    Joined:
    Jun 20, 2013
    Posts:
    3
    Hi PolyVector, we're stilling running on 4.6.3 and are keen to combine the point light shadow smoothing in Shadow Softener with the rest of Sunshine. Is there an easy way to accomplish this?

    EDIT: I should add that we've purchased (and so have access to) both assets.
     
    Last edited: Mar 14, 2015
  43. Rico21745

    Rico21745

    Joined:
    Apr 25, 2012
    Posts:
    409
    This is what I get when I try to reimport:

    upload_2015-3-14_22-55-10.png

    I tried importing into a brand new clean Unity 5 project, and here's the result:

    upload_2015-3-14_23-9-0.png
     
  44. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    The "disable LOD fix" that I mentioned before only works with the unity editor. When I build the project, scatter is working but is like there is no occluders. (tested on DX11 and DX9)
    Where is the problem?
     
  45. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Sorry for the delay guys, I was out for the weekend.

    I highly recommend updating to Unity 5 since that's where we are focusing for both packages at the moment, especially now that even free users get access to all features.

    That said, the easiest way to combine the two packages is to not use Sunshine's custom shadows at all. This means deleting the Deferred/Prepass shaders Sunshine comes with, and only using Scatter. This will allow you to use Shadow Softener as you normally would for the renderpath you choose, and Sunshine will simply work as a post process.
    This looks like the shader compiler is crashing, and not actually syntax errors. Each time an importer has crashed on my machine, I've been able to clear the console and reimport the file. I assume you're running 5.0.0f4, but are you running the 32bit or 64bit editor? I'll try some different combinations to see what's going on, but if you'd like feel free to zip up the project and PM me so I can take a look.

    I'll test this more today and see what's going on.
     
  46. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Testing more with empty projects, the problem becomes more noticiable when using Deferred and Linear color space.
     
  47. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I did find a Deferred-related bug that was screwing up the way Occluders were rendered, and appears to be the cause of everyone's LOD Fix woes. I'm also hoping that it will solve the issues you described when deploying a build.

    Should be live shortly, I'm sure Skunkie will let everyone know. :)
     
  48. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Sunshine 1.7.4 is Available in the Unity Asset Store

    • Fixed bug affecting projects with "Deferred" rendering set as default. This resolves issues ranging from "LOD Fix" to general performance.

    Thanks everyone for your patience while we sorted everything out.
     
  49. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Also, I would like to ask Sunshine users to try enabling the LOD Fix feature and report any issues with it.
     
  50. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Hi there, thanks for your amazing support.

    Now sunshine works correctly in editor with and without LOD fix, but if I build the project there is still no occluders (i tested it with LOD fix enabled and disabled).

    The only difference with LOD fix in build time is that if i have it enabled im getting this error while compiling:

    Code (CSharp):
    1. Shader error in 'Hidden/NFAA': Compiled shader code uses too many instruction slots (112). Max. allowed by the target (ps_2_0) is 96. at line 1 (on d3d9)
    2.  
    3. Compiling Fragment program
    4.  
    5. Shader error in 'Hidden/NFAA': Compiled shader code uses too many instruction slots (99). Max. allowed by the target (ps_2_0) is 96. at line 1 (on d3d9)
    6.  
    7. Compiling Fragment program
    8.  
    9. Shader error in 'Hidden/NFAA': Too many math instructions for SM2.0 (99 needed, max is 64). Try #pragma target 3.0 at line 76 (on d3d9)
    10.  
    11. Compiling Fragment program
    12.  
    13. Shader error in 'Hidden/NFAA': Too many math instructions for SM2.0 (91 needed, max is 64). Try #pragma target 3.0 at line 112 (on d3d9)
    14.  
    15. Compiling Fragment program