Skip to content

HantingXu/final-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 

Repository files navigation

Procedural Weather System

Created by: Christine Kneer & Hanting Xu

Contents

Design Doc

Introduction

The project stems from a fascination with procedural weather systems discovered during a past internship. Procedurally generated weather responds to factors like terrain height, temperature, and humidity, which offers the exciting potential to create realistic, responsive environments that enhance immersion in virtual worlds, whether in games, simulations, or educational tools. By building a system that can handle weather generation at both macro and micro levels, we aim to provide an experience that not only enhances the sense of realism but also invites users to engage with the environment through exploration and experimentation.

Goal

The final outcome of our project is to produce a fully procedural-generated and self-evolving weather system based on some user inputs, like height maps or other distribution maps. Also, the project should provide the users with some additional tunable parameters to change the generated environment and allow user to zoom in/out to view the simulated result on both micro and marco levels.

Inspiration/reference:

  • Geographical Adventures
image
Geographical Adventures by Sebastian Lagu

This little geography game resembles what we hope to achieve for our macro scopic simulation, both visually and logically. We hope to draw inspiration from how Sebastian used real world geography data to simulate weather.

  • Procedural Weather Patterns
image
Procedural Weather Patterns by Nick

Our project was inspired by Nick's blog post, where they discussed how to procedrually generate dynamic weather. Although our project will likely be at a bigger scope, we will definitely refer to their discussion on procedurally generating weather maps (like precipitation map, wind map etc.).

Specification:

  • Our project should be able to generate terrain and other required maps either automatically by some random seed or by reading some user provided maps.
  • The system should provide some intuitive parameters for users to adjust the weather as they like.
  • The modeled environment should be presented in a certain levels of details that allow user to zoom in or out for viewing.

Techniques:

  • Noise functions will be involved in process of terrain, other related maps and cloud/rain generation.
  • For the map generation part, we think this article and this repository might be useful.
  • For the weather transition and how different variable might act on one another, we might refer to this paper as well.
  • For the rendering part, we might refer to the GDC talk.

Design:

Timeline:

  • The focus of Milestone 1 would be mainly about generating terrain and other required map for weather.
  • The focus of Milestone 2 would be mainly about simualting the weather and environment modeling.
  • The focus of Milestone 3 would be mainly about rendering the weather and creating the special effects for the weather.
Timeline Tasks for Christine Tasks for Hanting
Week 1 (2024/11/06 to 2024/11/13) Procedural terrain generation Water Map generation
Height map generation Cloud map generation
Temperature map generation
Week 2 (2024/11/13 to 2024/11/20) Weather Map Cloud Rendering
Week 3 (2024/11/20 to 2024/11/27) Microscopic view foundation Volumetric Cloud & Player
Week 4 (2024/11/27 to 2024/12/02) Weather shaders Skybox shader
Weather manager & weather transition Water shader

Milestone 1

In Milestone 1, we laid the groundwork for our weather simulation project by generating both terrain and weather maps. These foundational maps allowed us to create a basic macroscopic view of our planet, incorporating a high level of user control for customization.

demo
Milestone 1 Demo

Completed Tasks

Height Map & Procedural Terrain Generation (Christine)

  • Planet Shape

I used a cube with six faces, which is dynamically displaced into a unit sphere. The terrain is triangulated based on user input, allowing control over both tessellation levels and radius adjustments via the editor. The basic sphere is then further displaced by sampling the height map generated in the following step.

lod radius control
LOD Radius User Conrtol
  • Procedural Terrain Generation & Height Map

Users can add custom noise layers, with each layer introducing additional surface variation to the planet. Using Perlin noise, users have control over parameters such as number of layers, frequency, base roughness, roughness, minimum value, and strength.

noise heightMap heightMapControl
Noise Height Map User Control

The first noise layer can act as a mask to define continent outlines, for example. Subsequent layers, like a second noise layer, can add high-strength noise to simulate mountainous regions. Using the first layer as a mask allows us to ensure that mountains only appear on continents rather than oceans, as demonstrated below.

1 2 3
First Layer First + Second Layer First + Second Layer (using first layer as mask)

Other Weather Maps (Hanting)

  • Water Map

Water map is generated based on the the height map. The user can adjust the percentage of water coverage of planet based on height with Water Ratio slider.

waterMap control
Water Map User Control
  • Cloud Map

Cloud map is purely randomly generated by the perlin noise in the initialization stage. The user can change the number of the storm centers they want to have by sliding the Center Number slider. To have the swirling clouds on the atmosphere, I use the curl noise for cloud flow decribed in this article.

cloudMap control
Cloud Map User Control
  • Temperature Map

Tempurature map is generated based the latitude and height of the globe. In this Setting, the temperature tends to be lower at both poles and places of high altitude, and gets warmer as becomes closer to the equator. People can slide the Latitude Weight and Height Weight to adjust the influence of these two factors acting on temperature.

temperaturMap control
Temperature Map User Control

References

Milestone 2

Completed Tasks

Biome Map Generation & Microscopic Cloud Generation (Hanting)

  • Biome Map Generation

Biome map is generated based on two maps temperature map and humidity map. User can provide a texture map that assigns different colors that represents different biomes. The provided texture should take temperature in y-axis and humidity in x-axis, like the picture shown below.

biomeLookup biomePlanet
Biome Map Planet textured by Biome Map
  • Microscopic Cloud Generation

Our volumetric clouds are generated through sampling the density of a provided 3D noise texture by raymarching, so that in the final version, the player can move around or in the cloud. To do that, this video provide great help to me. Currently, the clouds are only rendered in a fixed box and didn't sample the cloud map distribution. I'll continue to work on that in the final version.

Cloud

Procedural Weather & Weather Visualization (Christine)

  • Procedural Weather

I leverage our maps including temperature, water, and cloud maps to procedurally generate realistic and dynamic weather conditions. Each map is associated with an environmental factor that influence the weather:

Map Environmental Factor
Temperature Map Temperature
Water Map Water Proximity
Cloud Map Cloud Density

By integrating environmental factors, I simulate the following weather phenomena based on user-defined thresholds:

Weather Type Relevant Environmental Factor
Sunny temperature > hotThreshold && cloudDensity < lowThreshold
Rainy temperature > coldThreshold && cloudDensity > highThreshold && waterProximity > nearThreshold
Cloudy cloudDensity > mediumThreshold
Snowy temperature < coldThreshold && cloudDensity > highThreshold && waterProximity > nearThreshold
Partly Cloudy Other

Additionally, each weather type is assigned an intensity based on the current environmental factors and some smoothing factor.

Weather Map (R Channel: Weather Type, G Channel: Intensity) User Control
  • Weather Visualization

I also created a shader to showcase our dyanmic weather system, where each color represents a unique weather type.

weather
Weather Map Visualization User Control

References

Final

Completed Tasks

Plane Controller & Volumetric Cloud & Stylized Water & Procedural Skybox (Hanting)

  • Plane Controller

To travel on the micropic scale, I made a plane controller that can yaw, pitch, roll and throttle by simple controls.

Plane Control
  • Volumetric Cloud

By getting the light transmittance from ray marching and sampling the cloud density from the cloud map and 3D noise texture, I render the cloud in some cartoon style. In this way, the player can freely traveling in or out of the clouds as they want. Also, they can change the density, color, light absorbtion of the clouds in the shader as they want.

cloud
Cloud Visualization User Control
  • Stylized Water

The stylized water is made with simple foam near the shore and waves by sampling and mixing wave normal texture. Players can adjust the water color as they want.

Procedural Sea
  • Procedural Skybox

The procedural skybox shader takes in 4 color - day sky color, night sky color, day land color, night land color. Computing the dot product between the up vector and main light direction, I lerp between these colors to get the current color and draw the sun with the similar method. By rotating the directional light, the player can see the day and night changes.

skybox
Skybox Visualization User Control

Microscopic view & Weather Shaders & Weather Transition (Christine)

  • Microscopic view

The Microscopic View provides a detailed representation of weather effects on a smaller scale. Unlike the macroscopic view, which uses a sphere to encapsulate the environment, the microscopic view employs a dynamically deformed plane. I utilized cosine-weighted UV mapping to minimize distortions, especially near the poles, ensuring accurate texture sampling.

Microscopic View
  • Weather Shaders

    Our system incorporates specialized post-process shaders to render various weather effects.

    • Rain Shader

The Rain Shader simulates realistic rain by rendering raindrops with varying intensities and speeds. It dynamically adjusts the number of raindrop layers based on the current intensity, ensuring a smooth visual experience.

lightrain heavy
Light Rain Heavy Rain
  • Snow Shader

The Snow Shader replicates the serene effect of snow by rendering snowflakes with varying intensities and movements. It dynamically adjusts the number of snowflake layers based on the current intensity, ensuring a smooth and realistic snowfall.

lightsnow heavy
Light Snow Heavy Snow
  • Weather Transition

The Weather Transition component manages the smooth transition between different weather states. It maintains the current weather type and intensity, dynamically reads target weather conditions from a weather map using compute shaders, and interpolates between the current and target states to ensure seamless visual transitions. The current weather type and intensity is passed into the weather shaders and the skybox for rendering.

intoRain.mp4
outofRain.mp4
InGameView.mp4

References

Final Results

MacroView.mp4
MicroView.mp4

Post Mortem

We successfully developed a dynamic weather system that can be seamlessly integrated into any game, providing users with extensive control over various weather parameters. We also delivered a working project that effectively demonstrates the system's capabilities and smooth weather transitions.

However, the demonstration scene is somewhat simplistic, featuring terrain with low levels of detail and lacking procedurally placed assets, which limits the visual complexity and realism. Additionally, while we have the underlying logic for cloudy and sunny weather, we only implemented shaders for rain and snow.

For future work, we aim to enhance the scene's visual richness and expand our shader repertoire to include all planned weather types.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 51.9%
  • HLSL 28.7%
  • Wolfram Language 19.4%