Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Sunshine! - Official Thread

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

  1. Alexey Andreev

    Alexey Andreev

    Joined:
    Aug 5, 2013
    Posts:
    17
    Nice to hear Deferred comes soon! Thank you! It may fix the problem with the soft particles, as they won't need any additional camera scripts.
    When to expect next release?
     
  2. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    This is a pretty hefty update, but hopefully I'll get it submitted next week... then it'll be up to the Asset Store approval process. So if I had to guess, maybe late next week or early the following week...?

    Really though, It's ready when it's ready. ;)
     
  3. Alexey Andreev

    Alexey Andreev

    Joined:
    Aug 5, 2013
    Posts:
    17
    Here is the difference in soft particles when turning on and off the sunshine.

    $soft_particles_scr1.jpg

    $soft_particles_scr2.jpg

    I also sent you a PM with the quick project
     
    Last edited: Aug 17, 2013
  4. yankijp

    yankijp

    Joined:
    Dec 10, 2012
    Posts:
    12
    Shadow volume would be totally awesome! :) Especially in cases where the main character is further away from the camera.

    I checked and rechecked my settings. It is resolved with your input. So thank you tons! :) I love the product!
     
  5. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @yankijp

    That is certainly a noticeable difference! Interesting...
    I'll take a look at the project you PM'd me right now. Hopefully if Sunshine's at fault I can work out a fix before the next release. :)
     
  6. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @yankijp

    This one is pretty crazy... It appears that using Camera.RenderWithShader() inside void OnPreRender() disables Soft Particles... Must be a quirk in Unity's render pipeline...?

    Interestingly, if you rename void OnPreRender() to void LateUpdate() inside SunshineCamera.cs, everything works fine... Not sure if that's a safe solution, since LateUpdate() might not be called before each render, and the camera could potentially move after LateUpdate if another script moves it... but there you have it.

    I'll dig into this further when I get some free time. :cool:

    EDIT: I researched this a bit, and the best solution I can come up with is to do all OnPreRender() work inside OnPreCull() instead... It appears to work nicely, and is probably much safer... This will likely be the fix in the next release, so if you want it fixed early, just rename OnPreRender() to OnPreCull() in SunshineCamera.cs. ;)
     
    Last edited: Aug 17, 2013
  7. Alexey Andreev

    Alexey Andreev

    Joined:
    Aug 5, 2013
    Posts:
    17
    It seems to be a wierd bug. Thank you for the fix!
     
  8. Alexey Andreev

    Alexey Andreev

    Joined:
    Aug 5, 2013
    Posts:
    17
    Soft particles now working but I think there is another little bug when using soft particles and light scatter.
    It seems like image effect doesn't take alpha blended objects or there tint color into account.

    Ofcourse lightscatter adds to objects luminosity
    But, objects appear double lightened by soft particles when using them with lightscatter. By the way the same thing I have when using default Global Fog image effect
     
  9. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @Alexzy
    I'll look into it, but it sounds like the age-old rendering problem of depth buffers being single-layer.
     
  10. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I'm interested in using this for OUYA, but would like some more info on your Android demo scene. Do you think it represents about the limit on scene complexity? What's the geometry count in that? I'm assuming that robot is normalmapped as well.
     
  11. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @God at play

    The Ouya seems to have a real problem with fill-rate. The primary reason the demo doesn't run faster is the tree casting shadows has a lot of overdraw. With the Ouya, my advice would be to cast as few shadows as possible, and that would probably mean limiting shadow casters to the main character(s). If you did that, you could probably use Sunshine in a fairly complex scene. Also, hard shadows are always faster than 2x2 PCF if you can get away with it.

    I have plans on adding a "shadow bounds" option so that the entire ShadowMap can be constrained to a sphere that you could place around your character(s), but this is not yet implemented.

    On most other devices, you can pretty much go wild, but there are valid reasons why Unity doesn't support shadows on Tegra 3.

    Edit: I just noticed what you're working on.. I'm really interested to see how you handle the subject. My Father died of cancer a few years ago, and the stress kind of pushed me out of game development. I'm slowly easing back into it now. Best of luck to you.
     
    Last edited: Aug 23, 2013
  12. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    Thanks for the quick response! And the warm wishes.

    Yeah I understand that it's pretty limited. I guess that's a "yes" to the complexity limit question, hehe. Can you tell me more tech specs of that scene? The robot is normalmapped, correct? And what's the triangle count? I'd love this info so we can evaluate what our scene budget would need to be for having a similar scene, which would help us determine if this solution is right for us.
     
  13. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @God at play

    I sent you a PM.

    The robot is normal mapped, yes.
    With shadows disabled the scene is 23.7k triangles, 30.7k verts, and 17 drawcalls... It's a fairly simple scene.
     
  14. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    Thanks so much for this!

    So yeah, I think you're right. What we're going to have to do is limit shadowing to just the characters, and bake it for everything else. But if we used the dual lightmap system to blend the character shadows, would there still be a big fill rate problem? If so, I guess we'd just have to double-multiply shadows...

    Really great support by the way, you've made a customer out of me. :)
     
  15. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @God at play

    No problem,

    Baked lightmaps shouldn't affect fillrate, other than increasing shader complexity slightly and adding a texture read... You're right that it's probably your best bet. I'll put you down for another vote to add a "shadow bounds" option... Hopefully I can squeeze that feature into 1.3.1.

    Sunshine should work nicely with Dual lightmaps, and it currently mimics the way Unity picks the min(shadowmap, lightmap) value, which worked in my tests... Admittedly though, I haven't used it in a full blown game yet. ;)
     
    Last edited: Aug 23, 2013
  16. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hey guys!

    I've just submitted version 1.3.0 to the Asset Store, so hopefully it will be approved next week.

    This version will allow you to use Volumetric Light Scatter in both the Deferred and Forward renderers! Forward shadows are no longer a requirement!

    Now's your last chance to get it at the current price, so don't wait for the update to go through or you'll wind up paying more! ;)
     
  17. unity3dx

    unity3dx

    Joined:
    Apr 15, 2011
    Posts:
    175
    Wow that's a really good news, thanks for the hard work!
    This asset is worth every penny and I am sure it will end up at +$100 so, it is a good time to buy!
     
  18. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Just saw it, I tested it on your website, and couldn't resist, I bought it xD

    I am creating a game for ouya, so it is going to be perfect.

    Thank you very much :)
     
  19. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @RenOli

    That's awesome! I love my Ouya and it's going to be cool seeing games out there using Sunshine. :)

    Make sure you check out the Mobile Performance section of the Readme, since the Ouya is very prone to fill-rate issues. The most practical approach seems to be to only allow character(s) to cast shadows, and bake the rest. My plans for 1.3.1 are to add a some features to improve quality on Mobile ("Shadow Bounds" and "Warped Shadow Maps" have potential).

    Anyways, let me know if I can help with anything. :)
     
  20. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Are you still at introductory pricing? I just noticed this. I might have an application with a current project.

    But i still notice jaggies on your shadows in your demo??

    Was the quality at full for the demo.. i would think so.

    Q
     
  21. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @qholmes

    If it's $75 then it's still at introductory pricing, 1.3.0 should be accepted any day now.

    I'm actually updating the demo right now, so I'm not sure which version you saw. Just to be sure, check it out again.

    I forget how the filter settings were configured in the last demo, but they're currently 4x4 PCF, which is maximum. There's no "perfect" shadow algorithm, you might prefer the screen-space jittering of built-in.

    The Light rays are not at maximum quality, they're at a reasonable level that I felt worked for the demo... There are a lot of settings to tweak. ;)

    If you like the idea of Light Scatter using the built-in shadows, that's coming in 1.3.0... It's actually the simplest feature to use, and doesn't require swapping out your existing shaders.

    If all you want is your existing shadows to be softer, I'm actually working on a side project that simply allows you to take control over the built-in shadow filtering. I'm hoping to get it released in the coming weeks. ;)
     
  22. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Hmmmm Ok so it is still $75. I might bite on that.. I just looked at the demo and it does look a bit softer then before.. Maybe just my eyes are tired..

    My project is industrial so no special effects needed for me just softer shadows in forward rendering i think.. I am not super experienced in Unity.

    I am going with light maps for this current project for most objects but i was thinking some dynamic shadows for moving walls and things would be cool..

    So would this side project be a part of Sunshine or a totally separate product?

    Thanks

    Q
     
  23. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @qholmes

    The side project is totally separate from Sunshine, and it will purely focus on augmenting the built-in shadows... The cool thing about that project is it will work with different light types, in both Forward and Deferred... so you could say have softer Spot lights in Deferred, which is not possible with Sunshine. It also allows the built-in "Soft" filtering to be applied on top, creating crazy-soft shadows. ;)

    The benefit to Sunshine is that by replacing the built-in shadows, it can do cool things like run on a Tegra 3, add some Light Rays, and Overcast Shadows, and potentially more effects in the future... This comes at the cost of being a mostly Forward-rendered solution, and only supporting a single Directional light.

    They both will have their pros and cons. I have considered including them in one huge package, but it would be much too confusing. ;)
     
  24. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hey Everyone!

    Looks like Sunshine 1.3.0 was just accepted to the Asset Store! This version allows you to use frickin' Light Scatter in the frickin' Deferred Renderer. *mind blown*... I hope you all enjoy it. :)

    This is a major update, so there are bound to be some quirks (friendly euphemism). Please let me know if you run into anything, and I'll fix it ASAP.

    I already caught a small bug a few days ago that can disable the wrong controls in Sunshine's Editor, but once a submission has been made to the Asset Store, it becomes a runaway train. :roll:

    The following is a quick fix, I apologize for any inconvenience:

    In SunshineEditor.cs
    Code (csharp):
    1.  
    2.     EditorGUILayout.Slider(Prop("ShadowCascadeSpacing"), 0.2f, 0.8f, "Cascade Spacing");
    3. }
    4. EditorGUI.EndDisabledGroup(); //ADD THIS LINE TO FIX THE ISSUE
    5. EditorGUI.BeginDisabledGroup(!sun.ForwardShadowsActive);
    6.  
     
  25. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Congrats on the update! Aaaaand... bam! I'm now priced out of Sunshine. :D Here's hoping you'll be in next year's summer sale. Wish you much well-deserved success with it anyway, looks like a marvellous render enhancement. :cool:
     
  26. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @metaleap

    Oh no!
    I was just taking some advice and trying not to under-charge, since it's a limited market... I wish the store operated on a barter system, hehe.

    I will definitely try to participate in sales in the future, and I also have a bare-bones shadow filtering package planned, if you check out my last few posts... It will definitely cost less, so you might be interested. ;)

    Thank you for the kind words, and sorry if the price is too steep.
     
  27. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Not to worry! Indeed a software developer should never undercharge :p the nice thing about packs like this is, they're great "HD value-add" nice-to-haves rather than must-haves, so "if my game takes off" (I know, right?), it will be easily affordable and well worth "almost any price" (within bounds, the current one seems pretty decent in such a scenario..) -- whereas, "if not" then no need to go full-on HD. It's a great improvement on Unity, but it can wait til "post validation" for Indies.

    And indeed thinking about users such as the architectural-vizualization folks, they'd laugh at any price significantly lower than currently. They have budgets to spend and paying clients to impress the heck out of, which Sunshine will aid greatly in.

    So keep at it and don't worry, my time for Sunshine will come sooner or later and in the meanwhile, you gotta make sure you get paid! Speaking from experience here. So no probs I'll keep monitoring this thread..
     
  28. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Hi PolyVector

    Congratulations on the good work.

    I just purchased your package because I want to have realtime shadows in an Ouya game.

    After following the instructions, I am still not able to see the shadows.

    Light scatter is disabled and using the Debug panle it shows all variables are OK except for one called "Goodtogo" which is false.

    What am I missing?
     
  29. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    I think you need the script on your camera.
     
  30. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102



    Thanks, I am making thousands of tests with ouya, testing physics, graphics, shaders, drawcall control, I love to work on performance.

    :)

    But it is reaally difficult to make a good performace with sunshine on ouya, see if i am making it right.

    I did it on a scene with only a Sphere with shadow and the FPS was like 5-10. =/

    Also I have a question about yesterday update.

    I downloaded it on my work in the morning to test it, it was very different, I could turn the light effect on and off very easy, but when I came home I couldn't turn off the light.

    Also, I did the hole scene with many static cubes and your shadow with only 2 Draw Calls :) pretty cool, but again, when I came home, after the update, I couldn't. =/

    I am going to make some tests in an empty project.

    Thank you very much :)
     
  31. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hey guys,

    Just a reminder that there is a small bug in 1.3.0 I mentioned a few posts back that can disable some options, so be sure to make the small change to SunshineEditor.cs I mentioned... This will of course be fixed in 1.3.1.

    @bakno

    I will go verify that Ouya support is still working. As RenOli mentioned, be sure SunshineCamera is attached to your Main Camera.


    @RenOli

    If you PM me a test project that demonstrates the performance issues you're seeing, I will investigate it for you. :)

    Make sure you read the "Mobile Performance" section... The Ouya doesn't appear to handle many shadow casters very well (The ShadowMap fill kills performance)... so it's highly recommended that you stick to main character(s) shadows, and bake the rest. I plan on adding improved support for this style functionality in an upcoming release.

    Another possible performance killer is running at full 1080p... I highly recommend using Screen.SetResolution() and running at 720p on the Ouya.
     
    Last edited: Aug 28, 2013
  32. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @bakno @RenOli

    I just tested Sunshine on the Ouya, and it's working fine for me.

    Feel free to PM me any projects you want me to investigate and I'll track down the issue ASAP. :)

    Edit: bakno, also make sure you are using the Mobile shaders, since Sunshine's Desktop shaders require SM 3.0 and the Ouya only supports SM 2.0.
     
    Last edited: Aug 28, 2013
  33. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Hey PolyVector

    The problem was a script that disabled the shadows on the directional light.

    It was fixed and the Ouya now shows something. However, shadows quality (Hard shadows / Medium res.) and game performance are pretty bad.

    What do you suggest we can do to improve performance?
     
  34. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    One suggestion...

    The same way you have "Shadow Casters", you should have "Shadow Receivers" as an option in the Sunshine prefab.
     
  35. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @bakno

    I'm glad you got it working. :)

    If you check back a couple of posts, I just made some performance suggestions. Read the "Mobile Performance" section of the Readme, it goes over the basics. The most important tips I can give are to reduce the amount of Shadow Casters... Ideally just the character(s) should cast dynamic shadows. Reduce the Shadow Distance, and reduce the game resolution (720p ideally on an Ouya).

    The Ouya has very limited power, and dynamic shadows don't come cheap. As I mentioned earlier, I will be adding features to improve the quality on mobile in an upcoming version. :)
     
  36. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Thank you PolyVector

    One silly question: How do you reduce the game resolution to 720p?
     
  37. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Like he said: Screen.SetResolution(1280, 720, true)
     
  38. unity3dx

    unity3dx

    Joined:
    Apr 15, 2011
    Posts:
    175
    new version is in the store: v 1.3.0
     
  39. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Hello, thanks for your reply.

    Yesterday night I made lots of tests, and found that to turn off the light effect I had to click on the advanced arrow, that is not a good feedback, I thought that arrow on advanced would only to show more options, not turn it on. Just my view :)

    But I tested it, and I loved it, I am going to make many other tests today on the right way now.

    Only one question.

    For example, when I put the character on the shadow layer, only the character will cast the shadow, but how can I make only the terrain to receive the shadow? Everything is receiving the shadow.

    Thank you very much. :)

    Really enjoying it, for sure an OUYA game is coming with it.
     
  40. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @RenOli

    The Advanced arrow shouldn't be affecting anything, I'll look into that ASAP! *facepalm*

    There is no way to control which objects receive shadows, so the way it works right now is everything receives shadows... In the future, being able to control this might improve mobile performance, but I have yet to find a good approach.

    Terrain is a "special case", and I wrote about it in the Readme file. Basically, you must assign a material to your Terrain object, or Sunshine has nothing to attach a shader to. I was under the impression that Terrain didn't work on Mobile, did they recently add Android support? I'll have to play around with that. :)

    I'm glad you like it so far! Hopefully the next few releases will be less extreme and bring Sunshine back to a very solid state. I think for the next major release I'll have to do a private Beta with you guys to work out the kinks. ;)
     
  41. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    > I was under the impression that Terrain didn't work on Mobile, did they recently add Android support?

    Terrain totally works on mobile at least if you're targeting GL ES 2.0 or higher. Now you probably wanna tweak its resolution, error and other settings to stay under ~10k triangles, but terrain per-se is totes doable on current-gen mobile devices.
     
  42. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @RenOli
    The Advanced Settings is actually triggering that bug I keep mentioning. Here's the fix:

    In SunshineEditor.cs
    Code (csharp):
    1.  
    2.     EditorGUILayout.Slider(Prop("ShadowCascadeSpacing"), 0.2f, 0.8f, "Cascade Spacing");
    3. }
    4. EditorGUI.EndDisabledGroup(); //ADD THIS LINE TO FIX THE ISSUE
    5. EditorGUI.BeginDisabledGroup(!sun.ForwardShadowsActive);
    6.  

    @metaleap
    Good to know! I'll have to play around with Terrain on Mobile some time. :)
     
  43. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    How do I make sure I am using the Mobile shaders?
     
  44. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Just check the Materials in your scene, you can usually click on an object and look at your Inspector. The Material should be using a Shader named "Sunshine/Mobile/Diffuse" or something similar. If it's not, you can select a new one right there.

    If you are using a Desktop shader on an Ouya for example, Unity will automatically use the "Fallback" shader, which will not support Sunshine... Mobile shaders were specially created to integrate Sunshine within the tight limitations of SM 2.0.

    If you can see shadows, you're already using Mobile shaders. ;)

    Feel free to PM me a project if you'd like me to take a look at it.
     
  45. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Thanks PolyVector

    This change improved the performance.

    The problem that I have now is that the only object (game character) that is casting shadows, is receiving some as well. And it looks disturbing.

    I guess the problem comes from the fact that it is not a single mesh but two separate meshes within the same object.

    I tried disabling the "Receive Shadows" on the mesh renderer, and even tried to use a regular material on that object, but it does not work.

    Any suggestions?
     
  46. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @bakno

    "Receive Shadows" and "Cast Shadows" only affect Unity's built-in Shadows, not Sunshine. I would love to have that level of integration, but it's not possible in Unity unfortunately. :/

    Right now, any Material using a Sunshine shader will receive shadows, and any Material that doesn't use a Sunshine shader won't receive them.

    The only thing you could do to prevent your character from receiving shadows is to have your Material use a custom shader that doesn't have a Sunshine equivalent. This way, Sunshine won't be able to swap shaders on you.

    I'll think of ways to make this more seamless for an update, since not receiving shadows would actually improve performance further (which would be great on mobile)...
     
  47. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Thanks PolyVector

    The custom shader made the trick.

    Now I am having a frame-rate drop whenever a particle system is on.

    Have you ever had the same problem?
     
  48. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    This may be a crazy idea...

    Would it be possible to have a sort of static-shadows for those static objects in the scene?

    This way, the shadows calculations for those objects are made just once (or on demand by calling a function).

    And combine those shadows with the realtime shadows from dynamic objects (the ones calculated now).
     
  49. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    @bakno

    Particle systems on the Ouya have noticably slowed down every game I've seen them in on the console, probably because particles burn through fillrate. My guess is they would slow your game with or without Sunshine, but shadowmaps aren't helping anything...

    All I can suggest is to make the particles smaller and less numerous/dense. It's unfortunate that Unity doesn't allow reduced-resolution particle buffers, since it's a standard solution that works great in practice.

    Your idea for caching shadowmaps is actually not so crazy, and I was coincidently thinking about ways to do this just yesterday... It's certainly something for me to investigate for a future release. :)
     
  50. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    Hi, on my device htc T-mobile g2, i didnt see Volumetric Light Scatter, does this not work on the mobile version? What works on the mobile version, just shadows?

    it looks great for shadows, im just trying to figure out what works on mobile, and why my device didnt show Volumetric Light Scatter.