Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

[RELEASED] Enviro - Sky and Weather (Dynamic Sky and Weather System)

Discussion in 'Assets and Asset Store' started by Vondox, Apr 11, 2015.

  1. PussSallivan

    PussSallivan

    Joined:
    Apr 28, 2020
    Posts:
    2
    Hi! I am loving this asset!
    I have been trying to use Enviro3's fog with Crest Ocean, but the guide you made for Enviro2 doesnt seem to work anymore: https://forum.unity.com/attachments/enviro_crestocean_urp-pdf.596221/
    The path and file "Assets/Enviro - Sky and Weather/Core/Resources/Shaders/Core/EnviroFogCore.hlsl" no longer exists for Enviro3.
    Is it placed anywhere else? or perhaps is there any other way we can apply Enviro3's fog to the ocean.
    Thank you!!
     
  2. joz_nascimento

    joz_nascimento

    Joined:
    Oct 24, 2017
    Posts:
    29
    Hi,
    Using EnviroLite, afert switch platform to Android, I am getting the error:
    "Graphics.CopyTexture can only copy between same texture format groups (d3d11 base formats: src=26 dst=9)"
    This error doesn't make the program stop, but I get it continuously while the program is running,

    Unity 2020.3.32f1
    EnviroLite 2.4.2
    envirolite_error.jpg
     
  3. gomurae

    gomurae

    Joined:
    Jan 9, 2016
    Posts:
    4
    I am using "enviro sky" in Unity 2019 and I get this error message, please tell me how to solve it.
    "Maximum number (256) of shader global keywords exceeded, keyword ENVIRO_SINGLEPASSINSTANCED will be ignored. You will have to delete some shaders or make them use less keywords."
     

    Attached Files:

  4. yonson_chappers

    yonson_chappers

    Joined:
    Feb 6, 2017
    Posts:
    34
    Hello I had a question about rendering 'on top' of fog. I have some AR 3d models that I wish to always be able to see (i.e. they are not obscured by fog) but I can't create a material or shader to achieve what I want. I've tried various settings is there some sort of UI shader I can use for HDRP/ Lit? THank you!
     
  5. jason0663

    jason0663

    Joined:
    Dec 4, 2020
    Posts:
    41
    Hi, Im using enviro and ambient sounds. Is there a simple way to integrate ambient sounds with enviro day night cycle to trigger sounds at set times such as day and night etc in ambient sounds? Ive seen ambient sounds integrated with day and night cycle that can use the ambient sounds timeline synced with enviro however not sure how to do it. Using unity 2021 universal render pipeline
     
  6. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    330
    Is there a way to fix the render order of Clouds when used with Crest. I am using Eviro 3.

    upload_2023-2-14_12-35-47.png
     
  7. FrostApps

    FrostApps

    Joined:
    Dec 15, 2014
    Posts:
    39

    1 - Graphics.CopyTexture
    Check the reflection settings (Light Probes) that are in the scene.
     
  8. jason0663

    jason0663

    Joined:
    Dec 4, 2020
    Posts:
    41
    Hi, I also have a light switch script for enviro Im trying to use. however its shows an error in console...

    Assets\EnviroDayNightSwitch.cs(27,26): error CS0103: The name 'EnviroSkyMgr' does not exist in the current context

    here is the code

    Code (CSharp):
    1.          using UnityEngine;
    2.          using System.Collections;
    3.            
    4.          public class EnviroDayNightSwitch : MonoBehaviour {
    5.            
    6.          private Light[] lightsArray;
    7.          private ParticleSystem[] PC_Array;
    8.                
    9.            
    10.          void Start () {
    11.            
    12.                      lightsArray = GetComponentsInChildren<Light> ();
    13.        
    14.                      //Adding Particle Arrays as well
    15.                      PC_Array = GetComponentsInChildren<ParticleSystem>();
    16.            
    17.                      EnviroSkyMgr.instance.OnDayTime += () =>
    18.                      {
    19.                          Deactivate () ;
    20.                      };
    21.            
    22.                      EnviroSkyMgr.instance.OnNightTime += () =>
    23.                      {
    24.                          Activate () ;
    25.                      };
    26.            
    27.                      if (EnviroSkyMgr.instance.IsNight())
    28.                          Activate ();
    29.                      else
    30.                          Deactivate ();
    31.                  }
    32.                
    33.            
    34.                  void Activate ()
    35.                  {
    36.                      for (int i = 0; i < lightsArray.Length; i++) {
    37.                          lightsArray [i].enabled = true;
    38.                      }
    39.          ///Gets our new particles for the array like the light above it and turns them on
    40.                      for (int i = 0; i < PC_Array.Length; i++)
    41.                      {
    42.                          PC_Array[i].Play();
    43.                      }
    44.                  }
    45.            
    46.                  void Deactivate ()
    47.                  {
    48.                      for (int i = 0; i < lightsArray.Length; i++) {
    49.                          lightsArray [i].enabled = false;
    50.                      }
    51.        
    52.          ///Gets our new particles for the array like the light above it and turns them off
    53.            
    54.                      for (int i = 0; i < PC_Array.Length; i++)
    55.                      {
    56.                          PC_Array[i].Stop();
    57.                      }
    58.                  }
    59.              }
     
  9. jmedrano-touchto

    jmedrano-touchto

    Joined:
    Feb 2, 2023
    Posts:
    1
    Hi, there seems to be an issue with WeatherParticles when building for WebGL (WebGL 2). Screenshot attached from the sample scene using built-in.

    Screenshot 2023-04-09 at 12.33.23 PM.png

    I'm also seeing this being printed out in the console:

    WARNING: 0:2: 'GL_ARB_shader_storage_buffer_object' : extension is not supported
    WARNING: 0:3: 'GL_ARB_shader_image_load_store' : extension is not supported
    ERROR: 0:15: 'readonly' : Illegal use of reserved word
    Note: Creation of internal variant of shader 'Enviro3/Particles/WeatherParticles' failed.
     
  10. Juneav

    Juneav

    Joined:
    Feb 18, 2017
    Posts:
    28
    Hello there!
    Is there any guide on how to setup (or a demo scene) of how to configure the fly through clouds? Or how to set the additional clouds layer at ground level to simulate mist or volumetric fog? Thanks!
     
  11. UnityGames99

    UnityGames99

    Joined:
    Aug 19, 2019
    Posts:
    19
    Hi, I'm using Enviro lite and just updated the latest version of Unity to LTS 2021.3.23f1 (Android Build) and now I'm getting this error. I'm using sunlight shafts.

    Blit material Enviro/Effects/LightShafts uses dest texture as input, it's an undefined behaviour. Consider using double buffering.
    UnityEngine.Graphics:Blit (UnityEngine.Texture,UnityEngine.RenderTexture,UnityEngine.Material,int)
    EnviroPostProcessing:RenderLightShaft (UnityEngine.RenderTexture,UnityEngine.RenderTexture,UnityEngine.Material,UnityEngine.Material,UnityEngine.Transform,UnityEngine.Color,UnityEngine.Color) (at Assets/Components/Assets/Enviro - Sky and Weather/Core/Scripts/Effects/EnviroPostProcessing.cs:189)
    EnviroPostProcessing:OnRenderImage (UnityEngine.RenderTexture,UnityEngine.RenderTexture) (at Assets/Components/Assets/Enviro - Sky and Weather/Core/Scripts/Effects/EnviroPostProcessing.cs:127)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
     
  12. OddKidToons

    OddKidToons

    Joined:
    Aug 29, 2019
    Posts:
    21
    For some reason the Enviro Sky Rendering script causes all "unlit shaders to be tranparant if the sky is behind them. When its on I can see through my characters. When its off they are solid again. I tried multiple unlit shaders, the default ones that come with unity and 3rd party assets. How do I fix this? Is there a tag or layer issue? upload_2023-4-29_20-57-59.png upload_2023-4-29_20-58-13.png
     
  13. Teolog

    Teolog

    Joined:
    Jun 4, 2014
    Posts:
    4
    Where bug in version 3.05 for Unity 2022.2.17 HDRP
    additional camera render clouds and stars but only black skybox
    This related with EnviroHDRPSkyRenderer.RenderSky function

    Code (CSharp):
    1. skyMat.SetFloat("_EnviroSkyIntensity"
    not called for additional camera so camera sky intensity keeps near 0.8
    this replacement code fixed issue
    Code (CSharp):
    1.  
    2.           float skyintensity = GetSkyIntensity(enviroSky, builtinParams.debugSettings);
    3.             if (!renderForCubemap)
    4.             {
    5.                 Shader.SetGlobalMatrix("_PixelCoordToViewDirWS", builtinParams.pixelCoordToViewDirMatrix);
    6.                 Shader.SetGlobalFloat("_EnviroSkyIntensity", skyintensity);
    7.             }
    8.             skyMat.SetFloat("_EnviroSkyIntensity", skyintensity); //always set intensity to material
    9.  
    Not sure if any additional bugs exist here but this at least fixes second screen sky color ;)
     
  14. Goreduc

    Goreduc

    Joined:
    Jun 26, 2020
    Posts:
    12
    Hello PussSallivan,
    I met the same problem, thanks for your link to the old documentation.
    I adapted the code and it seems to work
    The #include is now :
    #include "Assets/Enviro 3 - Sky and Weather/Resources/Shader/Includes/FogIncludeHLSL.hlsl"
    And instead of "col = TransparentFog( [...]", I put
    col = ApplyFogAndVolumetricLights(col, uvDepth, input.positionWS_fogFactor.xyz, sceneZ);

    Hope it helps !
     
    DreamWayAssets likes this.
  15. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,336
    Hello,

    thanks for the new update! I installed it and now get the following errors, how to fix those?

    Enviro.EnviroManager.instance.Lighting.Settings.globalReflectionsIntensity = 1.5f;

    Severity Code Description Project File Line Suppression State
    Error CS1061 'EnviroLighting' does not contain a definition for 'globalReflectionsIntensity' and no accessible extension method 'globalReflectionsIntensity' accepting a first argument of type 'EnviroLighting' could be found (are you missing a using directive or an assembly reference?)

    Enviro.EnviroManager.instance.Lighting.Settings.globalReflectionCustomRendering = false;
    Enviro.EnviroManager.instance.Lighting.Settings.globalReflectionsUpdateOnGameTime = true;
    Enviro.EnviroManager.instance.Lighting.Settings.globalReflectionsUpdateOnPosition = true;
    Enviro.EnviroManager.instance.Lighting.Settings.globalReflectionResolution = Enviro.EnviroLighting.GlobalReflectionResolution.R512;

    Everything here. I am setting the quality stuff in my own configuration.

    Thanks a lot!
     
  16. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,336
    If anybody interested, it is here now:

    Enviro.EnviroManager.instance.Objects.globalReflectionProbe.enabled = true;
    Enviro.EnviroManager.instance.Reflections.Settings.customRendering = false;
    Enviro.EnviroManager.instance.Reflections.Settings.globalReflectionsUpdateOnGameTime = true;
    Enviro.EnviroManager.instance.Reflections.Settings.globalReflectionsUpdateOnPosition = true;
    Enviro.EnviroManager.instance.Reflections.Settings.globalReflectionResolution = EnviroReflections.GlobalReflectionResolution.R256;
     
  17. ekuNNN

    ekuNNN

    Joined:
    Sep 3, 2013
    Posts:
    22
    Hi, I'm using Envirosky 2.4.2 and it won't let me turn off the twinkling of the stars. Setting star twinkling rate to 0 does not work. Any ideas?
     
  18. FirstPassProductions

    FirstPassProductions

    Joined:
    Nov 3, 2018
    Posts:
    8
    Love the asset!! Purchased a few days ago. I am trying to get weather, time, ect from enviro from another script. i get this error. Maybe you can point me in the right direction! Thank you again!

    Assets\ButterflyAI.cs(4,7): error CS0246: The type or namespace name 'Enviro' could not be found (are you missing a using directive or an assembly reference?)

    LINE 4
    using Enviro.Core;
     
  19. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    377
    Fog Layer 1/2 ? the documentation is just a screenshot of what I can already see.. where is the explanation on how it works? I'm bit a disappointed in enviro 3... as the fog controls are very lacking, height falloff sure, where is distance range fall off? I want fog in the distance but near the camera I want to control it better so it doesn't start until like 500 units away in clear weather.. ie using fog in the distance to hide clipping without making the whole scene look rubbish with faded colors etc.. can't do that, density/height etc are not enough controls for this.. and I really don't want to ditch the whole thing to use a separate package just for fog :(
     
  20. JShuplutonic

    JShuplutonic

    Joined:
    Apr 2, 2020
    Posts:
    2
    So can you use a custom skybox and still have time with day, night and sun moving?
     
  21. k5k5cg

    k5k5cg

    Joined:
    Dec 2, 2019
    Posts:
    4
    Hello, in(unity2021.3,HDRP)
    Opening the Game window and Scene window at the same time, or operating in another windows window, will cause the main light and ambient light to reflect incorrectly.
     
  22. k5k5cg

    k5k5cg

    Joined:
    Dec 2, 2019
    Posts:
    4
    Hello, in(unity2021.3,HDRP)
    Opening the Game window and Scene window at the same time, or operating in another windows window, will cause the main light and ambient light to reflect incorrectly.
     
  23. DragonmoN

    DragonmoN

    Joined:
    Nov 27, 2016
    Posts:
    26
    Hello there, were currently using Enviro 3 in our HDRP based Project and ran into aa issue.
    Mandatory injecting Enviro into the Custom Post Process Orders results in breaking correct Volumetric Fog rendering. Maybe you know a Solution to this.

    It blends the Horizon sightline incorrectly with Volumetrics (Screenshots) and also some Cloudlayers and Objects, if in between Sky and Volumetrics.

    Here some Screenshots with and without Enviro injected.
    Enviro_Day_CPPO_off_.png Enviro_Day_CPPO_on.png
    Enviro_Night_CPPO_on.png Enviro_Night_CPPO_off.png
     
    Last edited: Aug 16, 2023
  24. TigrikGaming

    TigrikGaming

    Joined:
    Oct 2, 2019
    Posts:
    1
    Was wondering if anyone has seen this error or if it's just me and any ideas on how to fix it? This started after I updated and installed to the latest version. I can get it to go away by making it ignore this file but I need it for my weather to work obviously.
     

    Attached Files:

  25. xdanic

    xdanic

    Joined:
    Apr 18, 2019
    Posts:
    1
    Is there a way to lerp between two hours? I havent tried calliing the API, since probably that's not the most optimized, so I wonder if there's a way to tell enviro to fastforward, like a timelapse, mean, like from 6:30pm to 21:43pm in like exactly 5 seconds?
     
  26. lsdrambo

    lsdrambo

    Joined:
    Nov 13, 2013
    Posts:
    5
    Hi, trying to build for the Game Core Xbox One platform here using Unity 2022.3.8f1, Builtin rendering pipeline. My game uses "Enviro - Sky and Weather" v2.4.2.

    I get some weird graphical glitches in the game and I noticed it is also present in the Sample_BuiltIn_Standard from the Enviro package.

    This is what I get on the console (in the editor, everything looks fine) EnviroSkyXBox.png
    If a disable the "Use Volume Clouds" check box in the EnviroSky component (under the Feature Controls/Features panel), then the glitches go away (as well as the clouds :D)


    EnviroSkyXBoxNoClouds.png

    I'll try to test all the cloud options available to narrow down the cause of the issue to something more precise than the clouds, but I was wondering if someone has already found a solution for that. Thanks!
     
  27. cficara

    cficara

    Joined:
    Sep 27, 2017
    Posts:
    35
    Hi! Is it possible to have support for River Auto Material? URP 2021.3 version. Water doesn't have fog applied.

    The integration files they have use old paths and the current documentation example is wrong.

    As @Goreduc correctly pointed out:

    The path
    "Assets/Enviro - Sky and Weather/Core/Resources/Shaders/Core/EnviroFogCore.hlsl"

    no longer exists, should be:
    "Assets/Enviro 3 - Sky and Weather/Resources/Shader/Includes/FogIncludeHLSL.hlsl"

    And instead of
    TransparentFog
    , function should be
    ApplyFogAndVolumetricLights
    .

    Tried to edit myself but the shader is a monster file of 30.000 lines. Any help would be appreciated.
     
    Last edited: Sep 26, 2023
  28. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Hello everyone!

    I am really sorry that I wasn't active here in forums lately. But I will again visit forums regulary now. However for everyone who was or is seeking support please either send me a mail (vondox@live.de) or join our discord.​
     
  29. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,336
    upload_2023-9-29_22-49-16.png

    Hi Hendrik and anybody else,

    I am working on two games right now, both use reflection probes and enviro also with it's reflection probe.
    In both games (space shooter and minature car race) if it is not too bright I have a strange "additional square shadow".
    I am not sure if it is a general reflection probe problem or a enviro reflection problem (all cars / space ships have both a reflection probe and that enviro reflection probe with all options checked).

    Any idea how to get rid of the additional shadow box without turning reflections off?

    Thanks a lot! Have a nice weekend...

    PS: The black shadow box dissappears when I turn off the Enviro - Reflection probe. Even if I still have the "normal" reflection probe activated (or not)
     
    Last edited: Sep 30, 2023
  30. wayne951001

    wayne951001

    Joined:
    Oct 10, 2023
    Posts:
    1
    I have a question about why the Enviro Sky Rendering LW can't be added to the main camera
     

    Attached Files:

  31. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Hello, the Enviro Rendering LW component is only used when you also use Enviro Lite instance and not using URP/HDRP.
     
  32. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,336
    Is there no volumetric light in Enviro 3? Or at least in the settings. If so, can I enable it from or like in the older version somehow?
    I have a volume light cone in my game that looked better before I think :D

    Thank you!
     
  33. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Hello, there is! It's under fog settings in your Enviro Manager and weather types. You most likely only need to tweak the settings a bit.
     
    Firlefanz73 likes this.
  34. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,336
  35. denis9994

    denis9994

    Joined:
    Feb 14, 2018
    Posts:
    1
    hi, I bought enviro
    I have imported it into my project and am using support mirror.
    added the mirror player component, as you said on the player prefab
    I also added the mirror integration component, as was said, in third party support

    when I make a game build, with all this, and click on networkmanagerhud "Server Only", and then connect to the server from other clients, then the players have the same weather on the server.

    But if I do everything the same, but build a Dedicated Server, then launch it, and players connect to the server, then everyone has their own weather on the server.
    How to make sure that on a dedicated server build, players connect to it and have the same weather?
     

    Attached Files:

  36. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,336
    Hi Hendrik,

    for my space shooter I want to have one level where the player is "flying high above the clouds". Player in the sky with diamonds :p:D

    Can I somehow spawn/instantiate enviro clouds manually for a certain position and direction?

    Or set the clouds y position to some value below zero just for this level by script?

    With their animations please they really look and animate very beautyful!

    Thanks a lot
    Eric
     
  37. AndreasUnityas

    AndreasUnityas

    Joined:
    Sep 8, 2021
    Posts:
    1
    Good day to all!

    There was a problem during the update, in the build black blinks and freezes when Open XR by default Vive Open XR or Oculus Open XR. Everything is fine in the Unity editor.

    If you make Open XR by default SteamVR, then the problem disappears.

    The cause of blinking, as found out by experimental reflection of clouds. If you turn off the GlobalReflectionCustomRendering checkbox in the Reflections section, then the problem disappears, but the scene does not look so beautiful.

    Is there a way or ideas why this is happening? How to return cloud reflections without lags?

    Using Vive Open XR is the customer's requirement.


    New configuration:

    Enviro 2.4.2

    Unity 2022.3.8

    URP 14.0.8

    Render Mode: Multi – pass

    Open XR – Vive OpenXR


    Old configuration:

    Enviro 2.4.0

    Unity 2021.2.11

    URP 12.1.4

    Render Mode: Single – pass

    Open XR – Vive OpenXR
     
  38. fea777

    fea777

    Joined:
    Jun 29, 2015
    Posts:
    14
    Hello,
    I am trying to fly through the enivro3 clouds.
    But the clouds seem to be very big and distant.
    Is there a way to reduce the cloud size and distance between them?
    Please let me know if this is impossible. T.T I have been trying for days.
    Thank you!!
     
    Last edited: Nov 23, 2023
  39. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Hello, hm you could try to set the clouds to be lower and increase the "Worley Freq" in your "Volumetric Clouds" module -> "Settings Layer 1".
     
  40. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    You might already noticed Enviro 3 - Sky and Weather and Enviro - Sky in Weather is in SALE right now and 50% off!

    Please note that the old Enviro - Sky in Weather asset will be deprecated beginning 2024 and you might want to consider to upgrade to Enviro 3!

    And now will be the best time to do so! I reduced the upgrade price from 20$ to 15$ for the next 5 days:
    "Asset Store Link"

    Also check out the Enviro 3 - Additional Weather Pack for more weather types and effects:
    "Asset Store Link"

     
  41. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    709
    Hello,

    Odd issue, I'll try to describe as best as I can. I am using Enviro 3, URP on Unity 2022.3.13f for VR. When I compile and run the experience the volumetric clouds move with the player's head movement. The Moon and Aurora do not move like this, they are fine.

    Please let me know what info you need, ie: images, video, etc or let me know what dumb@$$ thing I am doing wrong.

    EDIT: Flat Clouds do not have this issue. It MAY be something to do with the reflection.... looking into that now.

    Thanks, and have a great evening
     
    Last edited: Dec 4, 2023
  42. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Hello, do you use multi or single pass rendering? Do you only see the issue in builds? Does it work fine in the editor?
     
    JamesWjRose likes this.
  43. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    709
    THANK YOU!

    I had set it to multi-pass while attempting to work with a different weather system. I reset it back to Single-Pass. (in case anyone else in the future needs to know)

    Thanks again, and for the quick response AND the wonderful asset. You rule
     
    Vondox likes this.
  44. UNCOMMON_Unity

    UNCOMMON_Unity

    Joined:
    Apr 9, 2020
    Posts:
    4
    I REALLY wish Enviro came with a collection of little example and script files. Especially for us non-programmers to mess around with and try to figure out whats going on or to better integrate with the asset.

    I'm sharing this with the community because I really needed it and thought some of you may like it too... it's also helpful for troubleshooting in VR so you can see whats happening.

    This is a script for Unity called EnviroClock...
    It's cool to have time passing in your scene but it looks weird if your environment clocks don't match whats going on or if you want to add a clock to help further emerse the player with the sence of time passing. This script allows you to set up an analog or text output of the clock as it is running in Enviro instead of off of the system clock (unless your enviro asset is using the system clock already - in which case it will still match that anyway).

    This can be as basic as you want. I literally tested it with a cylinder as a clock base and 3 stretched cubes with offset pivots as the hands. Attach this script to a clock (or an empty) in your scene and then in the inspector assign your Hour, Minute and Second Hands to the script and thats basically it. There are options to rotate on X, Y or Z and to use Global or Local Rotation as well as Reverse Direction.

    There are options to add a TextMeshPro object to use for a text output of the time and it includes options to show or hide the Seconds read out and the AM/PM as well as the choice of 12 or 24 Hour Format.

    The script has optimizations to ignore calculation if for instance no hands are assigned and you are just using it for text output and the reverse if no TMP object is assigned. There is also optimizations to skip the seconds calculations if no second hand is assigned or the show seconds bool is FALSE for the TMP option.

    HERE is the Script - Enjoy - it's provided AS IS... :)


    Code (CSharp):
    1. using UnityEngine;
    2. using TMPro;
    3.  
    4. namespace EnviroSamples
    5. {
    6.     public class EnviroClock : MonoBehaviour
    7.     {
    8.         [Header("Clock Hands")]
    9.         public Transform hourHand;
    10.         public Transform minuteHand;
    11.         public Transform secondHand;
    12.  
    13.         [Header("Rotation Settings")]
    14.         public bool rotateOnX = false;
    15.         public bool rotateOnY = true;
    16.         public bool rotateOnZ = false;
    17.  
    18.         [Tooltip("Use Global or Local Rotation Space")]
    19.         public bool useGlobalRotation = false; // Use global coordinates for rotation
    20.  
    21.         public bool reverseRotation = false; // Reverse the direction of rotation
    22.  
    23.         [Header("Time Display Settings")]
    24.         public bool useTMP = true;  // Use TextMeshPro to display time
    25.         public TMP_Text timeText;  // Assign your TMP object here
    26.  
    27.         public bool showSeconds = true;  // Show seconds in TMP text
    28.         [Tooltip("Shows for 12-hour mode only")]
    29.         public bool showAM_PM = true;  // Show AM/PM indicator in TMP text
    30.  
    31.         [Tooltip("Use 24-hour clock format")]
    32.         public bool use24HourFormat = false;  // Use 24-hour clock format
    33.  
    34.         void Update()
    35.         {
    36.             float timeOfDay = EnviroSkyMgr.instance.GetTimeOfDay();
    37.             int hours = Mathf.FloorToInt(timeOfDay);
    38.             int minutes = Mathf.FloorToInt((timeOfDay - hours) * 60f);
    39.             int seconds = Mathf.FloorToInt(((timeOfDay - hours) * 60f - minutes) * 60f);
    40.  
    41.             // Only update clock hands if at least one is assigned
    42.             if (hourHand != null || minuteHand != null || (secondHand != null && showSeconds))
    43.             {
    44.                 UpdateClockHands(hours, minutes, seconds);
    45.             }
    46.  
    47.             // Only update TMP text if TMP is used and text object is assigned
    48.             if (useTMP && timeText != null)
    49.             {
    50.                 UpdateTMPText(hours, minutes, seconds);
    51.             }
    52.         }
    53.  
    54.         void UpdateClockHands(int hours, int minutes, int seconds)
    55.         {
    56.             if (hourHand != null)
    57.             {
    58.                 float hourRotation = 360f * (hours % 12 + minutes / 60f) / 12f;
    59.                 RotateClockHand(hourHand, hourRotation, rotateOnX, rotateOnY, rotateOnZ);
    60.             }
    61.  
    62.             if (minuteHand != null)
    63.             {
    64.                 float minuteRotation = 360f * minutes / 60f;
    65.                 RotateClockHand(minuteHand, minuteRotation, rotateOnX, rotateOnY, rotateOnZ);
    66.             }
    67.  
    68.             if (secondHand != null && showSeconds)
    69.             {
    70.                 float secondRotation = 360f * seconds / 60f;
    71.                 RotateClockHand(secondHand, secondRotation, rotateOnX, rotateOnY, rotateOnZ);
    72.             }
    73.         }
    74.  
    75.         void RotateClockHand(Transform hand, float rotation, bool rotateX, bool rotateY, bool rotateZ)
    76.         {
    77.             if (reverseRotation)
    78.             {
    79.                 rotation = -rotation;
    80.             }
    81.  
    82.             Vector3 eulerRotation = new Vector3(
    83.                 rotateX ? rotation : 0f,
    84.                 rotateY ? rotation : 0f,
    85.                 rotateZ ? rotation : 0f
    86.             );
    87.  
    88.             Quaternion targetRotation = useGlobalRotation ? Quaternion.Euler(eulerRotation) : hand.rotation * Quaternion.Euler(eulerRotation);
    89.  
    90.             hand.rotation = targetRotation;
    91.         }
    92.  
    93.         void UpdateTMPText(int hours, int minutes, int seconds)
    94.         {
    95.             if (timeText != null)
    96.             {
    97.                 if (use24HourFormat)
    98.                 {
    99.                     timeText.text = showSeconds ?
    100.                         $"{hours:D2}:{minutes:D2}:{seconds:D2}" :
    101.                         $"{hours:D2}:{minutes:D2}";
    102.                 }
    103.                 else
    104.                 {
    105.                     string ampm = (hours < 12) ? "AM" : "PM";
    106.                     hours = (hours % 12 == 0) ? 12 : hours % 12;
    107.  
    108.                     if (showSeconds)
    109.                     {
    110.                         if (showAM_PM)
    111.                         {
    112.                             timeText.text = $"{hours:D2}:{minutes:D2}:{seconds:D2} {ampm}";
    113.                         }
    114.                         else
    115.                         {
    116.                             timeText.text = $"{hours:D2}:{minutes:D2}:{seconds:D2}";
    117.                         }
    118.                     }
    119.                     else
    120.                     {
    121.                         if (showAM_PM)
    122.                         {
    123.                             timeText.text = $"{hours:D2}:{minutes:D2} {ampm}";
    124.                         }
    125.                         else
    126.                         {
    127.                             timeText.text = $"{hours:D2}:{minutes:D2}";
    128.                         }
    129.                     }
    130.                 }
    131.             }
    132.         }
    133.     }
    134. }
    135.  

    (screen shot)
    Screen Shot 2023-12-11 at 7.38.02 PM.png


    Happy Time Keeping :)
     
    Last edited: Dec 12, 2023
    tw00275 and Vondox like this.
  45. kyoshyu

    kyoshyu

    Joined:
    Jan 17, 2023
    Posts:
    2
    Enviro 3 does not play nice with VRChat, very sadly. :(

    However! I'd like to know if EnviroLite DOES work with VRChat. Does it?
     
    Last edited: Dec 31, 2023
  46. RetrKill0

    RetrKill0

    Joined:
    Sep 4, 2022
    Posts:
    7
    Recently +/- 45 warnings started to appear, would it be possible to update 2 to adapt to the new method?

    Here are some messages:

    Assets\Enviro - Sky and Weather\Core\URP Support\Scripts\EnviroBlitPass.cs(25,17): warning CS0618: 'RenderTargetHandle' is obsolete: 'Deprecated in favor of RTHandle'

    Assets\Enviro - Sky and Weather\Enviro Standard\URP Support\Scripts\EnviroDistanceBlurPass.cs(33,26): warning CS0618: 'RenderingUtils.fullscreenMesh' is obsolete: 'Use Blitter.BlitCameraTexture instead of CommandBuffer.DrawMesh(fullscreenMesh, ...)'

    Assets\Enviro - Sky and Weather\Enviro Standard\URP Support\Scripts\EnviroDistanceBlurPass.cs(54,29): warning CS0618: 'ScriptableRenderer.cameraColorTarget' is obsolete: 'Use cameraColorTargetHandle'
     
  47. stepkka

    stepkka

    Joined:
    Apr 5, 2017
    Posts:
    6
    Trying Enviro 3 on Unity 2021.3.32, VR, built-in RP.
    First issue: The clouds appear very bright and orange. The screenshots were made with default set up, first using Cloudy 2 preset, second using Foggy preset.
    Second issue: I'm using Single Pass Instanced mode. On the right eye the clouds look much more jarred and noisy than on the left eye.
    Also using KriptoFX Water System with its custom Enviro 3 fog support.

    Screenshot 2024-01-02 234848.png Screenshot 2024-01-02 234958.png
     
  48. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Hello,

    what XR plugin do you use and what color space? You get best visual results with Linear color space and some tonemapping. For example using Unity post processing package -> color grading tonemapper.

    I just done a quick test in 2021.3 XR project and I can't reproduce your issues:

    upload_2024-1-5_14-55-41.png
     
  49. stepkka

    stepkka

    Joined:
    Apr 5, 2017
    Posts:
    6
    I was able to reproduce on an empty project with just Enviro package. Interestingly though, I've started on Unity's 3D template, and the colors were normal. I've added XR management and Oculus XR plugin, ran the project without headset and the colors were still normal. I've connected my Quest 2 via Link and the clouds became orange both in headset and in Unity's game view.
    I'm using linear color space of course.

    Jarring on the right eye also noticeable on an empty project. It's not so noticeable on a static screenshot, but very visible while the game is running.
    upload_2024-1-11_17-15-25.png
     
  50. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,430
    Very strange. I will have another look into it after weekend.