Search Unity

[RELEASE] Nuaj', the 3D clouds simulator

Discussion in 'Assets and Asset Store' started by Patapom, Dec 16, 2011.

  1. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    :D No need for that, I just want him to return to this thread soon and have time to fix a few issues, since most of the real clever stuff is completely beyond my capabilities to improve upon at this point.
     
  2. pthimon

    pthimon

    Joined:
    Feb 6, 2012
    Posts:
    6
    Just in case anyone else cares that the sun is in the correct position, there was another sign that needed flipping in addition to my other fixes. I've included the whole corrected function below.

    Code (csharp):
    1.  
    2. public static Vector3   ComputeSunPosition( float _Longitude, float _Latitude, int _JulianDay, float _TimeOfDay )
    3.             {
    4.                 // Compute solar time
    5.                 float   fSolarTime = _TimeOfDay + 0.17f * Mathf.Sin( 4.0f * Mathf.PI * (_JulianDay - 80) / 373 ) - 0.129f * Mathf.Sin( 2.0f * Mathf.PI * (_JulianDay - 8) / 355 ) + 12.0f * _Longitude / Mathf.PI;
    6.  
    7.                 // Compute solar declination
    8.                 float   fSolarDeclination = 0.4093f * Mathf.Sin( 2.0f * Mathf.PI * (_JulianDay - 81) / 368 );
    9.  
    10.                 // Compute solar angles
    11.                 Vector2 PhiTheta = new Vector2( -Mathf.Atan2( -Mathf.Cos( fSolarDeclination ) * Mathf.Sin( Mathf.PI * fSolarTime / 12 ), Mathf.Cos( _Latitude ) * Mathf.Sin( fSolarDeclination ) + Mathf.Sin( _Latitude ) * Mathf.Cos( fSolarDeclination ) * Mathf.Cos( Mathf.PI * fSolarTime / 12.0f ) ),
    12.                                                 Mathf.Acos( Mathf.Sin( _Latitude ) * Mathf.Sin( fSolarDeclination ) - Mathf.Cos( _Latitude ) * Mathf.Cos( fSolarDeclination ) * Mathf.Cos( Mathf.PI * fSolarTime / 12 ) ) );
    13.  
    14.                 // Transform into a WORLD direction
    15.                 float   CosPhi = Mathf.Cos( PhiTheta.x );
    16.                 float   SinPhi = Mathf.Sin( PhiTheta.x );
    17.                 float   CosTheta = Mathf.Cos( PhiTheta.y );
    18.                 float   SinTheta = Mathf.Sin( PhiTheta.y );
    19.                 return new Vector3( SinPhi * SinTheta, CosTheta, CosPhi * SinTheta );
    20.             }
    21.  
    @elbows, I agree, it is no doubt the most realistic cloud / atmosphere simulation out there for unity - even rivalling cryengine for visual quality. However, it is let down by the bugs. It isn't hard to notice that the sun should rise in the east...! Or that without a stellar background the HDR goes a bit crazy due to bright pixels of noise appearing. Or that a white line appears across the sun where it meets the terrain.

    I would like for the author to also come up with a solution for displaying particles and other semi-transparent objects over the sky. The workaround of rendering the sky behind everything or rendering the particles in front of everything doesn't work for my application.

    Also, a method similar to ComputeSunPosition but for the moon would also be nice. Plus clarification on the best way to get things like lens flare and shadows working.
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks for the full sun fix. To be honest when I first noticed that the sun was rising and setting the wrong way round, I did wonder whether it was actually a fault or whether it was more a case of north and south being the opposite way round than we had expected, perhaps so that people trying the system wouldn't need to rotate the camera 180 to se the sun in the sky.

    Any chance of posting screenshots of the sun white line and HDR bright pixels issue? Im not sure all of these bugs show up visually in every scenario, which would probably explain why some of them were missed and different people are complaining about different things. I may have seen the pixel issue but Im not sure.
     
  4. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    pthimon you mentioned issues with displaying particles and semi-transparent objects over the sky. Can you elaborate?
     
  5. pthimon

    pthimon

    Joined:
    Feb 6, 2012
    Posts:
    6
    Here's a screenshot of some of the issues. Notice:
    • the white line where the sun meets the terrain
    • the pixel of pink near the top left of the flame and pixel of green above the sun (the jpg compression has changed these slightly, but they are there). These randomly appear across the sky, I've noticed mostly pink or green pixels, but they only last for a frame at a time so its hard to say! Adding in a stellar background solves this.
    • the particle effects being rendered behind the sky (and I guess the sky itself must be semi-transparent - particles which are pure black don't show at all, pure white show up normally) as mentioned earlier in the thread. The workaround of rendering the sky into a separate camera behind everything doesn't work in my application as I sometimes need to look down on the terrain from in or above the clouds.

    $sunwithlineandnoiseandparticles.jpg

    I have found that to get lens flare to work you need a new camera as a child of your main camera similar to how elbows suggested, but with the main camera set to normal and the second camera with its culling mask set to nothing so only the flare is rendered in that camera.

    To get shadows to work you need to set your sun to have shadows before assigning it to the Nuaj script (I tried to do it afterwards and it had no effect) and set the camera to use the deferred lighting rendering path.
     
  6. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks for the screenshot. I haven't seen that white line problem with the sun before, I'll see if I can make it happen for me. I may have seen the pixels you refer to, not really sure, as I usually have a lot of 3D clouds going on where sometimes I've seen glitches that look far worse than that, a terrible long line of pixels in the sky that looks like a bad seam between two textures.

    Regarding all the issues that can arise from the way the sky is composited together with other aspects of the scene, if the nightmare worst-case scenario happens and the developer of this system does not reappear, Im strongly considering either trying to learn the Unity rendering etc pipeline well enough to come up with new methods to do this stuff with Nuaj, or else pay someone else to take a look and see what can be done.
     
  7. pthimon

    pthimon

    Joined:
    Feb 6, 2012
    Posts:
    6
    The white line can be duplicated by simply dropping in and linking up the Nuaj prefab to a light and camera, making a massive plane 10000x10000, setting the time of day so that the sun is at the horizon using the orchestrator, then setting rayleigh to 10 and mie to 20 so you can actually see the sun (and/or set the night factor to 1 in the orchestrator).

    For me the pixels thing happens with the default Nuaj scene. You can't really miss them when its running as its crazy flickery.

    I also have big problems with the god rays making horrible black lines across the sky, however this is only noticeable when the 3d cloud layer is quite thin.
     
  8. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Ah yes, I can recreate the white line. Hadn't seen it before myself as Im not using a plane that large. If I did want to use such a plane I think Id try to live with offsetting it a bit on the y axis, since the while line seems to vanish if I move the plane to sit at various points above or below y = 0.
     
  9. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    I hope your work is coming good Patapom... Hopefully once your done you can help us with a fix for the particle issue! This plugin is amazing and I would gladly pay again for some fixes and updates. :|)
     
  10. einfopedia

    einfopedia

    Joined:
    Apr 4, 2012
    Posts:
    28
    when i run it then i am not listening a sound can anyone help me.anyhow it looks very nice and i have purchased it.
     
  11. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    I am looking at purchasing a dynamic sky package and really like the look of this.... but... have a couple of concerns...

    1. Is it working correctly with the latest Unity Build?
    2. Does anyone actually know if it is still being developed/supported?
    3. Any major issues i should know about before reaching for the credit card lol?

    Best Regards,
    - Matt.
     
  12. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    Nothing from the developer, or anyone else, for using this with 3.5. It's a shame, it looks like just what i need but i can't commit client funds to something that seems to have, well, died?!

    - Matt.
     
  13. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    I am using it with 3.5. Seems to work the same as with 3.4. However, I am too hoping the developer says something about it's future.
     
  14. Hotsun

    Hotsun

    Joined:
    Aug 11, 2010
    Posts:
    122
    This is crashing a lot,
    My system spec is:
    CPU:I7 2600K
    VGA:GTX 580
    Ram:16GB DDR3 1600
    and it shouldn't be a problem of mine.
     
  15. Zergling103

    Zergling103

    Joined:
    Aug 16, 2011
    Posts:
    392
    I've slimmed down Nuaj to exclude all of its Software HDR and tone mapping code, leaving all that for Unity's HDR to handle. Unity provides many of the same tone mapping techniques in the Standard Assets package - plus there are likely many other such techniques on the asset store.

    The main benefit of doing this is the tone mapping is applied to EVERYTHING in the scene and not just the clouds. It also gives more accurate lighting that is less prone to flickering.
     
  16. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Very interesting ! would you be willing to share the modifications, or email the author to see if he want to work together on this, I'm pretty sure he's too busy to read the forum.
     
  17. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    Hey Patapom, I've sent you a PM about hopefully purchasing a license to use your source code to Nuaj. :)
     
  18. benswinbanks

    benswinbanks

    Joined:
    Apr 22, 2012
    Posts:
    11
    crashing non-stop for me aswell

    Unity Pro 3.5.3f3
    Win 7 x64
    Intel i7 2.4ghz
    Nvidia GeForce TGX 590 3gb
    16gb ram

    is there a solution to this? at the moment the asset is completely unusable :(
     
  19. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Nuaj keeps crashing all the time also on my high-end rig, it is vrey buggy sorry but you have to do many tests before releasing this piece of crap
     
    Last edited: Jul 27, 2012
  20. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I think support for it has pretty much ended.
     
  21. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Well the author of the plugin was last seen on the forum two weeks ago according to the profile stats, this gives me hope there can still be an update on this.
     
  22. imump

    imump

    Joined:
    Jul 3, 2011
    Posts:
    55
    Would'nt even bother with Nuaj (which I have). I've gone for Unistorm, and can say after comparing the two, there is no comparison. The fps improvement going from Nuaj to Unistorm was was an extra 30+ fps. And I have to say, it is obviously quite bloated and intensive for the CPU/GPU.

    Quick suggestion and review of sorts :p
     
  23. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Me too Iam going to UniStorm, Nuaj sucks!
     
  24. sooshicat

    sooshicat

    Joined:
    Aug 4, 2012
    Posts:
    11
    My clouds are terrible quality, when using the example scene and also when setting up my own scene.
    See pic.
    What can I do to make them look more smooth like in your photos?

    See how in the clouds it looks really clipped and low quality... :(
     
  25. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
  26. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Wow Awesome

    good work Patapom

    Norby
     
  27. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Thanks. I know I've not been there for a long time but it's impossible to cumulate a full time job and supporting the plug-in on the side... Hope the users will forgive me. :roll:
     
  28. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    Hi Patapom,

    FXAA and DOF post process shaders do not apply on objects over the horizon. I tried Accurate and Smart upsampling but it doesn't work. Is the 2 camera workaround the only solution?
     
  29. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Hi,

    I don't know about these post-processes but I guess it's rather a problem of priority.
    If Nuaj' runs after these post-processes then it will certainly write over the result (FXAA'ed pixel or blurred pixel). I believe you should arrange for the post-processes to always occur on the final image after Nuaj' has composited with the scene (Nuaj' works with the scene's Z Buffer but doesn't modify it).
     
  30. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    Thanks for the answer, I will try that and report back.
     
  31. Airborn-Studios

    Airborn-Studios

    Joined:
    Oct 31, 2012
    Posts:
    30
    Hey Patapom,

    i'm currently evaluating your cloudsystem and the first look is pretty cool. Though there are a few issues i can't get rid of.

    First of all the sky is overcasting a hell lot around the sun, is it possible to control this better somehow? if i turn down the sun, the clouds are of course also much, much darker - so could this be treated individually?

    Also i'm having a black horizon from time to time (not at every altitude) which is really ugly, i tried using skydomes in the background but the problem still remains.

    And another thing is a pretty ugly "seam" right in the center line of the scren, i guess its where the noise ends and the texture thats beeing generated is not tileable, but tiles over the surface, its a huge vertical line going through all layers of your clouds.

    Is there a way to make the shape of the clouds sharper? right now they are really really blurry, which looks nice on your small screens, but not when flying through with a plane.



    @jesta: changing the render order definitely works, just tweak the FXAA shader to be overlay or higher.
     
  32. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    Thanks, the post-effect ordering trick works like a charm.

    However, I have more problems:
    - The directional light is not casting any shadows even though I enabled them.
    - Tonemapping is a huge pain. I just want to use Unity's tonemapping, so how can I get rid of it completely in Nuaj?
    - Same issue as Airborn-Studios with the big vertical strip.
     
  33. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Hi!

    What do you mean "overcasting a lot"? You mean it's very bright around the Sun?
    In general it's not a good idea to change the Sun's intensity as it impacts everything!
    The best way is yet to either increase the Density parameter of the clouds or to decrease the various weights of direct lighting you can find in the advanced lighting options.

    Someone told me that already, I'm quite worried. Do you have any snapshot to show what you mean?

    Hmmm actually the noise should be tileable but this is due to my hack to be able to use 3D textures in Unity (those are normally not supported). I had to use slices in a 2D textures and these tile very badly, this is especially visible when all the noise octaves are aligned so I would advise to use frequency factors that are not obviously correlated (e.g. avoid 2, 3 or even 1.5 and prefer 2.65489431 or anything)

    Well no... The only way is to increase the resolution of the screen for the computation but then you can say goodbye to proper FPS! (Nuaj' is already not the fastest simulation in the world so...)
     
  34. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    You should check your cookie size on both your light and in Nuaj': they must match and be quite large to cover large areas. A typical value is 4000 for example.

    A huge pain? What do you mean? I prefer my tone mapping to Unity' which I think doesn't work at all... :D
    Anyway if you really don't like it :( then what about disabling it? If you disable it, enable HDR on your camera and apply the Unity tone mapping afterward, it should behave properly.

    Well, same answer. :p
     
    Last edited: Nov 1, 2012
  35. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    1. Cloud shadows are working, I'm talking about the normal directional light shadows on objects. My light cookie sizes match.

    2. Sorry, I didn't mean to be rude. What I mean is that there is a lot of flickering in the scene when moving the camera. I enabled the "scene in hdr" option but it seems luminance adaptation is always enabled. Don't get me wrong, I also prefer your tonemapping technique, but the flickering is a dealbreaker unfortunately. I'll investigate further.

    3. Thanks.

    Also, do you plan to make Nuaj Unity 4 compatible when it releases? 3D texture support and 32 bit float textures should REALLY help out with visual quality.

    Thanks for the great tool and great support. Also, I must say this is the most organized and well-commented code I ever saw. By far.
     
    Last edited: Nov 1, 2012
  36. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Oh that's strange, I tried Nuaj' in the Bootcamp demo and shadows were working fine as far as I know.

    No not at all, I was joking (I usually never take anything seriously), I totally understand the need to disable some features and parts of the pipeline.
    I never quite noticed the flickering you're describing. Isn't it solved by increasing the adaptation time in the luminance adaptation section ?
    Anyway, the complete tone mapping pipeline is 2 parts: luminance adaptation and tone mapping. Luminance adaptation should also be disabled (set to ONE). This should normally output the value unmodified... But I suppose you tried that already and it's still not working?

    Float render textures are already available in Unity 3.5 but sure, having 3D textures would be really nice! We could at last have mip-mapping!
    Anyway, what worries me the most is that Unity tends to become a bit unstable with new versions coming up. For example, Nuaj' made Unity 3.5 crash because it's using a lot of global material variables and for some reason, when you use too many of them, the engine simply crashes without warning.
    I sincerely hope version 4 is more stable and bugs have been fixed, rather than adding new features.

    Well thanks. *blush*
     
  37. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    The light shadow casting problem only happens in forward rendering mode. However, when deferred lighting is enabled, there are lots of artifacts. What is the best rendering path to use with Nuaj?
     
  38. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Well since Nuaj' is mainly using the ZBuffer, I would advise to go for deferred rendering otherwise it will trigger a depth-pass that is not necessary in forward rendering. On the other hand, if you don't use many lights like it's often the case for outdoor scene, it's better to use forward rendering and add the cost of a single depth path rather than having a GBuffer allocated for only the Sun light...

    I'm curious about the artifacts you're talking about, do you have any snapshot ?
     
  39. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Nuaj' and Unistorm are totally different products! They are not even comparable... :eek:
    Of course Unistorm is faster: it's only rendering some sort of scrolling 2D plane for the clouds and a bunch of particles.

    The framerate you get with Nuaj' is obviously slower since I'm performing a fully volumetric rendering: don't forget I'm rendering the entire atmosphere here! :p
     
  40. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    I'agree with this assessment about Nuaj being a superior package in regard to rendering, Nuaj if anything would be compared with "SilverLining" package and not UniStorm. And Nuaj has quality setting's to reduce the over-draw load.

    Thanks for updating the version with fix's :)
     
  41. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Sorry it couldn't happen any sooner but I'm a single developer and what I earn by selling Nuaj' doesn't cover much of my monthly expenses... :D
     
  42. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    Er guess it has problems *update* Nuaj version 1.10

    Unity 3.5.5f3

    $nuaj-update.jpg
     
    Last edited: Nov 5, 2012
  43. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    Is it possible to light the scene at night? Night is incredibly dark and I only found a way to brighten the sky and not my terrain. Should I add another directional light at night time?
     
    Last edited: Nov 5, 2012
  44. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Runner, this is not Nuaj 1.1 you are using but Nuaj 1.0... This has been fixed.
     
  45. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Well you can increase the ambient luminance when you create a star background cubemap satellite. This is responsible for the ambient light at night.
    You can also check the "Use Moon as Light" option on your moon satellite and pump up its luminance. This is responsible for the directional light at night.
     
  46. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865

    Could have been clearer,

    Nuaj 1.10 Oct 27 2012 is what gave me this error.
     
    Last edited: Nov 7, 2012
  47. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    Sorry but it doesn't work. The sky lightens up, but the terrain and other objects are still pitch black. Here is a Day/Night comparison:




    I enabled "Use moon as light" and put all luminance to maximum values.
     
  48. Patapom

    Patapom

    Joined:
    Aug 19, 2009
    Posts:
    155
    Sorry to hear that... The problem with HDR lighting is also that perhaps there IS an ambient light at night but the camera's sensitivity is too low to see it.
    I don't know if you're still using my tone mapping or if you replaced it by Unity's but in my version, there are 2 settings : one for daylight and one for night time.

    The luminance tolerance at night is about 1/5th the luminance tolerance during the day, this is what lets the stars and moon appear at night but you can't see them during the day because the overall luminance dwarves their luminances.
    For example, the default luminance of the star background satellite is 0.02, remember that the luminance of the Sun is 10 by default, this means the stars background is 500 times less luminous than the Sun.
    The average luminance during the day is about 3 so the luminance adaptation of the tone mapper is set to accomodate those values.
    The average luminance during the night is about 0.1 and if you use Unity's tone mapper, perhaps it doesn't show such tiny values and your scene looks dark. Or perhaps you set the Moon's luminance too high and the tone mapper dwaves the luminance of the terrain and stars ?

    It's really a matter of relative luminance of the various satellites/ambient light, and the sensitivity of your tone mapper. And believe me, that's something very hard to get right! :D
     
  49. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    294
    I'm using your tonemapper, but with a 2-cameras setup. One that renders Nuaj, and one for the scene. I'll try playing with the luminance settings.
     
  50. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    unity 3.5.5f3

    imported asset manual install l Nuaj v11.unitypackage

    unable to update unity at this time too 3.5.7 (project development dependency .dll's)

    $nuaj-v11.jpg