Search Unity

[released] Overcloud - Volumetric Sky And Lighting

Discussion in 'Assets and Asset Store' started by Fewes, Mar 25, 2019.

  1. banksysan_unity

    banksysan_unity

    Joined:
    Feb 4, 2020
    Posts:
    12
    Should I be worried about this missing script?
    Is it possible that this is why I can't see the Overcloud effects in the Scene View?

    OvercloudMissingScript.png
     
  2. munozpro

    munozpro

    Joined:
    Sep 30, 2013
    Posts:
    3
    Hello there. Has anyone else reported this issue here? The only other time I saw someone report this was in the asset store reviews. Is this something that I should be worried about? Or just let it slide for now? Thank you!
     

    Attached Files:

  3. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    Did you delete the example content folder? The Lightning script is contain within so that would explain why it is missing. If you don't want lightning effects it is fine to just remove the lightning object from the prefab.
    Probably not great to have the main prefab link to an example script though, I'll move it in the next patch.
    Does it not work at all in the scene view? No skybox, no clouds, no nothing?

    I'm working on fixing this right now. It seems to be an issue in Unity 2019 and forwards but it has been very difficult to reproduce on my end so it has taken a bit longer than expected.

    Also on a general note I'd like to apologize for being slow to respond lately. For some reason this thread no longer sends me notifications for new posts so I've started checking it every other day instead. Took me a while to realize this though. I'm dedicated to fixing the issues that the recent influx of users has uncovered so if you're still sticking with the asset, thanks!
     
    Last edited: Oct 16, 2020
  4. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    1. I'm rechecking how correct the date system is for the next patch as I've had reports about it being off in the past. It should be accurate enough to use real dates for eclipses.

    2. Don't remove the multiplier, just multiply it with 'moonIntensity' as well. Something you can try if you want a stronger moon light but not so bright clouds is to darken the cloud albedo (under Lighting) at night time.

    4. Instead of removing the multiplication with 'transmittance' in the skybox shader, you can instead add your own shader global (Shader.SetGlobalFloat("_SkyTransmittanceAmount", 0.25f)) and replace
    Code (CSharp):
    1. transmittance
    with
    Code (CSharp):
    1. lerp(1, transmittance, _SkyTransmittanceAmount)
    That way, you can control the amount of transmittance in the sky manually, for example toning it down during night time.

    5. The easiest way to do this is to use the sun direction as an indicator of the current "day lighting" amount:
    Code (CSharp):
    1. float dayDelta = -OverCloud.components.sun.transform.forward.y * 0.5f + 0.5f;
    2. OverCloud.atmosphere.mieScatteringPhase = Mathf.Lerp(nightAmount, dayAmount, dayDelta);
    Where you replace dayAmount and nightAmount with your desired Mie intensities for day and night respectively.
     
    Duende likes this.
  5. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    179
    First of all, thank you very much again for helping me, Fewes. :)

    Ok, perfect. When you update the asset you can also share the web with the eclipse dates that you use to check if the eclipses are correct.
    Ok, I have tried to modify the cloud albedo and it works very well:
    upload_2020-10-19_20-22-46.png
    I had to modify the albedo cloud of Cirrus and Stratoculumbus as well. Where would I have to modify so that the "cloud albedos" of all the clouds go dark when night comes? Also in OverCloudLight.cs?
    Sorry I'm very noob with shaders, I need you to be more specific so I can make those changes.
    Also, it would have to rotate the image of the Milky Way. I mean, right now it's "horizontal" and I think it should be "vertical", right?
    upload_2020-10-19_20-45-1.png
    Ok, but should I add this change in OverCloudLight.cs?
     
  6. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    You could add it there, but it's better to create your own script for it. That way it won't break whenever OverCloud updates.

    I'll see about adding this natively to the skybox shader. It would benefit other users as well.

    Replace the OverCloudLight.cs Update function with this:
    Code (CSharp):
    1. void Update ()
    2. {
    3.     if (OverCloud.instance)
    4.     {
    5.         if (m_Type != Type.Point)
    6.         {
    7.             // Evaluate light color
    8.             var elevation = Vector3.Dot(light.transform.forward, Vector3.down)*0.5f+0.5f;
    9.             switch (m_Type)
    10.             {
    11.                 default:
    12.                 case Type.Sun:
    13.                     light.color = Color.Lerp(m_ColorOverTime.Evaluate(elevation), OverCloud.atmosphere.solarEclipseColor, OverCloud.solarEclipse) * multiplier;
    14.                 break;
    15.                 case Type.Moon:
    16.                     float moonIntensity = Vector3.Dot(OverCloud.components.sun.transform.forward, -OverCloud.components.moon.transform.forward) * 0.5f + 0.5f;
    17.                     light.color = Color.Lerp(m_ColorOverTime.Evaluate(elevation), OverCloud.atmosphere.lunarEclipseColor, OverCloud.lunarEclipse) * multiplier * OverCloud.moonFade * moonIntensity;
    18.                 break;
    19.             }
    20.  
    21.             // Only allow one active directional light at a time
    22.             light.enabled = (light == OverCloud.dominantLight) && !(light.color.r == 0 && light.color.g == 0 && light.color.b == 0);
    23.  
    24.             // Check if we need to initialize or clear buffers for this lightp
    25.             if (light.enabled && !m_BufferInitialized)
    26.                 InitializeBuffers();
    27.             else if (!light.enabled && m_BufferInitialized)
    28.                 ClearBuffers();
    29.  
    30.             if (light.enabled && OverCloud.lighting.cloudShadows.mode == CloudShadowsMode.Injected && !m_ShadowBufferInitialized)
    31.                 InitializeShadowBuffer();
    32.             else if ((!light.enabled || OverCloud.lighting.cloudShadows.mode != CloudShadowsMode.Injected) && m_ShadowBufferInitialized)
    33.                 ClearShadowBuffer();
    34.         }
    35.     }
    36.     else if (m_BufferInitialized)
    37.     {
    38.         // No OverCloud instance found. Clear buffers if they exist
    39.         ClearBuffers();
    40.         ClearShadowBuffer();
    41.     }
    42. }
    and you should be good :)
     
  7. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    OverCloud version 1.10 was just accepted and should be available for download! Here is the changelog:

    1.10

    Fixed an issue where a shader conflict could arise if another asset provided a "Hidden/SeparableBlur" shader (resulting in an "Invalid Pass" error).

    Added checks for Unity versions running the new XRDisplaySubsystem, which in turn fixes an error message that would appear on these versions.

    Added a warning to the OverCloudCamera component if the far clip plane is set lower than the volumetric cloud plane radius, which hides the volumetric clouds in the game view.

    Moved the Lightning script out of the example content folder, as it is included in the main OverCloud prefab and would lead to "Missing Script" warnings if the example content folder was removed (if this results in duplicate script errors for you after upgrading, just delete Lightning.cs in the Example Content folder)

    The manual is now a link to a Google Drive document instead of a PDF.

    Moreover, the manual now contains more specific and highlighted information on how to avoid the most common pitfalls and how to get going with the visuals in your own project.

    Thanks to everyone who reached out to me with details regarding the "Invalid Pass" error. This should be fixed now but please let me know if you are still encountering issues.
    No changes to the date system are included in this patch. I am investigating it currently but wanted to get out the critical fixes as soon as possible so I opted not to hold off on the patch. Thank you for understanding.
     
    weseb likes this.
  8. bgrz

    bgrz

    Joined:
    Mar 22, 2015
    Posts:
    58
    Hey Felix,

    I'm evaluating the asset and have found a few issues that I didn't see mentioned in this thread (which could turn out to be show-stoppers), so I wanted to check with you first if you think they're fixable:

    1. Looking through volumetric spotlight causes these artifacts in the distance:

    video: https://www.dropbox.com/s/q3wz7g7f1hrrh5c/2020-10-22_15-20-52.mp4?dl=0

    2. Sun glare renders over objects

    video: https://www.dropbox.com/s/0raz54ura35w4nv/2020-10-22_15-30-36.mp4?dl=0

    3. Volumetric spotlight doesn't play well with Temporal Antialiasing's jitter
    (no image, must be seen in video)
    video: https://www.dropbox.com/s/b0rrqc5m5n8g6tz/2020-10-22_15-40-24.mp4?dl=0

    4. Is it possible to block wetness shader (e.g. to keep interiors dry), e.g. by putting a mesh/collider (like a decal) so that everything under/inside it gets dry?
     
  9. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    451
    Hi @Fewes
    Have you had a change to take a look at this yet? Thanks
     
  10. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    76
    Hi. Just trying to sort out Lux Water with this and unfortunately the documentation isn't looking to be matching up with what I'm looking at here. Its pointing to Line 1231 in LuxWater/Shaders/Includes/LuxWater_Core.cginc but I think maybe there must have been some changes to the Lux Water asset since then? any help in finding the proper bit to replace would be greatly appreciated. thanks!
     

    Attached Files:

  11. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    1. Are you using temporal anti-aliasing? I might have to add some extra code for making the noise itself temporal, too.

    2. Is this with the scattering mask on? Either way, there are sliders for adjusting this under OverCloud > Atmosphere > Mie Scattering (the distance fades).

    3. Same as 1 most likely.

    4. Yes, check "Render Rain Mask" on the OverCloudCamera. The effect can then be tweaked under OverCloud > Weather Effects (it works like a shadow map projected from above). Do note that this is only supported in deferred rendering mode.

    Not yet no, sorry. I have some outsourcing work to take care of so it might take some time before I can get to it but I'm hoping to have it in the next patch.

    Can you PM me the shader you are trying to modify? It's most likely just a case of finding the right place for the code. Thanks!
     
    iddqd likes this.
  12. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    451
    Thanks for the update!
     
    Fewes likes this.
  13. bgrz

    bgrz

    Joined:
    Mar 22, 2015
    Posts:
    58
    Yes, although it's not related to TAA at all, here's a new video where I change forward/deferred, no MSAA/TAA, HDR on/off, post-processing on/off. I also change the camera far plane, which changes the appearance of the artifact.

    I wasn't aware of that setting, sorry, let's ignore this one until I see it again and try the settings.

    Yes, this one is due to TAA, but seems unrelated to 1. It's TAA from Unity Post Processing package 2.3.0

    I was aware of Rain Mask, but I asked in hope of better artistic control + hopefully better performance than having to render the mask. I've played with Wet Stuff for a short bit before Overcloud and it works by using boxes to define wet and dry areas. I figured it'd be more light-weight than relying on a mask. However, upon playing with Overcloud's wetness a bit more, I saw I'd need more features (which I don't mean to ask you to implement them, since I understand they're out of scope of the asset), e.g. support for moving objects - vehicle which moves and can tip over, rain effect "scrolls" sideways while vehicle moves which breaks the illusion.

    Bonus:

    5. I've been having this "black sky" bug in deferred which I didn't manage to find solution for, it happens after starting the game and seems to fix itself after a while: link to video
     
  14. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    179
    Ok. ;)
    Perfect, I'll wait for the update. :)
    But that code is simply for add the moon lighting. I mean, the only change there is multiply by moonIntensity, and that change I already made.

    I was referring to this change that you said:
    Should I also add this in OverCloudLight.cs?
     
  15. cordmeister

    cordmeister

    Joined:
    Apr 1, 2018
    Posts:
    4
    I am using Overcloud in a scene with volumetric fog, HX volumetric lighting, and massive clouds. All were working well together until I attempted to increase cloud shadowing by switching from the internal shader to the deferred method you recommend in the documentation. Now none of the effects are displaying in editor or at runtime. Any thoughts on what I can do to rectify? I'm at my shader limit, but use shader control to manage this. I feel I may have finally gone too far... But would love some insight/assistance. Great asset btw! I was really enjoying what it added to the scene.
     
  16. lohitsheperd

    lohitsheperd

    Joined:
    Apr 30, 2018
    Posts:
    1
    After importing overcloud. the sky goes black with no sun but GI works. the project has multiple cameras.
    The error im getting is "texture 2d access kernel info". Please help.
    Thanks in advance
     
  17. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    179
    In addition from what I said in this post, could you look at this conversation I had with larsbertram1? I have not been able to make Overcloud compatible with Lux Water by following this link.
    Why are the clouds still transparent when they are in front of the water? Is the link out of date?
     
    Last edited: Nov 27, 2020
  18. Enginhk

    Enginhk

    Joined:
    Jun 14, 2013
    Posts:
    4
  19. Frank-1999-98K

    Frank-1999-98K

    Joined:
    Jun 30, 2015
    Posts:
    14
    Hi, I'm very interested in the asset but I found this video on your YouTube channel:

    I wanted to know if I could get a similar result with Overcloud or if it's just a custom cloud rendering solution that you specifically tailored and designed for your game.

    I'd die to be able to have anything like the one showed in the vr sim, and before buying Overcloud I wanted to know if it was achievable with the asset out of the box, if it's a separate thing that you planned on releasing in the future perhaps (which I'd happily wait for), or if it's just a thing you made for your game and so I'll have to settle for what's in the trailer video in the store page (which don't get me wrong, is still pretty cool, but your flight sim demo is soo good, especially with the multi-layered capability!)

    Thank you in advance
     
    Last edited: Dec 16, 2020
  20. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    553
    Ya come on Fewes not fair man. Share with your customers plz:)
     
  21. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
    CLOUDS ;D
     
    Fewes likes this.
  22. Purumo

    Purumo

    Joined:
    Aug 9, 2019
    Posts:
    12
    Hey!
    My shadows from objects in the scene "fly away" at sunset. Everything is ok during dawn.
    Can you help me with this?
     

    Attached Files:

  23. Purumo

    Purumo

    Joined:
    Aug 9, 2019
    Posts:
    12
    More than a year and a half has passed since you posted this answer, and now I need this feature.
    I need to do this as early as possible. Please give me a recipe or an idea.
    I don't want to integrate with other assets to create weather, this is very painful :(
     
  24. sasa42

    sasa42

    Joined:
    Jun 6, 2018
    Posts:
    20
  25. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    179
  26. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    Hi guys! I'm on vacation until January the 11th, and I'll get on fixing the stuff that has popped up during the Christmas period then. Thank you for your patience!

    Cheers,
    Felix
     
    Duende likes this.
  27. dhkwon

    dhkwon

    Joined:
    Aug 27, 2014
    Posts:
    1
    hi.



    We are making an airplane game after purchasing the overcloud asset.



    By the way, I use floatingOrigin.



    http://wiki.unity3d.com/index.php/Floating_Origin





    All other objects can be moved,



    How do you move the cloud object?



    Basically, the clouds are moving,



    Naturally, I want to move the whole object to the origin.



    Is there a way to move the overcloud object to the origin?



    Thanks.
     
  28. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    Okay, I'm back! Let's get to fixing.

    You can place that code anywhere in an Update function, since it uses static functions to set the Mie value.

    The modified internal deferred shader should be very similar to the default one. Have you confirmed this issue goes away if you switch back to default? If so, something might have changed in the internal deferred pipe since last I checked (although I would hope Unity didn't make changes to this any longer).

    I haven't heard of this error before. Could you post or send me a screenshot of the full error stack? Thanks!

    This seems to be related to the stereo rendering. What version of Unity are you using, and are you using multi pass or single pass stereo rendering?

    OverCloud can not render such volumes, no. The system shown in the video is another system entirely which I've tailored to my game. Currently I have no plans on releasing it as an asset or anything.

    Does this happen only when OverCloud is enabled? Have you tried adjusting your camera clip planes and see if that affects it? Unity might be doing some stuff with the shadows based on the geometry in the scene, but the cloud plane shouldn't be affecting that.

    I don't have any plans for scoping up the wind system, but if you must have this feature, I suggest looking at how the compositor texture is rendered (this is where you would specify a wind vector), then checking the cloud sprite shader and in the vertex shader, find and remove the code that scrolls the sprites. The cloud density function is also mirrored on the CPU, so if you want to support cloud volume probing you'll have to change that as well.

    Yes, OverCloud supports a floating origin. Use the static functions OverCloud.MoveOrigin and OverCloud.ResetOrigin to move and reset the origin respectively. If you are using the script from the wiki you linked, add
    Code (CSharp):
    1. OverCloud.MoveOrigin(-cameraPosition);
    somewhere in the
    Code (CSharp):
    1. if (cameraPosition.magnitude > threshold)
    2. {
    3. }
    block.
     
    Duende likes this.
  29. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    160
    @Fewes I'm trying to use this with a Vive but the sky just smears the dead image from the scene on it. Sorry don't know the technical name. Basically it's not drawing the sky, and doesn't clear the left over images which are on the screen when you look at the spot. Is there instructions on how it needs to be configured to work on Vive?
     
  30. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    There's nothing in particular that needs to be done in order to get it working with the Vive. What version of Unity are you on (and are you using the default render pipeline), are you using single pass or multi pass stereo rendering and are you seeing any errors in the console? Are you seeing any clouds at all or is it just not drawing the sky/anything?
     
  31. silentpundit

    silentpundit

    Joined:
    May 2, 2020
    Posts:
    14
    @Fewes

    Hi there, thanks again for the great product!

    First, some good news -- I recently upgraded to the current version of Unity and I'm no longer experience the weird problem with Rain and VR (where the left camera suddenly because a downward orthogonal perspective which I assumed was being used to map the rain impact particles).

    Now the bad news -- I am having a brand new, far worse problem where the volumetric cloud mask seemingly is being rendered at the wrong position.

    Thanks in advance for any guidance you can give on this!

     
    Last edited: Feb 14, 2021
  32. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    This looks like an issue related to the depth buffer. This has proven difficult to make sure it works properly on all ends as the number of combinations of engine/pipeline versions and VR devices is quite numerous. Please provide me with the following information and I can try and match your setup to figure out the cause:
    • Unity Engine version
    • Render pipeline (Forward or Deferred)
    • Stereo rendering mode (Multi Pass or Stereo Pass)
    • VR Device (This should ideally not matter, but I've had reports of small differences between Oculus and Vive)
    Thanks!
     
  33. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    553
    Where in the code does it let me rotate the direction of the clouds?

    I'm trying to watch a sunset and have the clouds flying at me but its going the other way so its a sunrise with the clouds coming at me. So how do I rotate the movement of the clouds to be moving in the direction I need them to be. Typically I'll have a camera at rotation on the Y at 90, 180, 270 etc so I'm trying to make the clouds match the direction I am facing to be flying towards me.
     
  34. jnoffke

    jnoffke

    Joined:
    Nov 26, 2013
    Posts:
    31
    Is there any chance you plan to update the asset to support Single Pass Instance Rendering in VR? Trying out the asset in 2019.4.20f1 with the new XR Plugin Management plugin and using the Mock HMD with Single Pass Instancing option and some of the shaders do not compile. I guess Unity is no longer supporting just Single Pass going forward? As this is not an option anymore, just Multi-pass and Single Pass Instancing. The same is true for these options when I use the OpenVR plugin distributed by Valve through their github.
     
  35. silentpundit

    silentpundit

    Joined:
    May 2, 2020
    Posts:
    14
    Cool, thanks!
    • Unity Engine version: 2020.2.4f1 (note that the same project with the same setup does work on 2019.3.13f1)
    • Render pipeline: Forward, but Deferred gives same results
    • Stereo rendering mode: Multi Pass
    • VR Device: Oculus Rift CV1
     
  36. silentpundit

    silentpundit

    Joined:
    May 2, 2020
    Posts:
    14
    Also @Fewes something that may be significant here that I just realized -- the version of the project that is having this problem (running on 2020.2.4f1) also had the asset re-imported freshly. So that may be the issue as opposed to the Unity version difference.
     
  37. jnoffke

    jnoffke

    Joined:
    Nov 26, 2013
    Posts:
    31
    So I was able to get something to work with Single Pass Instancing VR. I did have to upgrade to 2019.4.21f1 as there is a bug fix for SetRenderTarget for Single Pass Instance. I also had to change all calls to to SetRenderTarget to pass -1 for the depth slice parameter as noted here. Then just following the guide to update all shaders to support Single pass instancing. I could not get the low res depth textures to map correctly to headset though so I have to just always sample the full size depth texture. I also never use deferred rendering, so I didn't even look at any of that or the rain mask. So, I think it is possible to to support Single Pass Instancing VR. I just don't know enough about graphics programming and shaders to be able to fully convert it.
     
  38. antsonthetree

    antsonthetree

    Joined:
    May 15, 2015
    Posts:
    95
    Hello @Fewes ! I got Overcloud a while back in a bundle and so far I'm enjoying working with it. However I have an issue. In my game I need very large and tall clouds. Most of the action involves navigating in and around heavy storm cloud banks.

    I've edited OverCloud.cs to allow my cloudPlaneHeight to take a max value of 5000. Unfortunately when I set it to 5000 the frame rate drops to around 10 FPS. When I change the quality setting to LOW it does get better - around 30 or so - and the low quality is good enough for what I need. But I would still like a higher frame rate than 30. Are there any settings I can tweak to try to pull another 10-15 fps out of this and still have a super tall cloudPlaneHeight?

    Thanks
     
    Last edited: Sep 14, 2021
  39. jnoffke

    jnoffke

    Joined:
    Nov 26, 2013
    Posts:
    31
    In previous posts you mention if using forward rendering it is possible to apply the cloud shadows past the shadow plane if you are using custom shaders. Do you have a simple example of this?
     
  40. jonshamir

    jonshamir

    Joined:
    Dec 8, 2018
    Posts:
    1
    Hey, does this work on Mac OS? Is there a Mac demo?
    Thanks!
     
  41. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    803
    @Fewes
    Are there any updates planned for the features you have been showcasing on your Twitter feed?
    (like beer Shadow maps and ambient occlusion) :)
     
  42. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    Hi all,

    My work situation has recently changed from doing freelance work to a full-time job, and as such I am unable to continue to support OverCloud. The asset has been live for just over two years, and I'd like to thank everyone who has showed interest in it and have used it.

    I've decided to leave the asset on the Asset Store until the end of the month, if for some reason someone wants to grab it before it's gone. Please note however that there will be no support going forward.

    If you purchased the asset within the last 6 months (excluding the Humble Bundle) and are unhappy with it, please contact me either via PM or email (fewes17@gmail.com) and we can discuss a refund.

    Cheers, and thank you!
    Felix
     
  43. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    2,158
    That's sad to hear, but understandable. Thank you very much for your most awesome asset and your inspirational videos, especially the one with the multi-layered clouds. You are among the best publishers on the store imo. All the best for your future!
     
    Fewes likes this.
  44. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,423
    Please consider maintaining compatibility with new LTS versions. An annual update shouldn't be that bad ...?
     
    Ruchir likes this.
  45. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    553
    Comeon Fewes 2020LTS one last update we believe in you:)
     
    julianr, keeponshading and Ruchir like this.
  46. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    179
    That would be nice.
     
  47. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    85
    Hey there, hopefully some people still frequent this forum. I'm wondering if someone could help me figure out how to rotate ONLY the stars in the skybox. In my game there's a few quick time-lapses of the day speeding by, but right now the stars are stationary. I tried applying portions of code from this shader Link which worked, but it rotated the moon/sun in addition to the stars. Does anyone have any suggestions?
     
  48. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    253
    You should be able to do this by providing a global shader matrix containing your rotation. In C#:
    Code (CSharp):
    1. Matrix4x4 rot = Matrix4x4.TRS(Vector3.zero, referenceTransform.rotation, Vector3.one);
    2. Shader.SetGlobalMatrix("_StarsRotation", rot);
    Where referenceTransform is a transform that acts as the "rotator".

    Then in OverCloud/Resources/Shaders/Skybox.cginc, add
    Code (CSharp):
    1. float4x4 _StarsRotation;
    somewhere at the top, and around line 250, change the cubemap sample from:
    Code (CSharp):
    1. // Apply star/space map
    2. color += transmittance * texCUBE(_SkyStarsCubemap, viewDir) * _SkyStarsIntensity * (1-moon.a) * (1-sun.a);
    to:
    Code (CSharp):
    1. // Apply star/space map
    2. color += transmittance * texCUBE(_SkyStarsCubemap, mul((float3x3)_StarsRotation, viewDir)) * _SkyStarsIntensity * (1-moon.a) * (1-sun.a);
    Let me know if this works!
     
    Rowlan, hopeful and Ruchir like this.
  49. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    85
    Fewes likes this.
  50. ModerateWinGuy

    ModerateWinGuy

    Joined:
    Nov 2, 2020
    Posts:
    2
    Do you know if this is compatible with VRChat, has anyone tried it that your aware of?
    I'd love to make a VRChat world that uses this but am unsure if it would work.
     
unityunity