Skip to content

3d clouds #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open

3d clouds #409

wants to merge 57 commits into from

Conversation

DanielPSchenk
Copy link
Contributor

Fully 3D clouds on a global scale. Built on ideas presented by Andrew Schneider at SIGGRAPH advances in real-time-graphics workshops. Adaped for cloud volumes the size of the earth.

The new clouds are fully 3D. To switch to the new cloud model toggle Advanced settings->Atmosphere->Advanced clouds.

Because ray marching is performed at a rather high resolution with secondary rays, the new system is really heavy on the GPU.

For designing cloudscapes, the new model uses additional textures. Defaults are provided and the configuration templates were modified to include those defaults.

One error occurs when building, but it is not caused by the new code
/cosmoscout-vr/src/cs-graphics/LuminanceMipMap.cpp(28,19): error C2065: "GL_SUBGROUP_SIZE_KHR" undeclared identifier

Daniel Schenk added 30 commits January 27, 2025 07:53
@Schneegans
Copy link
Member

Thanks a ton! I'll look into it. Regarding the GL_SUBGROUP_SIZE_KHR error, you need to delete your build/*-externals-Release/glew directory and rebuild the externals. The glew version was updated recently.

@Schneegans
Copy link
Member

I just played with moving the underlying cloud texture with time. At local scale, this actually gives quite a convincing effect! Maybe we could add this as an option in the future.

Screencast.from.2025-04-09.09-05-36.mp4
Screencast.from.2025-04-09.09-14-00.mp4

@Schneegans
Copy link
Member

Schneegans commented Apr 9, 2025

Thanks again! While maybe not looking great for every vantage point, there are definitely perspectives where the clouds look pretty awesome! And on my 4070 they work quite decently. Before I look into the details, here are some high-level observations:

  • Could you remove all the debug logging? The read top texture at ... even causes a crash if the texture is not defined
  • I think the old clouds do not work if no cloudTypeTexture is set.
  • Could you add some notes to the README what the cloudTypeTexture contains?
  • I think it could be beneficial to move all the cloud shader code to a separate file at this point. What do you think? I mean it's just very few methods which are called by the main.

@DanielPSchenk
Copy link
Contributor Author

@Schneegans Are you changing the 2D or 3D noise or both?
About the points you brought up

  1. sure, that should be removed
  2. that's an oversight on my side, will fix this early next week
  3. I can write a small documentation on what the texture does
  4. that would be possible. GetCloudColor and everything it calls could be moved relatively easily, I will look into this possiblity next week
    Good to hear that it works well on your machine

@Schneegans
Copy link
Member

@Schneegans Are you changing the 2D or 3D noise or both?
About the points you brought up

Neither, just the uCloudTexture. All I did was replacing

float density = remap(textureLod(uCloudTexture, texCoords, 0).r, 0, CLOUD_COVER_MAX, 0, 1);

with

float density = remap(textureLod(uCloudTexture, texCoords + vec2(uTime * 0.00002, 0.0), 0).r, 0, CLOUD_COVER_MAX, 0, 1);

@DanielPSchenk
Copy link
Contributor Author

DanielPSchenk commented Apr 14, 2025

I changed Atmosphere.cpp to only block the use of the default cloud model when no cloud texture is present. The advanced cloud model only works if both cloud texture and cloud type texture are present. There are now warnings when a cloud model is activated but the required texture was not specified.

Also removed excessive debug printing of all the uniforms.

@DanielPSchenk
Copy link
Contributor Author

I wrote a short documentation of what the different channels of the cloudType texture do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants