Search Unity

SilverLining for Unity: 3D volumetric clouds, sim-quality procedural skies [DEPRECATED]

Discussion in 'Assets and Asset Store' started by sundog, Oct 6, 2011.

  1. BouliBouli

    BouliBouli

    Joined:
    Nov 14, 2013
    Posts:
    12
    Thanks for the quick reply sundog!
    I found the problem, actually it's an oculus prefab bug:
    https://developer.oculusvr.com/forums/viewtopic.php?f=37&t=1273

    Apparently, something overrides the fov value to default when in playmode, and yes, when you select the oculus cameras prefab it 'fixes' (but only on the play mode, not on a build)

    All the fixes seems to be for the 0.2.4 version (I'm running 0.2.5, so, trying to make it run here).
    EDIT: Fixed! Actually it was quite simple! Instead of changing the prefab far clip plane value, you gotta manually set both oculus camera far clip planes!

    PS: I'm sorry for the lack of attention, you're right! I meant far clip plane, not field of view!

    And another detail is, oculus prefab sets automatically both cams as main cameras, this doens't seem to be the problem anyway.
     
    Last edited: Nov 20, 2013
  2. Zeruel

    Zeruel

    Joined:
    Nov 26, 2010
    Posts:
    19
    I was wondering what the situation is with cumulous clouds and shuriken. By default shuriken is set to false in SilverLiningCumulousCloud which results in the Legacy prefab / particle system being used. If shuriken is set to true no clouds seem to appear. Were there any visual or performance benefits to using Shuriken particles or is the intention to only use the Legacy cumulous prefab?
     
  3. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    At one point we undertook the effort to convert SilverLining to use Shuriken, but we found that performance took a huge hit as a result. For what we're doing, the legacy particle system meets our needs and is much more efficient.

    Think of the Shuriken code inside SilverLining's scripts as an evolutionary dead end. It's SilverLining's appendix, and we'll probably just remove it at some point.
     
  4. Zeruel

    Zeruel

    Joined:
    Nov 26, 2010
    Posts:
    19
    Thanks for the quick and detailed response!
     
  5. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Hi gang,

    It came to my attention that the asset store was at least one version behind for the SilverLining 3D cloud sky package. So, we've re-submitted the latest version (1.7) along with a few more recent improvements. It's available now at https://www.assetstore.unity3d.com/#/content/2029

    Newer features include:

    - Controls for the size of the sun and moon are now exposed.
    - Fixes for the orientation of the moon and the motion of the stars at night. SilverLining's night skies now boast planetarium-accuracy.
    - Option for fast, automatic time advancement at any rate of time passage. Develop time-lapse effects with the sun, moon, scene lighting, and volumetric cloud lighting smoothly changing as the time of day progresses.

    We're putting the finishing touches on a new demo video today, so stay tuned for that as well.

    Thanks!
     
  6. Hrothvitnir

    Hrothvitnir

    Joined:
    Apr 26, 2013
    Posts:
    109
    I might be interested in this as well, depending on cost and performance of course.
    Specifically I'd like to be able to simulate the eye wall of a hurricane. I had been planning to fake it with sky box effects, but if we could have moving clouds with volume you could move through and see from above that would be a justifiable purchase (my project doesn't have a lot of use for skies otherwise, lol). I saw your earlier comment about a wind variable above, but I'm guessing that is linear, and would not do rotation? Would your "pro version" possibly have this feature?
     
  7. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    That's right, SilverLining's winds are linear, even in the "Pro" C++ product.

    It would be possible, with some C# skills, to create your own cloud layer object containing a spinning, cylindrical arrangement of cumulus congestus clouds using SilverLining's existing classes as a starting point. But, for the amount and density of clouds required to simulate a hurricane, I'd be concerned about performance from all those particles. You might be better off with the sky box approach for this one, in all honesty.
     
  8. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I've got a day/night simulator with SilverLining, running at a fast clip (24 hours every two minutes), and the cirrus clouds appear/disappear instantly, rather than fading in and out. Is there a way to smooth that out when the cycle is accelerated?
     
  9. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Hi Dave,

    I'm having trouble reproducing what you are describing. The cirrus clouds shouldn't disappear at all; if I open up the sample scene included in SilverLining / Unity 1.71, turn on auto time advance, and set the advance rate to 5000, I see the cirrus clouds smoothly light and get dark as time progresses.

    Perhaps the issue is specific to a certain location or some other settings? If you can reproduce what you're seeing in the sample scene, please let me know what settings you had to change to make it happen.
     
  10. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Check out our new demo video! It's a pirate battle scene, created entirely with Unity using our SilverLining Sky 3D Cloud asset, and our Triton 3D Ocean Water asset.

    [video=youtube_share;dMiBHSIR9AY]http://youtu.be/dMiBHSIR9AY

    This video showcases SilverLining's dynamic skydome system, capable of representing a full 24 hour cycle with skies accurate for any given time and location. You'll see an eagle flying through our 3D volumetric cumulus clouds, lit with multiple forward scattering, and all scene lighting is done using SilverLining's tone-mapped natural light sources. SilverLining's ephemeris model powers the accurate location of the stars, sun, and moon in this video as well.

    Enjoy!
     
  11. HiredK

    HiredK

    Joined:
    Jan 31, 2014
    Posts:
    12
    Hello,

    Back when I implemented SilverLining in C++ I remembered seeing a function called GetFogSettings() that would return exactly the color and density of the fog based on the time of the day. Unfortunately after skimming trough the Unity implementation source I could not find the equivalent. I was wandering if I just missed something or if it's simply not implemented yet?

    Pretty awesome video by the way :)
     
    Last edited: Feb 1, 2014
  12. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks! Fog in SilverLining has always been more of a push model than a pull - you tell it what fog and visibility conditions you want, and it'll fog the clouds accordingly. The C++ SDK has an AtmosphericConditions::GetFog() method which may be what you recall, but all that does is parrot back any explicit fog settings you gave to SilverLining via SetFog() - or, if you're inside a stratus cloud, it will give you back recommended fog settings for your application. SilverLining for Unity however manages fogging the scene inside a stratus cloud for you automatically.

    SilverLining for Unity just reads the render settings fog values and applies them, depending on whether the checkboxes for "apply fog to sky dome" and "apply fog to cloud" are checked. To get those fog values back, just query Unity's RenderSettings object (http://docs.unity3d.com/Documentation/ScriptReference/RenderSettings.html)

    Hope this helps.
     
  13. HiredK

    HiredK

    Joined:
    Jan 31, 2014
    Posts:
    12
    Hello

    I kinda understand but still, I can't seem to figure out how to get a fog that properly blend with the current sky. When I turn on the fog in the render settings and then enable "apply fog to sky", the sky seem to be affected by the fog thus making it no longer visible (the fog also stay the color specified in the settings). Since I want a dynamic day/night cycle while keeping the fog effect (for terrain rendering), it's pretty crucial for me to have SilverLining provide the correct fog color at run time, I presume this value would be the lowest color visible at the horizon to properly blend the fog.

    Thank you.
     
  14. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Oh, I see what you mean. Yes, the C++ SDK has methods for getting the sky color at the horizon in a specific direction. That doesn't exist in the Unity version.

    However, with a sufficiently low fog density (try like 0.0001), the "apply fog to sky" option should result in the sky fogging toward a fixed fog color at the horizon, which should then match the fog on your distant terrain etc. That's the intended way to handle sky / terrain fog blending in Unity with SilverLining. If necessary, you might need to scale the fog density as it's read in from the fog settings (look around line 224 in SilverLiningSky.cs) if you need a different density on the sky vs. everything else.

    You'll need to make sure your fog color is consistent with the time of day still. You can do that by getting the ambient light from the SilverLiningSunLight object and multiplying that with your base fog color at runtime, say in an Update method somewhere. Or, if you are modifying where the SilverLining reads in the RenderSettings fog as described above, multiplying it with the results of SilverLiningSky.GetSunOrMoonColor() there would also do the job.
     
    Last edited: Feb 2, 2014
  15. HiredK

    HiredK

    Joined:
    Jan 31, 2014
    Posts:
    12
    Thanks for the reply,

    I have tried both methods you proposed and even played around with the settings to get a descent (realist?) result but the sun light color is very different from what the color of the fog should be, even when multiplied by any base color.

    Exemple

    Now the thing is I remember getting exactly the result I wanted from the C++ SDK, is there a reason why it was omitted from the Unity version? In any case may I ask what was the logic behind this particular function (getting the sky color at the horizon) I could at least try to implement it. I was thinking of holding the fog color in a Tex1D and performing a lookup based on the position of the sun (rather than the time of the day) but I'd like to know if there could be a more efficient way to do this...
     
  16. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    To put it simply, we can't really justify recreating the development effort that went into a $3500 piece of software into a $125 piece of software. Recreating the GetHorizonColor() method from the C++ SDK would basically involve re-implementing all of the logic in the SilverLiningSky shader in C# and putting an API around it.

    But - I've done some experimenting and I think I have some more concrete guidance on how to achieve the effect you're after with much less effort. In SilverLiningSky.cs, try replacing the block of code at line 224 with the following:


    if (RenderSettings.fog doFog) {
    Color baseFogColor = new Color(0.8f, 0.9f, 1.0f, 1.0f);
    Color litFogColor = baseFogColor * GetSunOrMoonColor();
    RenderSettings.fogColor = litFogColor;
    fogColor = litFogColor;
    fogDensity = 0.0003f;
    fogDistance = fogThickness;
    }


    I created a simple test terrain, set my render settings fog to Exp2 and with a density of 0.01, and got some really nice sky/terrain blending and fog colors at all times of day with this approach.

    This snippet hard-codes the "base," unlit fog color to approximate the noontime horizon color you might see with some haze in the air - but you might want to expose this as a parameter on the _SilverLiningSky prefab.

    Let me know if that works better for you. If so, I think it would be a good idea for us to change our current approach for fog to this in the next update.

    Your idea of creating a lookup table of horizon color as a function of sun altitude would also work.
     
  17. HiredK

    HiredK

    Joined:
    Jan 31, 2014
    Posts:
    12
    Awesome, it actually works pretty well! Thanks a lot for the support on this issue :D
     
  18. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    I'm loving the accuracy. I have a support question I figured I'd just post here. When I have cirrus clouds enabled (box checked in _SilverLiningSky), with mostly default settings, I get a weird line in my sky:



    If I uncheck the Mesh Renderer on the 2nd CirrusCloudPrefab(Clone) then it disables whatever is showing the line:



    Ideas?
     
  19. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks for using SilverLining!

    It looks like your camera's far clip plane is cutting off the cirrus cloud. Try pushing out your far clip to around 100km and it should clear up.
     
  20. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Thanks for providing it :)

    Setting the far clip to above 100k fixed it! That saved me a lot of time.

     
  21. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Is there a good way to 'enforce' a horizon? If I go to the top of a mountain in my game, and look down, I can see below the natural horizon. The horizon seems to orient its position to the camera's position, so I get situations where the sunset event happens while the sun is above the terrain, like:



    I also need a horizon in order to hide the stars that would otherwise appear below the terrain horizon. Render Settings fog is no good for that. I'm currently using Unity's old Global Fog shader, which mitigates things but has some other (separate) issues I'd like to avoid.
     
    Last edited: Feb 13, 2014
  22. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    The right way to deal with this is to have some sort of ground plane that extends far enough to create a horizon line. 100km should do the job. It need not be detailed, so shouldn't have much of an impact on performance.

    The sun's position doesn't move in real life based on your altitude - it's how far you can see the ground that changes. So getting some ground out there is what's key.
     
  23. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Thank you. I actually tried that with a cylinder, but I haven't yet figured out how to color it to the color of the horizon. I experimented with using GetSunOrMoonColor(). Here's with a specular shader and something like GetSunOrMoonColor() *Color(0.8, 0.8, 0.8):

     
  24. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It's probably best to use fog for this purpose; with a sufficiently low fog density in your render settings, you should be able to get SilverLining to match your fog color at the horizon if the option for fogging the sky is enabled.

    If you run into any trouble, see my conversation with "HiredK" on the previous page of this thread.
     
  25. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    The problem with fog is that RenderSettings fog completely obscures the sun (and stars etc). With low enough density to see the sun, it doesn't blend at all. With enough density to blend, it covers the sun. (Also the colors are way off the actual horizon colors.) I've read the HiredK conversation carefully (and used with the code) but I don't think I'm missing anything. His screenshot didn't show the sun. These are all using the code you gave him, and also applying that same color to the horizon mesh:

    No fog: (colors much better this way)


    Fog density 0.0005: (great blend but no sun)


    Fog density 0.00005 (less blending, still no sun):


    Fog density 0.000005: (doesn't blend)
     
  26. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Since the horizon color isn't uniform without a constant fog color, I think fog's the only way to go. But, we should be able to get your sun to punch through it.

    One way would be to bring the sun closer to the camera, so it's not affected by fog as much as the sky is. See the sunDistance member in the SilverLiningSky.cs script.

    You could also just disable fog entirely on the sun. Look at around line 293 of SilverLiningSky.cs, and you'll see where we swap out two versions of the sun's shader depending on whether fog is on or not. To always disable fog, you could replace

    ren.material.shader = doFog ? starFogShader : starNoFogShader;

    with

    ren.material.shader = starNoFogShader;

    Hope this helps.
     
  27. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    I really appreciate the great support. I disabled the fog entirely on the sun, moon, and stars, and also unchecked "Apply Fog To Clouds". It's looking good! I'll tweak it more but the essentials are working:



     
  28. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    That's more like it! Glad you got the effect you wanted.
     
  29. Cobalt2102

    Cobalt2102

    Joined:
    Feb 21, 2014
    Posts:
    5
    Hi all,

    it's a dumb demo question so please, forgive the noob...

    I would like to know if is it possible to modify dynamically from inside a C# script the values that usually I input manually on the inspector during my first tests.

    For example, could I change hour time from let's say 23 to 12 suddenly inside the same scene, after entering in a trigger?
    Tried all day long without success and various code problems, so I'm forced to ask here.

    Any link, or information provided in order to solve this kind of issue, even through PM, will be very very appreciated.

    Thanks in advance to all for your attention.
     
  30. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Basically you need to get the SilverLining object from your scene, like this:

    SilverLining silverLining = (SilverLining)(GameObject.FindObjectOfType(typeof(SilverLining)));

    Then, you can set individual options on it from your script:

    silverLining.hour = 12;

    For example.
     
  31. Cobalt2102

    Cobalt2102

    Joined:
    Feb 21, 2014
    Posts:
    5
    Thank you for your support, I appreciate it very much.

    Suddenly changes of variable "silverLining.hour" in the same scene was done before trying to get SL object exactly like you mentioned, and I had during the debug confirmations that it returns correctly all modified values as expected.

    So everything was ok theoretically but - unfortunately - the whole scene isn't affected by changes.
    I'm sure that something is wrong with the code, and I can't really figure it out what "gimmick" I'm missing in order to changes take effect.
     
    Last edited: Feb 21, 2014
  32. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    @Cobalt, after the value is modified, click on the the "SilverLiningPrefab/_SilverLiningSky" in the Hierarchy, and under "Silver Lining (Script)" see whether the value for Hour is what you expect. And try setting it manually there (and see if the scene changes).
     
    Last edited: Feb 21, 2014
  33. Cobalt2102

    Cobalt2102

    Joined:
    Feb 21, 2014
    Posts:
    5
    Earth thanks for your reply.

    Nope, this is exactly my issue: even with the same code previously posted by Sundog if I check the variable with a simple Debug.Log it is correct, but the value that shows up in the _SilverLiningSky "hour" field of the Inspector isn't affected in any way, remaining the same.

    To change the sky I must insert the value manually, and clearly it works, but what I'm wondering if it's possible to update the _SilverLiningSky hour field/value without accessing it manually.
     
    Last edited: Feb 21, 2014
  34. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Perhaps you have more than one SilverLining object in your scene, and your script is modifying the wrong one? What you're trying to do really should work. In our web demo, there's a UI for changing the time of day that uses this same technique.

    If you can reproduce what you're seeing using a simple script on a clean project with SilverLining imported into it, feel free to post that script here or send it to us at support@sundog-soft.com and maybe we can spot something.
     
  35. Cobalt2102

    Cobalt2102

    Joined:
    Feb 21, 2014
    Posts:
    5
    Thanks again folks, and my excuses for this silly question. I've done a simple project again from scratch, starting an empty scene.
    Here's newbie code, pardon indentation: notes inside comment at the start.

    http://pastebin.com/ZtEz140U
     
  36. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Last night I thought I had the same problem, but assumed I was crazy, because it made no sense and I couldn't tell what resolved it. And I can't reproduce the problem. Maybe try restarting Unity or re-attaching the SL component or entire prefab or something. I was doing something like this:
    Code (csharp):
    1.  
    2. SilverLining sl = GameObject.Find ("/SilverLiningPrefab/_SilverLiningSky").GetComponent<SilverLining>();
    3. Debug.Log(sl.hour);// Outputs 1 from preset
    4. sl.hour = 11;
    5. Debug.Log(sl.hour);// Outputs 11
    6.  
    And the value would not change in the inspector (or world). Maybe some race condition? This probably isn't helpful, I know.

    Here's the code from version control that wasn't working:
    Code (csharp):
    1.  
    2. SilverLining sl = GameObject.Find ("/SilverLiningPrefab/_SilverLiningSky").GetComponent<SilverLining>();
    3. sl.year = 2014;
    4. sl.month = months;
    5. sl.day = days;
    6. sl.hour = hours;
    7. sl.minutes = minutes;
    8. sl.seconds = seconds;
    9.  
    Here's the (C#) code that works now:
    Code (csharp):
    1.  
    2. SilverLining sl = GameObject.Find ("/SilverLiningPrefab/_SilverLiningSky").GetComponent<SilverLining>();
    3. sl.month = months;
    4. sl.day = days;
    5. sl.minutes = minutes;
    6. sl.seconds = seconds;
    7. sl.hour = hours;
    8. sl.year = 2014;
    9. sl.continuousTimeAdvance = true; // I made time not advance until here trying to fix it, but this isn't what fixed it.
    10.  
    As you can see, essentially no difference, and I can't reproduce it anymore with the old code. Whatever fiddling I did got it working though:

     
  37. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I think what might be happening here is that your viewpoint might start off inside the collider, and the collision event is getting handled before Unity sets up the SilverLining object internally somehow for the first time. Kind of a race condition I suppose.

    I got it working by just being more insistent with Unity on setting the correct value. Instead of setting the SilverLining object's hour property as soon as the collision gets processed, store off the new value you want and apply it in the Update() method. The following seems to work well for me:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Sphere : MonoBehaviour {
    5.  
    6.         int myHour = 12;
    7.  
    8.         void OnTriggerEnter(Collider other) {            
    9.                 myHour = 24;    
    10.         }
    11.  
    12.         // Use this for initialization
    13.         void Start () { }
    14.        
    15.         // Update is called once per frame
    16.         void Update () {
    17.             SilverLining silverLining = (SilverLining)(GameObject.FindObjectOfType(typeof( SilverLining)));
    18.             silverLining.hour = myHour;
    19.             print (myHour);
    20.     }
    21. }
    22.  
    Of course it's possible something even stranger is going on such as EarthLaunch reported. I will say that I've gone back to using Unity 4.2 here, since Unity 4.3 introduced some bugs on MacOS that make it unusable for developing our Triton ocean plugin. I've heard of other general weirdness in 4.3 from others, and it's possible this falls into that category.
     
  38. Cobalt2102

    Cobalt2102

    Joined:
    Feb 21, 2014
    Posts:
    5
    Hi,

    after full reinstall of Unity 4.3 I must confirm that every snip of code pasted above is now working flawlessy.

    Many thanks again for the help provided.
     
    Last edited: Feb 22, 2014
  39. WayneS56

    WayneS56

    Joined:
    Feb 9, 2014
    Posts:
    19
    Hi everyone - I'm considering purchasing SilverLining but am curious about a few things. I've looked at the demo, been reading this thread, looked at the SunDog site, etc.

    1. I had been using Nuaj but the methodology it uses via ZBuffer raycasting for cloud generation is causing too many problems with particles and some shader effects when shown against the sky. I assume SilverLining doesn't work the same way and won't cause problems with transparent objects, particles, and some shader effects when cast against the sky.

    2. It doesn't appear the SilverLining includes any weather features, ie, storms, snow, etc. The SunDog site lists weather features but I assume those are only for the more expensive C++ version. Assuming no weather in SilverLining, what weather - rain, mists, fogs, snow effects would you reccommend as compatable.

    3. How could i mod SilverLining to simulate a severe rain storm with the dark swirling clouds? Is this just a matter of adjusting the inspector-editable params or do I need to edit the source code?

    Thanks - Wayne
     
  40. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thank you for looking at SilverLining!

    SilverLining's cumulus clouds are created using Unity's built in particle systems, and so they should "play nice" with other Unity effects as much as any particle system would.

    You are correct that storms and precipitation are only in our C++ product at this time. Any particle-based rain or snow asset should work fine with SilverLining; there are several to choose from in the asset store and most are quite inexpensive. I don't have experience with any of them myself, but perhaps the community here can recommend ones they like.

    Although SilverLining for Unity doesn't have "official" storm support, some small modifications of the source can produce a reasonable representation of one. Specifically, decreasing the setting of the "ambientBoost" variable in SilverLiningCumulusCloudLayer will make the clouds darker, and adding "targetN *= 2;" after line 245 of the same file will double the amount of clouds generated. That produces clouds like this:

    $UnityStormClouds.jpg

    Of course it would look better with grey fog in the scene instead of the happy blue sky I've got in there now. As with all SilverLining clouds, you can also have them move with the wind. The "swirling" effect would not be easily accomplished however; the legacy particle systems we use seem to be subject to a bug in Unity where particle rotation doesn't work properly. I don't know if they have since fixed that or not.
     
  41. WayneS56

    WayneS56

    Joined:
    Feb 9, 2014
    Posts:
    19
    I purchased SilverLining and have been very pleased with its versatility and ease of use. I'm writing a weather package that will create basically everything from clear skies to massive rain and snow storms. Are there any tips you can give me in this process? For example:

    1. When I want to lower the altitude of the clouds as in a strong rain or snow storm, should I gradually lower them or do it all in one command? Looking at the code, it looks like clouds get regenerated in certain conditions. I wouldn't wanna go thru many regeneration stages to get from one type of weather to another.

    2. The advice you gave me earlier regarding the color and thickness of cumulus clouds was great. Any other variables / changes to the code I could do to give variations in weather?

    Thanks
    Wayne
     
  42. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Wayne,

    If you're developing a package for the asset store, I'm looking for something like that to integrate with SL. Let me know if I can help or test it. My game is in my signature.
     
  43. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Good question - if you change the altitude of a cloud layer by changing its position under the _SilverLiningSky properties, it will result in the cloud layer being re-created. That's probably more work than you're willing to do every frame, and so if you're going that route you're probably best off changing the altitude all at once in one command.

    However - you could also modify the Y component of the transform of the CumulusClouds object under the SilverLiningPrefab. You can use that to move the altitude of the clouds up or down without impacting framerates, allowing you to slowly change the altitude over time.

    That's an open ended question! It's code, so anything is possible. Probably best to ask about specific effects you're looking to achieve, that you suspect may not be too hard to do.

    One thing I will direct your attention to is the following line in SilverLiningSky.cs:

    Code (csharp):
    1. public double T = 2.2;
    This defines the "atmospheric turbidity", which is really a measure of haze / air pollution. Increasing this value will produce more polluted skies, which can be a useful effect for creating more dramatic sunsets for example. This will have even more of an effect if you force SilverLining to use the "Preetham" sky color model instead of the "Hosek-Wilkie" sky model by adding this line at line 960 of SilverLiningSky.cs:

    Code (csharp):
    1. perezBlend = 1.0f;
    There's a side by side comparison of the two models here: http://sundog-soft.com/sds/2013/05/new-hosek-wilkie-sky-model-in-silverlining-2-8/ If you're after realism, Hosek-Wilkie is best. But, Preetham can result in more dramatic colors that although may be unrealistic, may be more interesting artistically.
     
  44. WayneS56

    WayneS56

    Joined:
    Feb 9, 2014
    Posts:
    19
    Thanks for the great suggestions! Both sky models look great. Another cool option for the weather system I'm doing. I'm sure I'll have more questions as I add more into it.

    @EarthLaunch - awesome signature. I'll add a screenshot taken during a SilverLining storm I tossed together. The clouds are low and dark and I added a tornado effect as well. Just wrote a 3d lightning system that you can setup to do unlimited variations of lightning generated from a point or random circular radius in the sky and will strike a point or any circular area around a point on the ground. Getting the lighting of the lightning strike to appear accurate has been a challenge but it's coming along. I'll include a screenshot of that too.

    Here's SilverLining evening sky with a storm and tornado:
    $Ninja Adonis - Tornado Dusk 2.jpg


    Here's an example of the lightning I'm working on. It's also raining so you see it lighting the building and rain:
    $Ninja Adonis Storm Lightning 4.jpg
     
  45. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
  46. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Nice! Those look good. And actually the shadowed figure makes them quite dramatic.
     
  47. WayneS56

    WayneS56

    Joined:
    Feb 9, 2014
    Posts:
    19
    Hey thanks for the nice compliments guys ;)

    @sundog - You mentioned your lightning model and I quickly had to look at SilverLining to see if you had lightning in there. I was gonna feel really dumb if I spent time writing lightning and you already had it in there! doh!! I guess it's in your C++ SDK? I'm working on several game projects right now. One is in C++ You've peaked my curiosity with the quality of SilverLining. I'll look at your website and see if you have any demo / trial stuff on the SDK. (I've made arcade, computer, and console games for about 25 years now. Published 25+ titles, some AAA. My older games include the original PC Duke Nukem and Rise of the Triad. More recently Afro Samauri and Splatterhouse for the 360 and PS3. I'm always on the look out for great plugins and SDK's...) Thanks for the ref to those articles. I've not read them - thank you for passing them along.

    @EarthLaunch - I really like that one shot showing a game character in the shadow looking at a tornado and the firey red dusk glow off the low SilverLining clouds. Very dramatic effect. Making the clouds stormy dark via sundog's above comments really adds to a great storm effect.
     
  48. WayneS56

    WayneS56

    Joined:
    Feb 9, 2014
    Posts:
    19
    I'll definitely add another 'doh!' to today's forum post. Sundog - I didn't realize you had all those products (after viewing your site). I'm guessing you originally wrote your clouds, water, and weather in C++ and now have full SDK's, and then later cropped down the sky / cloud portion for the Unity C# version... You'd mentioned a storm version in a previous post now that I'm thinking about it. Oh, and congrats on all the company awards! I did a couple serious games for the Army awhile back. One was a future combat system tank sim and the other a patriot missile training sim. Lotta fun but a HASTLE dealing with the military sometimes...;)
     
  49. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks Wayne! You're exactly right, we ported parts of our C++ SDK products to Unity / C#. Serious games / simulation training are an important part of our business, and we're actually seeing more and more of that world move to Unity and other game engines. Usually it's our customers that are dealing with the actual government contracts, which is nice for us :)
     
  50. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    I was introduced to Unity while working at a military training simulation company a few years ago. Funny that we're all here working with SilverLining.

    Looking forward to more SDK features being ported over, hopefully :)