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
    Sunshine! gives you AAA Quality Volumetric Light Scatter, and improved Soft Shadows in Unity. It takes the look of your game to a whole new level, and can even bring shadows to unsupported platforms like Tegra 3 (Unity, Nexus 7, etc)...

    Not that there's anything wrong with your current shadows...
    No judgement!

    Please ask support related questions here, and I'll do my best to sort out any issues! :cool:

    [Asset Store]

    [Website] [Webplayer Demo] [Android/Ouya Demo APK] [Documentation]





    Check out what people are doing with Sunshine!!

     
    Last edited: May 13, 2016
    balaam likes this.
  2. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I just tested the APK on my OUYA.

    IT ROCKS! :D

    One happy buyer!
     
  3. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Does this work on IOS and what kind of performance.

    Thanks.
     
  4. pulla0000

    pulla0000

    Joined:
    Jan 4, 2012
    Posts:
    7
    It looks great, i will buy if it works with spot and point lights
     
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Your website has attitude! lol

    Why does it kind of seem like the images have a low contrast, like someone took a contrast slider and reduced it? It that because of the volumetric effect? Just seems like it needs a bit of a boost. Looks cool though, nice quality.
     
  6. Almaj

    Almaj

    Joined:
    Jul 14, 2013
    Posts:
    38
    Nice but would be more awesome if it had color bleeding
     
  7. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @rocki
    I'm not sure if it works with iOS, but I see no reason why it wouldn't since it can run OpenGL ES 2.0 (which is the same as the Android support targets)... I make no promises though. ;)

    If anybody winds up trying it on iOS, please let me know the results! I'd be very interested!

    @Pulla
    Point lights will not be supported, since this system is specifically geared for Sun/Moon/Directional lighting.

    @imaginaryhuman
    Thank you. :D
    The low contrast is most likely because I exaggerated the Light Scatter in order to make the effect more obvious for people just tinkering with the demo. Also, there are no baked lightmaps/HDR or any other postprocessing in the demo, since I wanted to show Sunshine by itself.

    Scatter is similar to fog, I don't think you'll run into any sort of contrast issues.

    @Almaj
    I certainly want to investigate a simple light-bounce for a later update, but I admittedly have never attempted such a thing before. ;)
     
    Last edited: Aug 2, 2013
  8. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    I just downloaded and installed your demo on my Amazon Kindle Fire (does not support shadows). The shadows look good, but the demo ran really slowly.

    First it look about 3 min for the scene to load, then the frame rate seemed to be around 5 fps. I then installed it demo on another device and it was really slow as well. Is that the shadows causing this low fps or is it the way you set up the scene? The scene does look very simple. So I'm concerned with performance.

    Thanks,
     
    Last edited: Aug 2, 2013
  9. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @Crazy Robot
    I've only been able to test on a Tegra 3 (Ouya) and got ~30fps. I know Tegra 3 is better than a lot of chipsets out there, and fill rate can be a big issue...

    Most likely you'd needs to run Hard shadows on weaker devices to improve fps. I have plans to add Trapezoidal warping for improving Hard shadows on mobile, but that's not in 1.0.
     
  10. Almaj

    Almaj

    Joined:
    Jul 14, 2013
    Posts:
    38
  11. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @Crazy Robot:
    I was looking at some Kindle Fire benchmarks, and it sounds relatively underpowered when compared to Tegra 3.

    The Tegra 3 is probably the bare minimum chipset when it comes to Sunshine. There's valid reasons why many Android devices don't support the built-in Unity Pro shadows... However, some devices like Tegra 3 come very close in specs but lack an extension Unity requires, and this is where I think Sunshine can be useful.

    Even if I optimize Sunshine further, it doesn't sound like it would be practical on a Kindle Fire.
     
  12. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Tried the APK on a Nook HD+ with CM10.1 installed. Ran pretty smooth. Impressive! I did also run it on the Ouya just to check it out. Nice job.
     
  13. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Thanks for trying it out! I'm going to need to start a list of devices that can/can't reasonably run Sunshine. This info is very useful, thanks again. :)
     
  14. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Thanks for the info, I just ran the demo on a Nook HD. and it did run smoothly, just took forever for the scene to load. I installed it on 3 devices now and each one took an incredible amount of time for the scene to load. It that due to how you created the scene or is that due to the shadow system?

    Thanks,
     
  15. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @Crazy Robot
    The loading time problem is interesting. The demo only uses a couple shaders, so even if they are large (due to the multi-compiling) it shouldn't account for loading delay.

    I'll have to investigate this further, thanks for pointing it out. :)
     
  16. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    Hi, this sounds too awesome to be true. ha ha So one question before I buy: Is it compatible with Unity 4.2 Free and if yes, is it still limited to hard shadows then?

    The rest I'd be willing to test myself, despite the relatively high pricetag, but if you already know the answer:
    Did anyone test this with the UniStorm plugin? Is it fully compatible or does something need tweaking?
    And last but not least: How does the performance of that awesome lighting compare to the regular version on low-mid level Desktop PCs?
     
  17. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @XilenceX

    Sunshine requires Unity Pro, as it uses RenderTextures.

    Haven't tried it with Unistorm, but it should work fine.

    My Mac is a good 4 years old and it runs very smooth! I've put a lot of focus on optimization.
     
  18. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    Ah I know you already wrote replacement shader for Unity Pro shadows, but you might want to make it even more clear that this doesn't work without Pro. So the PCF shadow filtering doesn't work either? That's too bad, the other effects aren't really interesting for me anyways as I am not going for the cinematic sort of experience.
     
  19. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I truly wish the Pro requirement wasn't there, but there's absolutely no avoiding it when it comes to Shadow Mapping.

    Maybe one day Unity will drop the Pro requirement for RenderTextures. I personally feel it's a bad idea to limit graphical quality on the Free versions, since graphics are the best way to show off and promote Unity itself. I think restricting functionality (Pathfinding/Occlusion Culling/Profiler/Editor Features/etc) is the way to go, but that's just my opinion.

    C'est la vie! ;)
     
  20. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Are there more details on how this differs from Unity's built in shadow system? I'm talking about potential gotchas to know about, or additional benefits you have that Unity's doesn't. Your demo is nice, but how about an outdoor environment, how's distance affect the quality?

    Benchmark comparisons, visual quality differences...doesn't work with deferred rendering, etc etc. These things are handy to know in advance.
    Thanks!
     
  21. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @jc_lvngstn
    I really do need to put up more details on the site, I will certainly do this when I get a chance.

    For some quick answers:
    No Deferred - This is a forward rendered solution for your primary Directional light.

    Outdoors - This was actually the focus as it was designed for a game in a massive outdoor desert environment. Up to 4 cascades, etc.

    Benefits - PCF filtering (Not screen space jittering), overcast shadows, volumetric light rays, no "collector" pass (less fill rate), Radial fading (doesn't change with camera rotation), runs on unsupported platforms (Ouya), Access to the Shadow buffer for custom volume effects.

    Gotchas - Requires swapping out shaders, but it's as simple as a button press for built-ins... Custom shaders require simple changes. Increased shader complexity could be an issue for already large/complex shaders. It's new.

    I will try to document the ins and outs in more detail soon. :)

    Hope this helps :)
     
  22. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
  23. anadin

    anadin

    Joined:
    Oct 28, 2005
    Posts:
    98
    @PolyVector, I am trying to get sunshine to work with Advanced Surface Shaders, so far struggling, any chance you you getting the pack and having a look?

    I have all the includes working but I get to a point where Unity seems to think the compiler is crashing so I don't have much info.
     
  24. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @anadin
    Thanks for pointing this out. I'll take a look at the pack as soon as I get a chance.

    Is it a specific shader in this pack, or all/most of them?
    Also, what version of Unity are you running?
     
  25. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    @PolyVector - I'm about to buy one of these advanced shader packs and wish to use it in conjunction with sunshine. Is there one pack that you've tested that does work with sunshine? - I think the 3 packs I'm looking at are advanced surface shaders, the Relief Shader Pack, Advanced Shaders Surface.
     
  26. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    hi!, please, do you plan to make it deferred rendering ? i am asking because, i am noob sorry, but i never saw that light effects even on unity pro, i liked your lights effects with that dust thing, really great,

    Many thanks
     
  27. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    Hey, just some quick questions:

    Are there any compatibility issues that we should know of? I.e. can we use a second(or even third) directional light without shadows to add some illumination to the dark sides of terrains(aka reflex lights or skylight). Would this work together with regular unity lights? Lets say for characters that hold a flashlight or lantern...

    Most importantly for the game we are working on: How far can we crank up the shadowdistance? We need it for a flightsimulator game and want to have changing daytimes(so no lightmaps) and still great shadow distance. Also we need to have multiple cameras to avoid zfighting (near cam, mid cam, far cam). I'd like to have the shadows to be on the near and mid cam. With regular unity shadows the shadowdistance fadeout is also defined by the farclip plane of each camera and so we have a streak of light where the shadows are transitioning from near to mid cam. Can we overcome this issue with Sunshine?

    Thansk for your time to answer :)
     
  28. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @sicga123
    I haven't had a chance to test compatibility with asset store packs. I will be looking into the Advanced Shader pack as soon as I can.

    @angelodevecchio
    I plan on looking into Deferred rendering, but as it stands I'm not optimistic that it will work so I can't make promises.

    @Becoming
    You can use additional lights with/without shadows, anything additive like this should work as before.

    You should be able to increase the shadow distance exactly like built-in, I don't think you'll see much of a difference there.

    I haven't tried Sunshine with multiple layered cameras like this. It seems to me that the closer shadow's farclip would need to extend beyond the camera's to allow for the radial shadows to be truncated linearly. The fading would need to be disabled on the closer camera. As it stands, Sunshine uses the global QualitySettings.shadowDistance parameter for all shadows, so this technique would require editing Sunshine itself.

    I'm going to say you can't do this now, at least without giving yourself a significant headache.
     
  29. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Can I ask a few naive questions about this asset. I have been hovering over the buy button for a few days now but I have my worries over compatibility with iOS and in particular iPhone 5 performance and loading time. There was a suggestion of loooong loading times which would be unacceptable for me.

    Also how does this asset differ from the standard Unity Image Effects like Sun Shafts with some fog switched on?

    Sorry for the dumbed down questioning, I'm very curious
     
  30. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @cl-apps
    iOS - I don't have iOS pro, or an Apple developer account to test with. It does work on Android, so iOS is likely to work (no promises!). I haven't had a chance to check the loading times issue. It's certainly solvable, as Sunshine is just a couple of camera scripts and some shaders. Most likely the shaders are simply too large due to the "multi_compile" line, which I'm considering removing anyways. That could account for slow loading.

    The built-in Sun Shaft effect is a 2D image effect, so it basically scans the screen for bright/flagged pixels (much like Bloom) and does a radial blur effect to make them appear ray-like. It can look pretty, but is in no way realistic.

    The Volumetric Scattering in Sunshine operates in 3D, so it "ray marches" along the Eye Ray, checking for which points are in light or shadow, and accumulating the light areas much like Fog. This creates a 3D volumetric fog/dust like effect that you can see from any angle... So you could see a ray of light coming in from a hole in the roof without actually staring up at the ceiling, if that makes sense. :)
     
    Last edited: Aug 4, 2013
  31. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hard Surface Shaders Update
    I've started testing the basic HardSurface Free Opaque shader, to see if it can work with Sunshine.

    Good news is it appears to work fine, but only if you define a particular shadow filter, instead of multi-compiling. Multi-compiling seems to cause the Shader Compiler to crash just like anadin said, which is unfortunate.

    Incidentally I had been considering dropping the multi_compiling of different filter techniques because it produces large shaders and takes some time to compile... This is yet another reason for me to change how filters are specified.

    I'll investigate this further, and see what I can come up with.

    Shader Compiler Crash Solved!:
    It appears that multi_compile was crashing simply because of a code comment on the multi_compiler line. I added the comment "// Multi-compile for different filters..." in the documentation, which is the cause of the problem! *face palm*

    I'll definitely be updating the documentation in the next release. Sorry about that guys!

    More Hard Surface Shaders Updates
    It appears that any Hard Surface Shader that uses Bump mapping is already maxing out the number of allowed vertex interpolators. I did a lot of tricky engineering to ensure that Sunshine only requires a single interpolator, but there is no magic bullet when zero are available.

    I think the best approach to supporting these shaders would be to combine the uv_MainTex and uv_BumpMap into a single 4 component vector (saving an interpolator), but you would probably lose independent Offset/Scale controls for these textures. I plan on writing up some tutorials for people wishing to combine shader packs with Sunshine in this way, but right now I have a lot on my plate.
     
    Last edited: Aug 4, 2013
  32. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Ok just went ahead and bought this.

    I have a LOT of assets in my assets folder which when I pressed Install Sunshine crashed Unity repeatedly. I fixed this by removing my Big Environment Pack which I wasn't using anyway.

    I tested in the editor and the scene looked ok in the editor and ran well. I have an interior / exterior scene. The exterior looked nice but in the editor the interior looked very dark.

    Anyway. I tested on the iPhone 5 and yes there is a few seconds delay when the scene starts and for performance I've switched to Hard shadows. However, on the iPhone there are no nice shafts of light? Is this intentional? Or has something gone wrong or need setting?
     
  33. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Just looked at your website and in the chart it states no Volumetric Light on mobile... I'm guessing this is why I don't see shafts of light? Any plans to implement this as this is basically why I purchased...
     
  34. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You'll be glad to hear that the Install/Uninstall crash is already fixed for the next version, it appeared to be caused by Unity automatically loading textures referenced in Materials until Virtual Memory was exhausted. I've corrected this by manually freeing memory using EditorUtility.UnloadUnusedAssets as the Install/Uninstall progresses. I can PM you a fix if needed, or you can wait for the next release.

    Light Scatter currently requires Shader Model 3.0, so it usually will not work on Mobile (I've indicated this on UnitySunshine.com, but I'm sorry if this wasn't made clear enough).

    It should be possible for me to add a Mobile/SM2.0 version of the Light Scatter if there's demand for it! I simply had assumed that it was overkill for Mobile. I will add this to my TODO list. :)
     
  35. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Yes! Definitely need the light scattering for SM2.0. Most of my stuff is atmospheric, hence why currently I'm using Sun Shafts. The nice look of light scattering would look amazing on iPhone / iPad which are all very capable machines... Well iPhone 4s and above, iPad 3 and above...
     
  36. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Yes, could you PM me that fix, then I can import the rest of my assets.. I'm missing my doors at the moment...
     
  37. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @cl-apps

    Can do!

    Also, I felt bad that you bought it just for Mobile Light Scatter so I threw together a quick-and-dirty version for you. I'll PM you that shader too. :D

    Keep in mind, it will be lower quality than the Desktop version... Increasing the quality while keeping the instruction count low will take a bit more engineering.
     
  38. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Nice one! Thanks so much! I look forward to trying it out!
     
  39. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Yep the new Editor scripts have fixed the changing the shader on a million assets problem!

    Just going through the compressing of all those newly imported assets for a mobile build now so that might take some time and as it's a little after midnight I'm going to get some sleep!

    Hopefully a shiny new build will be ready in the morning!

    I'll report back then!

    Thanks a million for the fast fixes and support! Very much appreciated!! :grin:
     
  40. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    That's great to hear! I might have to push an update just to fix the Install thing, as it's a showstopper.

    Enjoy your night!
     
  41. Alexey Andreev

    Alexey Andreev

    Joined:
    Aug 5, 2013
    Posts:
    17
    I have a few issues that i need to understand before i buy the sunshine:
    1) if it is possible to use sunhine with vertex-fragment written shaders, how difficult is it?
    2) if it is possible to use volume scatter with point lights? with backed lighting, non-realtime shadows?
    3)My default shaders are already replaced by other assets, will installing sunshine kill the changes already made by other assets? is there any workaround to avoid it?
     
  42. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Morning! The build finished however Volumetric Lights sadly didn't work. There are a few errors in the shader panel for the scatter shader:

    $scatter.gif
     
  43. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @Alexy
    1) Edit: I just realized a dilemma with custom Vertex Shaders. While they can easily be designed to receive shadows, I haven't yet worked out how they can properly cast shadows. I assume they would require a special RenderType, and an additional SubShader added to the Sunshine Shadow Caster shader... I'm going to have to investigate this further before I can give a definitive answer.

    As a shadow Receiver, it should be relatively easy. The documentation is currently pretty barebones, so I don't have a nice tutorial on how to do this yet.

    For a Surface Shader that uses a custom Vertex Shader, you can simply piggy back on your existing function using SUNSHINE_SURFACE_VERT_PIGGYBACK(input_struct, piggy_vert), and this will create a new vertex shader for you to use like so: vertex:sunshine_surf_ver

    For a custom Vertex/Fragment shader, you should be able to use SUNSHINE_WRITE_SURF_VERTEX(input, output)

    2) No, Sunshine works with your primary Directional light only. Your Point lights will work as before.

    3) Any shaders you have that aren't built-in will need to be adjusted to work with Sunshine. It's not too hard, but many shaders could be a pain to edit. I would absolutely love Unity to provide some sort of custom Shadow Mapping API, so that Sunshine could be more tightly integrated, but this is the only way it can be done currently.

    @cl-apps
    It still worked for me with those warnings, but like I said it was a quick attempt. I'll spend more time on this and include a better implementation in an update.

    Edit:
    I hadn't thought about it, but the Mobile Light Scatter is going to require .Depth support for the time being, so that rules out Ouya/Tegra 3. It should be possible to use a custom format similar to how the shadows themselves work, but I think the first iteration will stick with good old .Depth.

    I'm preparing an update with the Install/Uninstall fix, and the first version of Mobile Light Scatter... Hopefully it will be ready/live this week. :)
     
    Last edited: Aug 5, 2013
  44. arvie

    arvie

    Joined:
    Nov 14, 2012
    Posts:
    10
    It seems to be able to build for Ouya/Android you need another Android Pro license. Can you confirm this?
    I tried to make a standalone and an iOS build (which i have pro license for both) and worked fine.
    When I used my Android basic license, no shadows appear :(

    Also, I created a basic scene with a box and a plane behind it to cast a shadow:
    - 720p
    - 28~fps
    - 5 drawcalls
    - low settings

    Any advise how to bump it up higher than 30fps?
    I mean, I haven't started to attach any scripts yet so this will just go lower as I add stuff.

    $shadows.gif
     
  45. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @arvie
    Unfortunately a Pro license is needed for any platform you wish to use, since RenderTextures are a requirement for Sunshine to work. I would love this to work with Free, but it's just not possible.

    28fps - I assume this is an iOS build. I don't own an iOS Pro license, or Apple Developer account so I can't test this. I see that you're using Hard shadows and Low Resolution, which is really about as efficient as it gets. With such a simple scene, it sounds like the device is the limiting factor here.

    What's the FPS using built-in shadows for you?
     
  46. arvie

    arvie

    Joined:
    Nov 14, 2012
    Posts:
    10
    The screenshot is from Ouya. I have android pro at my work place.
     
  47. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @arvie
    The Ouya has pretty abysmal fillrate. If I had to guess, I would say it's the "floor" object in your scene casting shadows. I've notice that if you have a large object that fills the shadow buffer, the FPS really suffer on Ouya/Tegra3

    I would recommend adding your "floor" to a layer that isn't included in Sunshine's Shadow Casters mask. Anything you can do to reduce the amount/size of shadow casters should help reduce fill and improve FPS.

    I know this is probably obvious, but the Mobile shaders do perform much better if you're not already using those.
     
    Last edited: Aug 5, 2013
  48. arvie

    arvie

    Joined:
    Nov 14, 2012
    Posts:
    10
    Amazeballs!!!
    60fps FTW!
    Thank you!
     
  49. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Haha! No problem!

    Perhaps I should add that to the documentation... It is in desperate need of updating, but I've been so busy trying to squash bugs I've neglected it.
     
  50. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    Been playing around again this evening and still can't get the shafts of light to appear on the iPhone 5. I've got them fine on webplayer and inside the editor but not on the phone.... hmmm... I guess I'll wait to see if you can come up with something hopefully in an update... really hope so anyway because the shadows and shafts of light look really nice!