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
    Hello,

    Orthographic cameras should work fine, I just ran a quick test and shadows+scatter looked correct.

    Cheers,
    Oren
     
  2. lionroot

    lionroot

    Joined:
    May 1, 2014
    Posts:
    8
    Hey Poly Vector, thanks, I made the purchase. I'm having some troubles on a light study I'm setting up.

    1 - I have my orthographic camera set up below. However, I'm trying to restrict the light coming into the room. When have cast shadows set to two-sided, it doesn't seem to be blocking the light. What I had to do is create two large planes and face them the opposite direction to block it, yet that's imprecise, and the planes are showing up. How do I avoid this?




    2 - I tried getting the shadows on my little cube there working, but it's not. It works on my point light farther in the scene, but not there. Here's my settings

    My setting under Player Settings is Forward Rendering Path with a Linear Color Space
    I have a light probe group
    The Directional light is set to mixed lighting (to try and get the shadows) and the Point light is set to Realtime to get the shadow
    The cubes (big and small) are set to Sunshine/Standard shaders because it is a forward lighting situation.

    I installed forward shaders since my rendering path is forward.

    3 - When you saw avoid image effects, is that for mobile optimizations only? Do you consider Scion Filimic Post-Processing image effects?

    4 - How could I get the animate dither effect to be more pronounced at a zoomed out orthographic look to get give the illusion of dust.

    Thanks!
     
  3. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hello,
    I'll try to answer to the best of my ability.

    1. Sunshine doesn't use the "Cast Shadows" setting, so you'll have to make an adjustment to "Sunshine Occluder.shader". You'll want to add "Cull Off" to the "Opaque" RenderType subshader.
    Code (csharp):
    1.  
    2. Tags { "RenderType" = "Opaque" }
    3.        Pass
    4.             {
    5.                   //Add the following line:
    6.                   Cull Off
    7.  
    2. Here are some ideas. With orthographic cameras, sometimes the camera is placed too far away (but doesn't appear so without perspective). You may need to increase the "Light Distance", or define a "Custom Bounds" Transform which is located under "Advanced Settings". I would try setting the Directional light to "Realtime" just to be sure.

    3. This was only meant as general advice, and was written some time ago... Devices are pretty powerful these days. I don't have experience with the Scion shaders.

    4. The dithering isn't really meant to get a dust effect. You could theoretically modify the Scatter shader to blend with a smoke/dust texture to give a complex look.

    I hope this helps.

    Cheers,
    Oren
     
  4. hlx

    hlx

    Joined:
    Sep 18, 2012
    Posts:
    57
    Hello,

    Is your extension compatible with Unity 5.5 ? How you advanced shadow system manage fading transparency in standard shaders ?

    Regards,

    hlx
     
  5. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    It appears to work in Unity 5.5, and I haven't received any new reports of problems. When new compatibility issues spring up I try to be quick to remedy them.

    Transparent objects normally receive shadows and cast them as if they were Cutouts, but this doesn't appear to be happening in Unity 5.5, hmmm. I'll have to investigate this further.

    Blending transparent objects with Scatter either happens on top of or behind the scatter depending on the effect order, there isn't currently a good way to blend in the middle. It's similar to Unity's "Global Fog" in that respect.

    Cheers,
    Oren
     
  6. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Hi Oren, I'm considering purchasing this but would like to know it's fully working on Unity 5.5.

    From the above post you say it "appears to work" but then go on to say that the transparent objects "don't appear to be happening" ? Could you please confirm if this Asset is fully working on Unity 5.5 ?
     
    Last edited: Dec 17, 2016
  7. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hello radimoto,
    Sorry about the confusion, I only had a few minutes on Friday and was confused when the shadows didn't appear to be received in a quick test project I threw together. I had accidentally only enabled the volumetric scatter and not the custom shadows, so that meant I was seeing Unity's built-in shadows. Silly mistake.

    I tested again this morning and everything appears to be working in both 5.4.1 (the current submitted version) and 5.5.0 when upgraded.

    Both the included replacements for Legacy Transparent Diffuse and the Standard shader (set to Fade) work just fine on my machine.

    Thanks for your patience.

    Cheers,
    Oren
     
  8. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455
    hi, is Atmospheric Scattering same thing as sunshine?
     
  9. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hi,
    Not exactly. Sunshine has a form of "volumetric scattering" which is uniform, whereas atmospheric scattering algorithms tend to adjust the color/effect based on the horizon/sun. There are some atmospheric scattering packages on the asset store, but Sunshine is more "vanilla". :)

    Cheers,
    Oren
     
  10. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    308
    Hi Oren,

    we are considering buying Sunshine for our next VR game (Vive). We are mainly interested in good-looking (as in non-blurry, non-blocky) dyanmic/realtime shadows from the hands and stuff which is in the hands. "The Lab Renderer" worked for us before, but has limitations on the amount of lights, and doesn't seem to play nicely with Unity 5.6 beta.

    So, my questions. First, am I correct in assuming that shadows are supported for all light types (not only directional) and they all look similarly good (I ask because Unity's shadows differ quite a lot between directional and point)? Second, will you update Sunshine for the changes in Unity 5.6 (the major lighting overhaul)? And third, is it ok to test the plug-in and ask for a refund if we find it doesn't fit our needs?

    Thanks!
     
  11. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hello,
    Sunshine is designed primarily to provide volumetric scattering for a single Directional Light, no other lights are supported. The shadows have some interesting features like overcast (cloud) shadows, and a runtime baking-like feature, but they aren't going to be smoother than the PCF 5x5 that's been built-in since Unity 5.

    We will be updating for 5.6 when it is finalized, and of course, you may test out the plugin and ask for a refund if it doesn't work out. Honestly though, it doesn't sound like it's a good given what you're looking for.

    I hope this helps.

    Cheers,
    Oren
     
  12. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    308
    Hi Oren, thanks very much for your honest answer, I really appreciate it! Based on your experience, do you know of any Unity assets (besides "The Lab Renderer") that might have the feature set I am looking for? Thanks!
     
  13. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I'm not aware of many shadow modifying projects out there. I have Shadow Softener, but this is merely attempting to perform a higher-kernel PCF blur, so it's "more blurry". You could see if anyone has done a PCSS implementation, which is where the shadow kernel depends on the distance from the occluder.

    Sorry to not be much help, I've been working on very minimalist games lately and haven't been looking for any fancy assets myself.

    Cheers,
    Oren
     
  14. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    308
    I'll do some lookups on PCSS then. Thanks again!
     
  15. RV1

    RV1

    Joined:
    Nov 18, 2012
    Posts:
    68
    Quick question, does Sunshine take advantage of the feature in Unity 5.5 which uses a reverse depth buffer to improve shadow precision?
     
  16. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    No, Sunshine is completely separate from the built-in shadows and uses it's own depth format packed into a an RGBA32 buffer.

    Cheers,
    Oren
     
  17. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I apologize if this has been asked before, but how to get Sunshine in Scene View?
    1. #if UNITY_5_4_OR_NEWER
    2. [ImageEffectAllowedInSceneView]
    3. #endif
     
  18. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    I don't believe it works in sceneview due to the way it's designed. It's something I'll look into for an update though.
     
    buttmatrix likes this.
  19. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Not sure if this has been asked but does anyone know if Sunshine works correctly with the current VR setups in Vive?

    Also does this work using unity's directional lightmapping setup with a directional light set to Mixed mode. You can bake a unity terrain with a bunch of speed trees using Mixed mode directional lightmapping and the speed trees will bake shadows into the terrain and still cast real-time shadows on themselves and ground based on shadow distance. So before I make a purchase just wanted to make sure Sunshine supports these current setups. Thanks.
     
  20. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Yes, I can confirm Sunshine works very well out-of-the-box with Vive in forward and deferred paths (although for VR better to stick with forward) (Unity 5.4.1f1-3)
     
  21. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi PolyVector,
    I am using Unity 4.6.5f1 and i still get the error :

    sunshine.cs(140,65) error CS1061 Type UnityEngine.Light does not contain a definetion for shadowNormalBias and no extension method of shadowNormalBias of type UnityEngine.Light could be found

    :/
     
  22. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hi Marcell,

    It sound like you're using a new version of Sunshine with an old version of Unity. The Asset Store should have served up an older copy of Sunshine, so that's strange.

    If you navigate to Sunshine using the Asset Store tab there should be an "Update" button that will actually downgrade Sunshine to a compatible version. I just tested this with Unity 4.6.5 and it works fine.

    Cheers,
    Oren
     
  23. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Hello,

    Unity 5.5.1 official build does not work with Sunshine in deferred. They have changed quite a lot with deferred rendering, and I had to find some workarounds for my wrapped diffuse lighting too.

    It's the internal deferred shading replacement -in unity 5.5.1 it's done in 2 passes, but sunshine does everything in one.

    I've got the newest available version of sunshine, downloaded today, using deferred, win 10 64-bit, dx11.

    Is there a newer version or a fix I can receive?
     
  24. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Just downloaded 5.5.1 to test, and I didn't see a problem on my Mac, although I don't have a DX11 setup. Make sure you have Sunshine-DeferredShading selected in the Graphics settings in your project.

    If you still have trouble, try right-clicking and re-importing any shaders throwing errors, I've seen Sunshine import incorrectly the first time.

    Cheers,
    Oren
     
  25. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Seems to be a problem in 5.5.1

    Several other workstations had problems simultaneously on upgrade.

    We downgraded to 5.5.0 and everything works fine.

    Yes. I checked .
     
  26. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Thanks for the info. I'll dig into what changed between these two versions and see if I can come up with a fix for you.

    Cheers,
    Oren
     
  27. Master_Indie

    Master_Indie

    Joined:
    Feb 17, 2017
    Posts:
    10
    Hi, I'm possibly interested in trying Sunshine in my VR game. It's an extremely large map. My camera right now has a view distance of about 45k (and surprisingly the latest version of Unity works well with that). I want to push a shadow distance of at least 3000, preferably up to 10,000. Unity shadows of course glitch out at this distance. I'm ok with lower resolution shadows, as long as they're stable.

    tl:dr
    Does sunshine handle distance better than the Unity shadows?
     
  28. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Thanks PolyVector, the updated shader for internal deferred does work in 5.5.0
     
  29. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Yes. Slightly better. I found with Sunshine I can stretch shadows out to about 300 meters. In Unity, even after hours fiddling with cascades, the shadows look pretty bad after 150 meters. Also, because sunshine can occlude layers per cascade, there's less calculation, less overhead, for those very long ranges.


    HOWEVER...

    I am having quite a time trying to figure out how to make my custom shader with animation cast animated shadows with sunshine. There is no such example to follow, so I'm still working out what's possible.
     
  30. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    How does piggybacking my vertex animation work. Can you please provide a corrected example? The manual is very non-explicit about this. Take my example above: How do I "piggyback" the vertex shader to get the correct shadows?

    NOTE: I'm talking about the "v.vertex.xyz -= float3(sin(_Time.z),0,0);" animation
     
  31. Master_Indie

    Master_Indie

    Joined:
    Feb 17, 2017
    Posts:
    10

    Awesome, thanks for the info. Also, do the cloud/overcast shadows show over an infinite distance (like if you put a tiled cookie on a directional light)? Or do the cloud/overcast shadows only show up for the same distance as the regular shadows?
     
  32. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Your Example:
    Your example doesn't really need piggybacking, that's mostly intended for vertex shaders you don't have control over (ie. in an include file). All you really need to do is add this line to the end of your vert() function:

    Code (csharp):
    1. SUNSHINE_WRITE_SURF_VERTEX(v, o);
    Piggybacking Vertex Shaders:
    If you did want to use piggybacking, you would instead change the SUNSHINE_SURFACE_VERT(Input) line to:
    Code (csharp):
    1. SUNSHINE_SURFACE_VERT_PIGGYBACK(Input,vert)
    This would generate the sunshine_surf_vert function() in a way that also uses your vert() code.

    Simplest Alternative:
    Alternatively you can tell Sunshine to work exclusively in the pixel shader, this can be a good option for complex shaders or when you're stumped. You can do this by adding this line before including Sunshine.
    Code (csharp):
    1. #define SUNSHINE_PUREPIXEL
    Once you do this, you can leave out all vertex-related Sunshine code (No more SUNSHINE_INPUT_PARAMS, or SUNSHINE_XX_VERT).

    Casting Shadows:
    The above techniques deal with shaders recieving shadows, not casting them. If you need a custom vertex animated shader to cast shadows, there is some additional work required:
    1. Use a custom RenderType for the shader, ie. "OpaqueAnimated".
    2. Create a new SubShader in Sunshine Occluder.shader using that RenderType.
    3. perform your vertex modifications there.
    It's a little roundabout, but there's currently no other way in Unity to accomplish this.

    I hope this helps,
    Oren
     
  33. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Projected Overcast Shadows should work over an infinite distance.

    Cheers,
    Oren
     
  34. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Exactly what I was looking for!
     
  35. Master_Indie

    Master_Indie

    Joined:
    Feb 17, 2017
    Posts:
    10
    I just got Sunshine and I'm liking it so far. One problem though, in my main game, the volumetric light scattering jitters in VR. I checked the sample scene and made a new scene and both didn't jitter. It's only my main game that jitters. Any idea on how to fix this?
     
  36. Master_Indie

    Master_Indie

    Joined:
    Feb 17, 2017
    Posts:
    10
    I fixed my own problem. The volumetric light scattering was shaking because my main camera's near clip plane was too small. I had it set to 0.03. I set it to 0.2, now it works fantastic! The lighting looks so amazing. Thank you for this asset!
     
  37. TomasSala-Falconeer

    TomasSala-Falconeer

    Joined:
    Jul 29, 2013
    Posts:
    50
    Hi We just bought sunshine and it looks terrific. I've noticed 2 posts on shaderforge and Sunshine but no examples.
    I must admit being a crack at shaderforge but a horrible mess at actual shadercode.

    I've tried to integrate your codesample into the shaderforge code, but its not giving any output.

    would you mind changing this example, so everyone who uses shaderforge has an example where you change and edit the code for sunshine to work.
    Sorry for not being able to fix it myself..
    Here's a shader as exported from shaderforge:

    I'd love to have this working with the mobile sunshine shadercode.

    Code (CSharp):
    1. // Shader created with Shader Forge v1.32
    2. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
    3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    4. /*SF_DATA;ver:1.32;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:0,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:False,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:False,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.04541522,fgcg:0.2573529,fgcb:0.2485831,fgca:1,fgde:0.01,fgrn:-166.1,fgrf:240.9,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:3138,x:34891,y:32462,varname:node_3138,prsc:2|emission-1649-OUT;n:type:ShaderForge.SFN_VertexColor,id:8325,x:32747,y:32649,varname:node_8325,prsc:2;n:type:ShaderForge.SFN_Fresnel,id:7138,x:32984,y:32230,varname:node_7138,prsc:2|EXP-6153-OUT;n:type:ShaderForge.SFN_Slider,id:6153,x:32407,y:32306,ptovrint:False,ptlb:RimValue,ptin:_RimValue,varname:_RimValue,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:7;n:type:ShaderForge.SFN_Cubemap,id:3508,x:33729,y:32897,ptovrint:False,ptlb:ReflectionMap\,ptin:_ReflectionMap,varname:_ReflectionMap,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,cube:bca01dc2775b2e340b84231643737932,pvfc:0|DIR-9075-OUT,MIP-807-OUT;n:type:ShaderForge.SFN_Add,id:2077,x:34210,y:32479,varname:node_2077,prsc:2|A-9587-OUT,B-8013-OUT;n:type:ShaderForge.SFN_Multiply,id:6236,x:33232,y:32210,varname:node_6236,prsc:2|A-7138-OUT,B-65-OUT;n:type:ShaderForge.SFN_Slider,id:65,x:32799,y:32089,ptovrint:False,ptlb:RimPower,ptin:_RimPower,varname:_RimPower,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:12;n:type:ShaderForge.SFN_Multiply,id:7288,x:34176,y:32883,varname:node_7288,prsc:2|A-9911-OUT,B-3508-G;n:type:ShaderForge.SFN_Multiply,id:4485,x:33681,y:32198,varname:node_4485,prsc:2|A-6925-OUT,B-3574-RGB;n:type:ShaderForge.SFN_Color,id:3574,x:33402,y:32009,ptovrint:False,ptlb:Color,ptin:_Color,varname:_Color,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.5,c2:0.5,c3:0.5,c4:1;n:type:ShaderForge.SFN_LightAttenuation,id:5408,x:34015,y:32105,varname:node_5408,prsc:2;n:type:ShaderForge.SFN_Multiply,id:4541,x:34676,y:32338,varname:node_4541,prsc:2|A-5408-OUT,B-1649-OUT;n:type:ShaderForge.SFN_Add,id:4102,x:33886,y:32360,varname:node_4102,prsc:2|A-3472-OUT,B-4485-OUT;n:type:ShaderForge.SFN_Multiply,id:3472,x:33691,y:32387,varname:node_3472,prsc:2|A-7417-OUT,B-6236-OUT;n:type:ShaderForge.SFN_Tex2d,id:4145,x:32677,y:32414,varname:_dif,prsc:2,ntxv:0,isnm:False|TEX-178-TEX;n:type:ShaderForge.SFN_Multiply,id:7417,x:33508,y:32485,varname:node_7417,prsc:2|A-8325-RGB,B-6925-OUT;n:type:ShaderForge.SFN_Slider,id:807,x:32810,y:33151,ptovrint:False,ptlb:Mip,ptin:_Mip,varname:_Mip,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:5;n:type:ShaderForge.SFN_Multiply,id:9587,x:34050,y:32314,varname:node_9587,prsc:2|A-8325-RGB,B-4102-OUT;n:type:ShaderForge.SFN_ViewVector,id:8962,x:32820,y:32885,varname:node_8962,prsc:2;n:type:ShaderForge.SFN_Multiply,id:7808,x:33170,y:32906,varname:node_7808,prsc:2|A-8962-OUT,B-4298-OUT;n:type:ShaderForge.SFN_Multiply,id:3049,x:33389,y:32744,varname:node_3049,prsc:2|A-5831-OUT,B-7808-OUT;n:type:ShaderForge.SFN_Vector3,id:4298,x:32982,y:32966,varname:node_4298,prsc:2,v1:-1,v2:1,v3:-1;n:type:ShaderForge.SFN_Multiply,id:2405,x:33729,y:32656,varname:node_2405,prsc:2|A-4145-A,B-8325-RGB;n:type:ShaderForge.SFN_Multiply,id:8013,x:34412,y:32854,varname:node_8013,prsc:2|A-7288-OUT,B-3053-OUT;n:type:ShaderForge.SFN_Slider,id:3053,x:34063,y:33036,ptovrint:False,ptlb:Reflectiveness,ptin:_Reflectiveness,varname:_Reflectiveness,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:7;n:type:ShaderForge.SFN_RemapRange,id:9911,x:33969,y:32763,varname:node_9911,prsc:2,frmn:0,frmx:1,tomn:0.3,tomx:1|IN-2405-OUT;n:type:ShaderForge.SFN_Slider,id:829,x:32903,y:32741,ptovrint:False,ptlb:Distortion,ptin:_Distortion,varname:_Distortion,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:10;n:type:ShaderForge.SFN_Power,id:5831,x:33235,y:32714,varname:node_5831,prsc:2|VAL-4145-RGB,EXP-829-OUT;n:type:ShaderForge.SFN_Multiply,id:1649,x:34512,y:32401,varname:node_1649,prsc:2|A-2073-OUT,B-2077-OUT;n:type:ShaderForge.SFN_RemapRange,id:2073,x:34303,y:32276,varname:node_2073,prsc:2,frmn:0,frmx:1,tomn:0.3,tomx:1|IN-5130-A;n:type:ShaderForge.SFN_Tex2dAsset,id:178,x:32361,y:32442,ptovrint:False,ptlb:MainTex,ptin:_MainTex,varname:_MainTex,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_TexCoord,id:9568,x:32317,y:32664,varname:node_9568,prsc:2,uv:1;n:type:ShaderForge.SFN_Tex2d,id:5130,x:32621,y:32795,varname:_node_7420,prsc:2,ntxv:0,isnm:False|UVIN-1981-OUT,TEX-178-TEX;n:type:ShaderForge.SFN_Multiply,id:1981,x:32496,y:32615,varname:node_1981,prsc:2|A-9568-UVOUT,B-4751-OUT;n:type:ShaderForge.SFN_Vector1,id:4751,x:32348,y:32796,varname:node_4751,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Add,id:9075,x:33592,y:33015,varname:node_9075,prsc:2|A-3049-OUT,B-1006-OUT;n:type:ShaderForge.SFN_Vector1,id:7505,x:33200,y:33141,varname:node_7505,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:1006,x:33413,y:33083,varname:node_1006,prsc:2|A-7808-OUT,B-7505-OUT;n:type:ShaderForge.SFN_Desaturate,id:3380,x:33046,y:32420,varname:node_3380,prsc:2|COL-4145-RGB;n:type:ShaderForge.SFN_Multiply,id:6925,x:33370,y:32345,varname:node_6925,prsc:2|A-3380-OUT,B-9384-OUT;n:type:ShaderForge.SFN_Vector1,id:9384,x:33230,y:32397,varname:node_9384,prsc:2,v1:3;proporder:6153-3508-65-3574-807-3053-829-178;pass:END;sub:END;*/
    5.  
    6. Shader "Apollo/LunarSurface" {
    7.     Properties {
    8.         _RimValue ("RimValue", Range(0, 7)) = 0
    9.         _ReflectionMap ("ReflectionMap\", Cube) = "_Skybox" {}
    10.        _RimPower ("RimPower", Range(0, 12)) = 0
    11.        _Color ("Color", Color) = (0.5,0.5,0.5,1)
    12.        _Mip ("Mip", Range(0, 5)) = 0
    13.        _Reflectiveness ("Reflectiveness", Range(0, 7)) = 1
    14.        _Distortion ("Distortion", Range(0, 10)) = 1
    15.        _MainTex ("MainTex", 2D) = "white" {}
    16.    }
    17.    SubShader {
    18.        Tags {
    19.            "RenderType"="Opaque"
    20.        }
    21.        Pass {
    22.            Name "FORWARD"
    23.            Tags {
    24.                "LightMode"="ForwardBase"
    25.            }
    26.          
    27.          
    28.            CGPROGRAM
    29.            #pragma vertex vert
    30.            #pragma fragment frag
    31.            #define UNITY_PASS_FORWARDBASE
    32.            #include "UnityCG.cginc"
    33.            #pragma multi_compile_fwdbase_fullshadows
    34.            #pragma multi_compile_fog
    35.            #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal n3ds wiiu
    36.            #pragma target 3.0
    37.            uniform float _RimValue;
    38.            uniform samplerCUBE _ReflectionMap;
    39.            uniform float _RimPower;
    40.            uniform float4 _Color;
    41.            uniform float _Mip;
    42.            uniform float _Reflectiveness;
    43.            uniform float _Distortion;
    44.            uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
    45.            struct VertexInput {
    46.                float4 vertex : POSITION;
    47.                float3 normal : NORMAL;
    48.                float2 texcoord0 : TEXCOORD0;
    49.                float2 texcoord1 : TEXCOORD1;
    50.                float4 vertexColor : COLOR;
    51.            };
    52.            struct VertexOutput {
    53.                float4 pos : SV_POSITION;
    54.                float2 uv0 : TEXCOORD0;
    55.                float2 uv1 : TEXCOORD1;
    56.                float4 posWorld : TEXCOORD2;
    57.                float3 normalDir : TEXCOORD3;
    58.                float4 vertexColor : COLOR;
    59.                UNITY_FOG_COORDS(4)
    60.            };
    61.            VertexOutput vert (VertexInput v) {
    62.                VertexOutput o = (VertexOutput)0;
    63.                o.uv0 = v.texcoord0;
    64.                o.uv1 = v.texcoord1;
    65.                o.vertexColor = v.vertexColor;
    66.                o.normalDir = UnityObjectToWorldNormal(v.normal);
    67.                o.posWorld = mul(unity_ObjectToWorld, v.vertex);
    68.                o.pos = mul(UNITY_MATRIX_MVP, v.vertex );
    69.                UNITY_TRANSFER_FOG(o,o.pos);
    70.                return o;
    71.            }
    72.            float4 frag(VertexOutput i) : COLOR {
    73.                i.normalDir = normalize(i.normalDir);
    74.                float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    75.                float3 normalDirection = i.normalDir;
    76. ////// Lighting:
    77. ////// Emissive:
    78.                float2 node_1981 = (i.uv1*0.5);
    79.                float4 _node_7420 = tex2D(_MainTex,TRANSFORM_TEX(node_1981, _MainTex));
    80.                float4 _dif = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
    81.                float node_6925 = (dot(_dif.rgb,float3(0.3,0.59,0.11))*3.0);
    82.                float3 node_7808 = (viewDirection*float3(-1,1,-1));
    83.                float3 node_1649 = ((_node_7420.a*0.7+0.3)*((i.vertexColor.rgb*(((i.vertexColor.rgb*node_6925)*(pow(1.0-max(0,dot(normalDirection, viewDirection)),_RimValue)*_RimPower))+(node_6925*_Color.rgb)))+((((_dif.a*i.vertexColor.rgb)*0.7+0.3)*texCUBElod(_ReflectionMap,float4(((pow(_dif.rgb,_Distortion)*node_7808)+(node_7808*0.5)),_Mip)).g)*_Reflectiveness)));
    84.                float3 emissive = node_1649;
    85.                float3 finalColor = emissive;
    86.                fixed4 finalRGBA = fixed4(finalColor,1);
    87.                UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
    88.                return finalRGBA;
    89.            }
    90.            ENDCG
    91.        }
    92.    }
    93.    FallBack "Diffuse"
    94.    CustomEditor "ShaderForgeMaterialInspector"
    95. }
    96.  
     
  38. TomasSala-Falconeer

    TomasSala-Falconeer

    Joined:
    Jul 29, 2013
    Posts:
    50
    I seemed to have fixed it myself (facepalm)
    but perhaps you can confirm this is a proper way of doing it,, updated code
    Code (CSharp):
    1. // Shader created with Shader Forge v1.32
    2. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
    3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    4. /*SF_DATA;ver:1.32;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:0,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:False,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:False,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.04541522,fgcg:0.2573529,fgcb:0.2485831,fgca:1,fgde:0.01,fgrn:-166.1,fgrf:240.9,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:3138,x:34891,y:32462,varname:node_3138,prsc:2|emission-4541-OUT;n:type:ShaderForge.SFN_VertexColor,id:8325,x:32747,y:32649,varname:node_8325,prsc:2;n:type:ShaderForge.SFN_Fresnel,id:7138,x:32984,y:32230,varname:node_7138,prsc:2|EXP-6153-OUT;n:type:ShaderForge.SFN_Slider,id:6153,x:32407,y:32306,ptovrint:False,ptlb:RimValue,ptin:_RimValue,varname:_RimValue,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:7;n:type:ShaderForge.SFN_Cubemap,id:3508,x:33729,y:32897,ptovrint:False,ptlb:ReflectionMap\,ptin:_ReflectionMap,varname:_ReflectionMap,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,cube:bca01dc2775b2e340b84231643737932,pvfc:0|DIR-9075-OUT,MIP-807-OUT;n:type:ShaderForge.SFN_Add,id:2077,x:34210,y:32479,varname:node_2077,prsc:2|A-9587-OUT,B-8013-OUT;n:type:ShaderForge.SFN_Multiply,id:6236,x:33232,y:32210,varname:node_6236,prsc:2|A-7138-OUT,B-65-OUT;n:type:ShaderForge.SFN_Slider,id:65,x:32799,y:32089,ptovrint:False,ptlb:RimPower,ptin:_RimPower,varname:_RimPower,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:12;n:type:ShaderForge.SFN_Multiply,id:7288,x:34176,y:32883,varname:node_7288,prsc:2|A-9911-OUT,B-3508-G;n:type:ShaderForge.SFN_Multiply,id:4485,x:33681,y:32198,varname:node_4485,prsc:2|A-6925-OUT,B-3574-RGB;n:type:ShaderForge.SFN_Color,id:3574,x:33402,y:32009,ptovrint:False,ptlb:Color,ptin:_Color,varname:_Color,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.5,c2:0.5,c3:0.5,c4:1;n:type:ShaderForge.SFN_LightAttenuation,id:5408,x:34015,y:32105,varname:node_5408,prsc:2;n:type:ShaderForge.SFN_Multiply,id:4541,x:34676,y:32338,varname:node_4541,prsc:2|A-5408-OUT,B-1649-OUT;n:type:ShaderForge.SFN_Add,id:4102,x:33886,y:32360,varname:node_4102,prsc:2|A-3472-OUT,B-4485-OUT;n:type:ShaderForge.SFN_Multiply,id:3472,x:33691,y:32387,varname:node_3472,prsc:2|A-7417-OUT,B-6236-OUT;n:type:ShaderForge.SFN_Tex2d,id:4145,x:32677,y:32414,varname:_dif,prsc:2,ntxv:0,isnm:False|TEX-178-TEX;n:type:ShaderForge.SFN_Multiply,id:7417,x:33508,y:32485,varname:node_7417,prsc:2|A-8325-RGB,B-6925-OUT;n:type:ShaderForge.SFN_Slider,id:807,x:32810,y:33151,ptovrint:False,ptlb:Mip,ptin:_Mip,varname:_Mip,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:5;n:type:ShaderForge.SFN_Multiply,id:9587,x:34050,y:32314,varname:node_9587,prsc:2|A-8325-RGB,B-4102-OUT;n:type:ShaderForge.SFN_ViewVector,id:8962,x:32820,y:32885,varname:node_8962,prsc:2;n:type:ShaderForge.SFN_Multiply,id:7808,x:33170,y:32906,varname:node_7808,prsc:2|A-8962-OUT,B-4298-OUT;n:type:ShaderForge.SFN_Multiply,id:3049,x:33389,y:32744,varname:node_3049,prsc:2|A-5831-OUT,B-7808-OUT;n:type:ShaderForge.SFN_Vector3,id:4298,x:32982,y:32966,varname:node_4298,prsc:2,v1:-1,v2:1,v3:-1;n:type:ShaderForge.SFN_Multiply,id:2405,x:33729,y:32656,varname:node_2405,prsc:2|A-4145-A,B-8325-RGB;n:type:ShaderForge.SFN_Multiply,id:8013,x:34412,y:32854,varname:node_8013,prsc:2|A-7288-OUT,B-3053-OUT;n:type:ShaderForge.SFN_Slider,id:3053,x:34063,y:33036,ptovrint:False,ptlb:Reflectiveness,ptin:_Reflectiveness,varname:_Reflectiveness,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:7;n:type:ShaderForge.SFN_RemapRange,id:9911,x:33969,y:32763,varname:node_9911,prsc:2,frmn:0,frmx:1,tomn:0.3,tomx:1|IN-2405-OUT;n:type:ShaderForge.SFN_Slider,id:829,x:32903,y:32741,ptovrint:False,ptlb:Distortion,ptin:_Distortion,varname:_Distortion,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:10;n:type:ShaderForge.SFN_Power,id:5831,x:33235,y:32714,varname:node_5831,prsc:2|VAL-4145-RGB,EXP-829-OUT;n:type:ShaderForge.SFN_Multiply,id:1649,x:34512,y:32401,varname:node_1649,prsc:2|A-2073-OUT,B-2077-OUT;n:type:ShaderForge.SFN_RemapRange,id:2073,x:34303,y:32276,varname:node_2073,prsc:2,frmn:0,frmx:1,tomn:0.3,tomx:1|IN-5130-A;n:type:ShaderForge.SFN_Tex2dAsset,id:178,x:32361,y:32442,ptovrint:False,ptlb:MainTex,ptin:_MainTex,varname:_MainTex,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_TexCoord,id:9568,x:32317,y:32664,varname:node_9568,prsc:2,uv:1;n:type:ShaderForge.SFN_Tex2d,id:5130,x:32621,y:32795,varname:_node_7420,prsc:2,ntxv:0,isnm:False|UVIN-1981-OUT,TEX-178-TEX;n:type:ShaderForge.SFN_Multiply,id:1981,x:32496,y:32615,varname:node_1981,prsc:2|A-9568-UVOUT,B-4751-OUT;n:type:ShaderForge.SFN_Vector1,id:4751,x:32348,y:32796,varname:node_4751,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Add,id:9075,x:33592,y:33015,varname:node_9075,prsc:2|A-3049-OUT,B-1006-OUT;n:type:ShaderForge.SFN_Vector1,id:7505,x:33200,y:33141,varname:node_7505,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:1006,x:33413,y:33083,varname:node_1006,prsc:2|A-7808-OUT,B-7505-OUT;n:type:ShaderForge.SFN_Desaturate,id:3380,x:33046,y:32420,varname:node_3380,prsc:2|COL-4145-RGB;n:type:ShaderForge.SFN_Multiply,id:6925,x:33370,y:32345,varname:node_6925,prsc:2|A-3380-OUT,B-9384-OUT;n:type:ShaderForge.SFN_Vector1,id:9384,x:33230,y:32397,varname:node_9384,prsc:2,v1:3;proporder:6153-3508-65-3574-807-3053-829-178;pass:END;sub:END;*/
    5.  
    6. Shader "Apollo/LunarSurface" {
    7.     Properties {
    8.         _RimValue ("RimValue", Range(0, 7)) = 0
    9.         _ReflectionMap ("ReflectionMap\", Cube) = "_Skybox" {}
    10.        _RimPower ("RimPower", Range(0, 12)) = 0
    11.        _Color ("Color", Color) = (0.5,0.5,0.5,1)
    12.        _Mip ("Mip", Range(0, 5)) = 0
    13.        _Reflectiveness ("Reflectiveness", Range(0, 7)) = 1
    14.        _Distortion ("Distortion", Range(0, 10)) = 1
    15.        _MainTex ("MainTex", 2D) = "white" {}
    16.    }
    17.    SubShader {
    18.        Tags {
    19.            "RenderType"="Opaque"
    20.        }
    21.        Pass {
    22.            Name "FORWARD"
    23.            Tags {
    24.                "LightMode"="ForwardBase"
    25.            }
    26.          
    27.          
    28.            CGPROGRAM
    29.            #pragma vertex vert
    30.            #pragma fragment frag
    31.            #define UNITY_PASS_FORWARDBASE
    32.            #include "UnityCG.cginc"
    33.            #include "AutoLight.cginc"
    34.            #include "Lighting.cginc"
    35.        //sunshine insert
    36. #define SUNSHINE_MOBILE
    37. #include "Assets/Sunshine/Shaders/Sunshine.cginc"
    38. #pragma multi_compile SUNSHINE_DISABLED SUNSHINE_FILTER_PCF_2x2 SUNSHINE_FILTER_HARD
    39.        //end sunshine insert
    40.            #pragma multi_compile_fwdbase_fullshadows
    41.            #pragma multi_compile_fog
    42.            #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal n3ds wiiu
    43.            #pragma target 3.0
    44.            uniform float _RimValue;
    45.            uniform samplerCUBE _ReflectionMap;
    46.            uniform float _RimPower;
    47.            uniform float4 _Color;
    48.            uniform float _Mip;
    49.            uniform float _Reflectiveness;
    50.            uniform float _Distortion;
    51.            uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
    52.            struct VertexInput {
    53.                float4 vertex : POSITION;
    54.                float3 normal : NORMAL;
    55.                float2 texcoord0 : TEXCOORD0;
    56.                float2 texcoord1 : TEXCOORD1;
    57.                float4 vertexColor : COLOR;
    58.            };
    59.            struct VertexOutput {
    60.                float4 pos : SV_POSITION;
    61.                float2 uv0 : TEXCOORD0;
    62.                float2 uv1 : TEXCOORD1;
    63.                float4 posWorld : TEXCOORD2;
    64.                float3 normalDir : TEXCOORD3;
    65.          
    66.                float4 vertexColor : COLOR;
    67.                LIGHTING_COORDS(4,5)
    68.                UNITY_FOG_COORDS(6)
    69.                    //sunshine insert
    70.                    SUNSHINE_INPUT_PARAMS: TEXCOORD4;
    71.                //end sunshine insert
    72.            };
    73.            VertexOutput vert (VertexInput v) {
    74.                VertexOutput o = (VertexOutput)0;
    75.                o.uv0 = v.texcoord0;
    76.                o.uv1 = v.texcoord1;
    77.                o.vertexColor = v.vertexColor;
    78.                o.normalDir = UnityObjectToWorldNormal(v.normal);
    79.                o.posWorld = mul(unity_ObjectToWorld, v.vertex);
    80.                o.pos = mul(UNITY_MATRIX_MVP, v.vertex );
    81.                //sunshine insert
    82.                SUNSHINE_WRITE_VERTEX(v, o);
    83.                //end sunshine insert
    84.                UNITY_TRANSFER_FOG(o,o.pos);
    85.                TRANSFER_VERTEX_TO_FRAGMENT(o)
    86.                return o;
    87.            }
    88.  
    89.  
    90.            float4 frag(VertexOutput i) : COLOR {
    91.                i.normalDir = normalize(i.normalDir);
    92.                float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    93.                float3 normalDirection = i.normalDir;
    94. ////// Lighting:
    95.               //sunshine insert  ** I multiply the attenuation later, so I just replaced the regular shaderforge light attenuation with the sunshine attenuation***
    96.              
    97.                float attenuation = SUNSHINE_ATTENUATION(i);
    98.                //end sunshine insert
    99. ////// Emissive:
    100.                float2 node_1981 = (i.uv1*0.5);
    101.                float4 _node_7420 = tex2D(_MainTex,TRANSFORM_TEX(node_1981, _MainTex));
    102.                float4 _dif = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
    103.                float node_6925 = (dot(_dif.rgb,float3(0.3,0.59,0.11))*3.0);
    104.                float3 node_7808 = (viewDirection*float3(-1,1,-1));
    105.                float3 emissive = (attenuation*((_node_7420.a*0.7+0.3)*((i.vertexColor.rgb*(((i.vertexColor.rgb*node_6925)*(pow(1.0-max(0,dot(normalDirection, viewDirection)),_RimValue)*_RimPower))+(node_6925*_Color.rgb)))+((((_dif.a*i.vertexColor.rgb)*0.7+0.3)*texCUBElod(_ReflectionMap,float4(((pow(_dif.rgb,_Distortion)*node_7808)+(node_7808*0.5)),_Mip)).g)*_Reflectiveness))));
    106.                float3 finalColor = emissive;
    107.                fixed4 finalRGBA = fixed4(finalColor,1);
    108.                UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
    109.                return finalRGBA;
    110.            }
    111.            ENDCG
    112.        }
    113.    }
    114.    FallBack "Diffuse"
    115.    CustomEditor "ShaderForgeMaterialInspector"
    116. }
    117.  
     
  39. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    You beat me to it!

    This looks exactly correct, and it appears to work in my test scene too.

    Cheers,
    Oren
     
  40. Skunkie

    Skunkie

    Joined:
    Jul 2, 2012
    Posts:
    75
    Sunshine 1.8.6 is Now Available in the Asset Store
    • Unity 5.6.0 Support
    • Upgraded Standard/Legacy shaders
     
  41. justinl

    justinl

    Joined:
    Aug 27, 2012
    Posts:
    58
    Hi,

    Is it possible to get a download from you guys directly for the 1.8.6 update? We're updating our version in our project but when we download 1.8.6 from the Asset Store tab in Unity, the Unity diff tool shows that nothing is actually changed, and in sunshine.cs it still says public const string Version = "1.8.5". This also happens if I simply create a new Unity project, and only import Sunshine. The asset store tab says 1.8.6 is downloaded, but the code is identical to the 1.8.5 version we have on our source control repo. We need the update as we're trying to update to Unity 5.6. Thanks!
     
  42. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Hello,
    Make sure you're running Unity 5.6.0f2 or above (I believe the final release was 5.6.0f3). I just tested with a blank project and Sunshine 1.8.6 updated/imported correctly.

    Cheers,
    Oren
     
  43. justinl

    justinl

    Joined:
    Aug 27, 2012
    Posts:
    58
    Thanks! That did it. Another question:

    Does Sunshine support shadows in single pass rendering for VR? We're working on a VR game and the shadows in both eyes don't match up properly.
     
  44. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    I also would like support for single pass rendering on GearVR to be exact, but i think its the same as all VR platforms.
     
  45. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
    Sorry, I don't believe Sunshine works with single-pass VR rendering. It has been used successfully in VR in one form or another though. Sorry for the vague answer, I don't have a lot of VR expertise.

    Cheers,
    Oren
     
  46. RV1

    RV1

    Joined:
    Nov 18, 2012
    Posts:
    68
    Hi,

    I have recently noticed that enabling shadow cascades doesn't produce correct shadows in Unity 5.6.1p2 (Windows platform DX11 forward rendering) and Sunshine 1.8.6. They worked fine in Unity 5.5.x and I'm unsure what 5.6.x version of Unity they broke in (it might have worked in 5.6.0 but I can't remember). When I turn off cascades, the shadows work fine.

    I was able to reproduce this problem in an empty Unity project with just Sunshine imported and a simple test scene and if you wish I can send you a copy of the project.

    Thanks.
     
  47. PolyVector

    PolyVector

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

    I've been running some experiments and narrowed it down to regressing between Unity 5.6.0 and 5.6.1. Unfortunately it appears to be just about the strangest Unity bug I've seen yet, and I can't even begin to rationalize the behavior I'm seeing Unity exhibit in the Frame Debugger.

    What I'm seeing is Unity 5.6.1 drastically changes the way cameras render to RenderTextures.
    1. A Camera renders to a RenderTexture using a smaller Viewport by adjusting the Camera.rect
    2. Unity allocates a separate Temporary RenderTexture and uses that instead with a Full Viewport.
    3. It then blits the smaller RenderTexture back to the original RenderTexture incorrectly overwriting the entire thing.
    4. The previous step is marked as Resolving AA... Despite MSAA not being used.
    Steps 2 through 4 are wastefull, inefficient, buggy, and nonsensical. I can't imagine that this behavior is on purpose, my best guess is that it's the result of them focusing on VR to the detriment of everything else.

    I'm not sure this one can be worked around, and the performance is being harmed even with a single cascade. Sorry for the inconvenience, I'll be submitting a bug report with Unity today.
     
    RV1 likes this.
  48. RV1

    RV1

    Joined:
    Nov 18, 2012
    Posts:
    68
    Thanks so much for taking time to look at this. Totally not your fault as sadly Unity 5.6.x has broken many things :(
     
  49. PolyVector

    PolyVector

    Joined:
    Dec 24, 2011
    Posts:
    765
  50. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I am unable to get Sunshine custom shadow mapping on a terrain using RTP shaders in the forward path. Is this a known issue? I'm fairly certain the issue is related to the fact that the shader or material instance RTP is using in the terrain engine is not being modified by Sunshine's forward shader installation process.
     
    Last edited: Jun 9, 2017