Search Unity

Sunshine! - Official Thread

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

  1. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Thank you a lot for testing it yourself. Maybe its not that easy do compatibility with Shader Forge. The good news is that the pc/linux compilation works.
    Yes, there is no problems with sunshine with unistorm, only make sure that you select the same Directional light that unistorm uses for Time of Day.
     
  2. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Ok, now is happening the same with this shader:

    Code (CSharp):
    1. Shader"Shader/Library/Diffuse Reflection Rim ShadowAmbient Light0 AmbientLight "
    2. {
    3.     Properties
    4.     {
    5.         _ColorBase ("Color (A)Opacity", Color) = (1,1,1,1)
    6.         _DiffuseTex ("Texture", 2D) = "white" {}
    7.         _Cube ("Cubemap(A)Luminance", Cube) = "white" {}
    8.         _RefAmount ("Opacity", Range (0, 1)) = 1
    9.         _RefBias ("Bias", Range (0, 5)) = 1
    10.         _RefLum ("Luminance", Range (0, 5)) = 0
    11.         _RimColor ("Color (A)Opacity", Color) = (1,1,1,1)
    12.         _RimBias ("Bias", Range (0, 5)) = 1
    13.     }
    14.     SubShader
    15.     {
    16.         Tags
    17.         {
    18.             //--- "RenderType" sets the group that it belongs to type and uses: Opaque, Transparent,
    19.             //--- TransparentCutout, Background, Overlay(Gui,halo,Flare shaders), TreeOpaque, TreeTransparentCutout, TreeBilboard,Grass, GrassBilboard.
    20.             //--- "Queue" sets order and uses: Background (for skyboxes), Geometry(default), AlphaTest(?, water),
    21.             //--- Transparent(draws after AlphaTest, back to front order), Overlay(effects,ie lens flares)
    22.             //--- adding +number to tags "Geometry +1" will affect draw order. B=1000 G=2000 AT= 2450 T=3000 O=4000
    23.             "RenderType" = "Opaque"
    24.             "Queue" = "Geometry"
    25.             "LightMode" = "ForwardBase"
    26.         }
    27.         Pass
    28.         {
    29.             CGPROGRAM
    30.             #pragma vertex vert
    31.             #pragma fragment frag
    32.             #include "UnityCG.cginc"
    33.             #pragma multi_compile_fwdbase
    34.             #pragma fragmentoption ARB_precision_hint_fastest
    35.             #include "AutoLight.cginc"
    36.             #include "Lighting.cginc"
    37.             #define SUNSHINE_MOBILE
    38.             #include "Assets/Sunshine/Shaders/Sunshine.cginc"
    39.             #pragma multi_compile SUNSHINE_FILTER_HARD
    40.             sampler2D _DiffuseTex;
    41.             float4 _DiffuseTex_ST;
    42.             samplerCUBE _Cube;
    43.             float _RefAmount;
    44.             float _RefBias;
    45.             float _RefLum;
    46.             fixed4 _RimColor;
    47.             float _RimBias;
    48.             struct customData
    49.             {
    50.                 float4 vertex : POSITION;
    51.                 float3 normal : NORMAL;
    52.                 float2 texcoord : TEXCOORD0;
    53.             };
    54.             struct v2f // = vertex to fragment ( pass vertex data to pixel pass )
    55.             {
    56.                 float4 pos : SV_POSITION;
    57.                 float2 uv : TEXCOORD0;
    58.                 float3 refl : TEXCOORD2;
    59.                 fixed NdotVRef : TEXCOORD4;
    60.                 fixed NdotVRim : TEXCOORD3;
    61.                 SUNSHINE_INPUT_PARAMS;
    62.                 LIGHTING_COORDS(5, 6)
    63.             };
    64.             v2f vert (customData v)
    65.             {
    66.                 v2f o;
    67.                 o.pos =     mul (UNITY_MATRIX_MVP, v.vertex);
    68.                 o.uv =        TRANSFORM_TEX (v.texcoord, _DiffuseTex); // this allows you to offset uvs and such
    69.                 SUNSHINE_WRITE_VERTEX(v, o);
    70.                 TRANSFER_VERTEX_TO_FRAGMENT(o) // This sets up the vertex attributes required for lighting and passes them through to the fragment shader.
    71.                 half3 viewDir =     normalize(ObjSpaceViewDir(v.vertex));
    72.                 o.refl = -reflect( normalize (WorldSpaceViewDir(v.vertex)),normalize(mul((float3x3)_Object2World, SCALED_NORMAL)));
    73.                 o.NdotVRef = 1-(clamp((dot(viewDir, v.normal)*_RefBias),0,1));
    74.                 o.NdotVRim =         1-(clamp((dot(viewDir, v.normal)*_RimBias),0,1));
    75.                 return o;
    76.             }
    77.  
    78.             fixed4 frag (v2f i) : COLOR  // i = in gets info from the out of the v2f vert
    79.             {
    80.                 fixed4 result = fixed4(1,1,1,0);
    81.                 fixed4 T_Diffuse = tex2D(_DiffuseTex, i.uv);
    82.                 fixed4 Cubemap = texCUBE(_Cube, i.refl);
    83.                 result = T_Diffuse;
    84.                 fixed RefAmount = _RefAmount * i.NdotVRef;
    85.                 result = lerp (result ,result + fixed4(Cubemap.rgb +(_RefLum*Cubemap.a),Luminance(Cubemap.xyz).rrrr.a)+(_RefLum*Cubemap.a), RefAmount);
    86.                 fixed4 Lights = fixed4 (UNITY_LIGHTMODEL_AMBIENT.rgb * 2 + _LightColor0.rgb,1);
    87.                 result *= Lights;
    88.                 fixed ShadowMask = SUNSHINE_ATTENUATION(i); // This gets the shadow and attenuation values combined.
    89.                 result = lerp(result,result * (UNITY_LIGHTMODEL_AMBIENT * 2),(1 - ShadowMask));
    90.                 fixed RimAmount = _RimColor.a * i.NdotVRim * T_Diffuse.a;
    91.                 result = lerp (result, _RimColor, RimAmount);
    92.                 return result;
    93.             }
    94.             ENDCG
    95.         }//-------------------------------Pass-------------------------------
    96.     } //-------------------------------SubShader-------------------------------
    97.     Fallback "VertexLit" // for shadows
    98.     CustomEditor "UNOShaderUnlit_MaterialEditor"
    99. }
    And this is a simply shader, not a Shader Forge one.. only 1 pass....

    I noticed something diffrenent happening to this shader in the editor window, something weird that dont happen when i use the sunshine build in shaders:

    Sunshine2.jpg

    Ground is using the diffuse shader that comes with sunshine, the poly-trees are using the custom shader. Why shadows appear in the "Scene" window? and they doesnt correspond to the real shadows when you enter the "Game" window...
     
  3. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It seems like I'm seeing something completely different from you, I don't get any shader compilation errors, but the shadows still don't work when targeting iOS (I don't actually have a device to test with). I've narrowed this down on my machine to SystemInfo.supportsRenderTextures returning false, which Sunshine checks and disables itself. If you set Sunshine's Debug setting to "Status" you can see if it's "GoodToGo" and this is false on my machine.

    I'm not sure why this is, I remember testing iOS compat early in development and there wasn't an issue, and I know some users have been using iOS, so something may have changed in Sunshine/Unity at some point. Unity has made major changes to their shader transcoder/compiler in recent versions, so perhaps that's related.

    If I figure anything out I'll let you know, but I'm a bit stumped at the moment.

    As for the Scene view, Sunshine really only works in the Game view. Ideally you should just see built-in shadows in the Scene tab, but this isn't 100% reliable.
     
  4. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Ok,thanks for all of your support. Only one last note: im using unity 4.3.4f1, not unity 4.5.
     
  5. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    That very well could be why I'm not seeing the same thing, I'll bust out 4.3 and see if I can reproduce the problem. :)

    Edit: I still can't seem to get an error, even in 4.3. Very strange.
     
    Last edited: Aug 5, 2014
  6. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Sunshine is a finalist in the 2014 Unity Awards for Technical Achievement!

    We are honored to be considered a finalist! And we're also up in the Community Choice Awards. We're up against a lot of really awesome assets by some talented devs. But if you like what we do, don't hesitate to give us a vote.
     
  7. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    We would be honored if anyone using Sunshine would like to be included in our awards video. Please get in touch with PolyVector or myself here or on Twitter (@Skunkie or @PolyVector). We're doing a 2-5 minute video showing off Sunshine, and Unity will probably be cutting it down to 7-10 seconds for the awards ceremony.
     
  8. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Last edited: Aug 8, 2014
  9. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Congratulations on your nomination. And thanks for cutting the price. I already have Shadow Softener, but I was wondering how does this asset relate to Shadow Softener?
     
    Last edited: Aug 8, 2014
  10. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Thanks for the kind words. Here's a quick breakdown of the differences:

    Sunshine
    • Replaces Built-In shadows
    • Works with a single Directional Light (usually the Sun or Moon)
    • True Volumetric Light, which is an amazing effect, and why Sunshine was created.
    • "Overcast Shadows" effect to simulate clouds casting shadows...
    • Up to PCF4x4
    • Works in Unity Pro
    • Some interesting benefits:
      • It can render shadows on a Tegra 3 (Ouya)
      • It can share shadowmaps between 2 cameras for fast Stereoscopic/VR rendering
      • It can control when shadowmaps are refreshed for mobile performance, or "runtime baking"
    Shadow Softener
    • Modifies the way Built-In shadows are filtered
    • Works with Directional/Point/Spot lights
    • Up to PCF8x8
    • Works in Unity Free and Unity Pro
    I hope this clarifies the differences. :)
     
  11. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    A new demo video for Sunshine to celebrate the sale and being a Unity Awards 2014 Finalist!



    Don't forget to vote!
     
  12. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Thanks for the breakdown.

    So, I don't need to use Shadow Softener if I use Sunshine, right?

    What's the performance like on iOS devices, do you have any idea?

    Is volumetric lighting cheap or expensive in terms of frame rate?

    So if I use "runtime baking" to update the shadow maps on an interval, can I "morph" between two shadow maps to give the illusion of a smooth transition? And are the results of "runtime baking" comparable to normal baking?
     
  13. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    I'm really interested in this for some atmospheric outdoor levels I'm doing, to replace standard Unity Lighting and fog
    (see attached examples using standard shaders)

    However, I'm using Time of Day https://www.assetstore.unity3d.com/en/#!/content/7316 and was wondering if sunshine integrates easily with this or not?

    I'm assuming the main benefit will be in the fog definition? or could you give me some pointers based on the images below as to how Sunshine might enhance my prototypes?
    Atmospheric feel is a big part of what I'm trying to achieve here.

    eg:
    testscreen-3.jpg testscreen-5.jpg testscreen-14.jpg
     
  14. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Wow, those look great! How did you get the look for the first two images? And are those custom assets? It looks fantastic!
     
  15. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Correct, you would only use one or the other.

    I have no firsthand experience with iOS, but it should be comparable to built-in shadows starting out. If you don't update the shadowmap every frame you can see some pretty big gains.

    It's very efficient, I can even get volume lights running nicely on my Nexus 7 2013. Of course your settings must be reasonable... Running at "Very High" quality sampling and full resolution can impact games running at high resolutions... High resolution games benefit from using 1/2 or 1/4 buffers, but there are plenty of settings to play with to tune performance.

    When I say "runtime baking" I really mean that the shadowmap can be manually updated through code (or at specified intervals) so performance will be the same as realtime shadows minus the expense of shadowmap rendering (which can be relatively high on mobile due to fill rate concerns). I've talked to developers using this feature to only update shadows when the level changes on mobile devices. There are no features for transitioning, it's simply a way of controlling shadowmap refreshing.
     
  16. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    When Sunshine came out at first, I skipped it, exactly because there was no info on iOS performance. I didn't know Tegra3 didn't render Unity's shadows, so the Tegra3 endorsement only made me think you'd need a very high powered chipset to have this running in a usable manner. We're at least a year further, so iOS devices are probably fast enough to handle this. But just to let you know, you might want to do some tests on iOS and put them in your copy. (Especially since there aren't that many configurations you need to test to make reliable claims.)

    Alright, so if I want to update the shadow map, I can trigger a new render of it, while in a menu or whatever (so that the player doesn't notice any slowdown or visual change) and then when it's done return to a new shadow mapped level?

    Thanks for taking the time to answer my questions, I'm considering this asset; especially for the volumetric lights.
     
  17. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Wow, that is some impressive work! Outdoor levels are what Sunshine was built for, so I think it could add quite a bit to your scenes. If you want a somewhat similar example, you can look at what The Forest is doing with Sunshine (There's a video in the first post of this thread).

    Time of Day sounds like it would integrate well, assuming it's moving a standard Directional light, but I'm not sure how they're version of "Overcast Shadows" works, since Sunshine has it's own.

    If you're using the Deferred renderer, Sunshine should be a no-brainer to integrate, but if you're using Forward rendering with many custom shaders it can take some work. I'm always here to help though.

    As always, if you want to give it a try while it's on sale and it doesn't work out for any reason, I'll give a refund no questions asked. :)
     
  18. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You're right that I really should get an Apple Dev account and some devices to test with, it's a lot of expense though.

    Yes, you can trigger shadowmap updates whenever you need, and for this type of usage you'd want to specify a "Custom Bounds" that would control which area of the level shadowmap covers. It should actually perform so quickly that at most you'd see a 1-2frame hickup for a large/complex level, so you can even do it during gameplay, for example when the player enters/exits specific areas.

    Like I mentioned to sonicviz, feel free to try it out, and if it doesn't work out for any reason I'll give a refund. :)
     
  19. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Yeah, on the other hand, having standardised benchmark example scenes in the asset, your customers colder port back the results from running on their iDevices?

    It's not a real baked shadow map, just "cached" realtime shadows, right? And those can be rendered off-screen by code?

    Thanks, I appreciate that. I've put it in my shopping cart for now at least! :D
     
  20. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Not a bad idea!

    Exactly!

    :cool:
     
  21. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Thanks! The assets are a combination of different Asset Store packages.
    The look is a custom stack of tweaked post processing FX I've been working on to get a visual feel that's softer than hard sharp graphics.

    Interested to see if sunshine can take it up a notch.
     
    Last edited: Aug 9, 2014
  22. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    OK, thanks, maybe I'll give it a try and see.
     
  23. Xeir

    Xeir

    Joined:
    Oct 21, 2007
    Posts:
    342
    I'll second that Wow! Nice work sonicviz. I see you're here for the same reason, checking in on Sunshine! :D

    Have to say Sunshine! looks like a worthwhile investment, think I'll be adding this to the collection!

    Edit: Correction, no thinking, just bought it.:cool:
     
    Last edited: Aug 9, 2014
  24. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    I'm in the same boat, skipped this asset a year ago because of lack of IOS support.

    Has anyone tried it on Iphone 4 ? Frame rate ? Things to look out for ?

    Cheers.
     
  25. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Thanks!

    @PolyVector

    OK I picked it up and playing with it on a test forest scene.
    Using deferred and it seems to integrate ok with TOD using its main directional light.
    Definitely a different look immediately, working through the (R)TFM (nice to see a well written one, ty!) and playing with settings .

    Would you recommend turning fog off when using sunshine? I did and found I had to adjust the scattering a bit to get the sky to match, which the fog was masking before.

    Just trying to get a feel for best combination of functions to use together, so they aren't walking all over each other or degrading things.

    Edit1:
    After some more testing I really like the scattering effect to add another layer of distance haze, but unfortunately having a lot of problems with shadows popping. The current system I have set at high draw distance so they don't pop (important for doing a camera flythrough video as pops are really eye attracting).

    I'll play with it a bit more to see if I can find some settings where the shadows work with TOD and camera animation movement.
     
    Last edited: Aug 9, 2014
  26. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Please keep us updated, as I intend to use it with Time of Day as well.
     
  27. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I've had decent luck combining fog with Scatter, making sure both are the same color for consistency. This seems to work because the volume scatter can only function within range of the shadowmap. Another more advanced variation on this technique is to do custom fog calculations, and blend them with Sunshine's scatter result, but this requires modifying Sunshine. David Miranda did a presentation on this, but I can't seem to find it now.

    I'm curious about this pop-in you're seeing. If you can get me more details (video/small scene) maybe I can help track down the issue. Sunshine's replacement shadows are optional, you can disable "Custom Shadows", and can even delete the included Deferred shader replacements (Editor restart required). This allows you to combine volume light with built-in shadows.
     
  28. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    kk, thanks. I was playing with the settings and think I may have resolved the shadow popups with the tweak settings.
    Here's a couple of comparison shots using my WIP Cloud Forest scene.

    Sunshine needs to be modified to match TOD fog color as the TOD fog color is dynamic not static, and if they need to be matched then it needs to be dynamic as well.
    Is it possible for you make sunshine more flexible by making the color source selectable eg: from a light or fog or some other game object?

    First screenshot is without sunshine, 2nd two with sunshine: testscreen-3.jpg JetAudio 2014-08-10 02-37-03-37.jpg JetAudio 2014-08-10 02-37-09-45.jpg
     
    Last edited: Aug 10, 2014
  29. JesseK

    JesseK

    Joined:
    Jul 4, 2013
    Posts:
    15
    Hello I purchased the sunshine package.

    Volumetric Light Scatter!
    Makes any scene feel alive by simulating particulate matter in the air.

    Does not work with orthographic cameras. How do I make it work? It looks so beautiful in all of these screenshots, I would love for it to work with the orthographic camera. Thank you.
     
  30. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You are correct that Sunshine's Volume Scatter doesn't currently work with orthographic cameras... I'm going to try and take a look at it this weekend and see how hard it would be to add support.
     
    Last edited: Aug 10, 2014
  31. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Okay, I couldn't sleep and had to experiment with adding Orthographic Scatter support... Unfortunately it doesn't appear to be feasible in Unity because the camera depth buffer exposed to shaders don't support linear scale. I'm not sure why this is, but the math doesn't work out and the rays become garbled and warped.

    Edit: I managed to figure out that the depth format is already linear in Ortho cameras, so the shader macro to linearize wasn't needed... There's hope yet, I'll investigate this more tomorrow! :)
     
    Last edited: Aug 10, 2014
  32. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    I was browsing the asset store to make a nice light cone for my in game helicopter. Found this asset instead and got side tracked. (I will worry about helicopter light cone later) . Read up to page 6 on this asset thread and decided to buy it because I use RTP and Unistorm.

    Looks promising. I will try out Sunshine tomorrow.
     
  33. JesseK

    JesseK

    Joined:
    Jul 4, 2013
    Posts:
    15
    I AM SO EXCITED THAT THERE IS HOPE! I was so worried that I couldn't use this asset =(

    Do you know if it will work with deferred lighting? Thank you for working so hard on this asset
     
  34. Rico21745

    Rico21745

    Joined:
    Apr 25, 2012
    Posts:
    409
    Hi PolyVector:
    I Just picked up Sunshine and have been working to get it implemented into my project. I feel like there's a few, but the current one I'm having problems with is actually non-project specific so I figured I'd post it here (I'm planning on checking on my proj specific ones until I feel there's nothing else I can do myself).

    It appears that Unity 4.5 or DX11 is creating issues with your fragment shader example. If you are one Unity 4.5 and DX11 mode is one, you should see an error in your example vertfrag shader that says "'vert': function return value missing semantics"

    This is a problem for me because I'm using a few different fragment shaders in my project and I'm not a shader guru, just a tinkerer really since it's not my strength. Any ideas on how to fix this, or have a more recent example we could use perhaps?
     
  35. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You will be happy to hear I've just submitted an update to the Asset Store, Skunkie will probably post about it in a minute... Now this will be preliminary support, Orthographic cameras have a whole new set of challenges I haven't run into before... But hopefully it will get you up and running.

    Also, it should have no issues with Deferred rendering.
     
  36. Skunkie

    Skunkie

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

    • Added support for Orthographic Cameras... Works with a Single cascade, no lightmap fading
     
  37. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    This isn't too difficult to fix on a per-shader basis, but I haven't been able to find a general way of fixing it in the
    SUNSHINE_INPUT_PARAMS macro.

    Basically, you must specify a semantic like this:
    Code (csharp):
    1. SUNSHINE_INPUT_PARAMS : TEXCOORD3;
    I can't include the semantic in the macro, because there is no way to know ahead of time which semantics are available (TEXCOORD3 might be already used up in your shader). This is only a problem with DX11 shaders because they're a bit more picky.
     
  38. BabyDinoHerd

    BabyDinoHerd

    Joined:
    Mar 27, 2014
    Posts:
    21
    I'm interested in picking up Sunshine while it's on sale.

    I was wondering how well it integrates with the Alloy Physical Shader Framework.
     
  39. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Alloy definitely can be integrated in the Forward renderer. In the Deferred renderer, you may need to delete Alloy's Internal-PrePassLighting shader and restart the editor. This will impact the lighting model with directional lights, but it can be a good compromise depending on the situation.

    As always though feel free to give Sunshine a try, and if it doesn't work out for any reason I'll give a refund. :)
     
  40. BabyDinoHerd

    BabyDinoHerd

    Joined:
    Mar 27, 2014
    Posts:
    21
    Thanks for the response! I'd definitely be targeting the Deferred renderer, so that's a little unfortunate. What exactly does Internal-PrePassLighting shader do that's incompatible with Sunshine?

    Also, what would the compromise be for the directional lights -- a total loss of lighting information for any Alloy materials (assuming only 1 directional light)? Or rather the lighting would end up like that of Sunshine's standard shared?
     
  41. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You know what, I might be wrong. I'm looking at an old contract project that used Alloy and I can't find a replacement PrePassLighting shader in Alloy... I'm also pretty sure I remember other users successfully combining the two. The only reason I suggested an incompatibility is that I thought both Sunshine and Alloy replaced this shader and you're only allowed to use one or the other. If Alloy doesn't, then there is no issue and it will "just work."

    Sorry I can't be more helpful, I don't own an Alloy license. You could check for yourself if Alloy includes an "Internal-PrePassLighting.shader" file. That might shed some light on the compatibility situation.
     
  42. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    re: my previous post

    "Sunshine needs to be modified to match TOD fog color as the TOD fog color is dynamic not static, and if they need to be matched then it needs to be dynamic as well.
    Is it possible for you make sunshine more flexible by making the color source selectable eg: from a light or fog or some other game object?"

    Any chance of making sunshine more flexible in this area?
    Yes, I *could* modify it but every change I make makes it more difficult to keep synched with updates, so having the base package a little more flexible is very useful too.
     
  43. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I'm not on my computer right now but I believe that is should be possible using a small script with something like this in the Update() method:
    Code (csharp):
    1. Sunshine.Instance.ScatterColor = MyCustomSource;
    By putting this in a separate script you shouldn't have to worry about maintaining modifications.
     
  44. BabyDinoHerd

    BabyDinoHerd

    Joined:
    Mar 27, 2014
    Posts:
    21
    It's definitely there (under Shader/Resources). It's nicely documented, basically adding code in CalculateLight, modifying the ending after #endif //POINT || POINT_COOKIE. The rest is seemingly identical to the Internal-PrePassLighting.shader in Unity's builtin shaders (I'm looking at the 4.3.4 ones, at least).

    So, if Sunshine doesn't affect that part of CalculateLight, then in principle I can take Sunshine's Internal-PrePassLighting.shader and bolt on Alloy's code in the same way that it would be bolted onto Unity's default code. In which case, fantastic! Otherwise ...

    It's good to hear that others have successfully combined them, so hopefully the above is in fact the case.
     
  45. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    If that's the only change, then I would think that's indeed your best bet, combining the two shaders into one (and restarting the Editor to make sure it loads the correct one)
     
  46. meganuke

    meganuke

    Joined:
    Aug 23, 2013
    Posts:
    15
    hi!!!, i bought this from the asset store, i followed the doc, and i can see it working on the unity editor (even with android setup), but wne i upload to the OUYA it doesnt work at all.

    i even tried with your example scene for mobile, and nothing.

    what am i doing wrong?

    edit: i own unity pro, and unity pro for android, i can see it working on the unity editor!!!
     
  47. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    An Ouya (Tegra 3) should be able to support basic PCF 2x2 shadows, but not Light Scatter.

    Make sure to set Sunshine's "Shader Set" to "Mobile", enable the "Custom Shadows" option, and use "Sunshine/Mobile/" shaders in your scene.

    There is a mobile sample scene included, does that run on your Ouya?
     
  48. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
  49. meganuke

    meganuke

    Joined:
    Aug 23, 2013
    Posts:
    15
    i ran the mobile scene.
    it does run, but no shadow, no light scatter
     
  50. meganuke

    meganuke

    Joined:
    Aug 23, 2013
    Posts:
    15
    oh... i see, you dont have the mobile shaders setup in your mobile scene... (how lazy of you!!!)

    ok, made it work on your test scene, now lets see in my game...