Goal
The objective was to create a fully dynamic climate system that simulates realistic day–night cycles, seasonal changes, dynamic weather, and real-time shadows — all interconnected and influenced by time of year and environmental conditions. The system needed to be visually immersive, highly modular, designer-friendly, and optimized for performance on both PC and mobile platforms.
System Overview
The climate system consists of four major components:
Day–Night Cycle – Simulates sun and moon movement, ambient transitions, and night lighting.
Seasons – Changes lighting, colors, and vegetation appearance across Spring, Summer, Autumn, and Winter.
Dynamic Weather – Manages seasonal and conditional weather events with cooldowns and dependencies.
Real-Time Shadows – Generates lightweight, time-of-day–responsive shadows without expensive URP shadow rendering.
These components communicate through a central ClimateData ScriptableObject, which stores time, season, and active weather data, and coordinates updates across the system.
Architecture
ClimateData – Acts as the central hub for all climate-related state. Tracks date/time, active season, current weather, and cloud strength. It also stores and manages lists of registered weather objects, shadow instances, and light interpolators.
ScriptableObjects – Used for weather definitions, seasonal data, and environmental parameters to make the system fully designer-friendly and easy to migrate to other projects.
Update Loop – Centralized in ClimateData, which sequentially updates the day–night cycle, seasonal blending, active weather events, and shadow transformations.
Component Breakdown
Day–Night Cycle
The cycle is driven by Unity’s Date Time to track in-game time down to the minute.
Sun & Moon Movement – Implemented with 2D Light objects orbiting around a central point, their positions updated based on time-of-day.
Ambient Lighting – Controlled by animation curves to smoothly transition between night, dawn, noon, and dusk.
Night Lights – Indoor and outdoor lights fade in/out based on separate curves, synchronized with sunrise and sunset.
Weather Integration – Cloud cover affects both sun and moon brightness for realistic overcast conditions.
Seasons
The year is divided into four seasons, each with its own:
Sun & Moon Light Curves – Define daily light intensity profiles.
Color Gradients – Tint the sky and ambient lighting to match the season.
Day Length Ranges – Longer summer days and shorter winter days, implemented via sun-active ranges.
Vegetation Blending – Seasonal materials interpolate between peak seasonal colors over time.
Seasonal Blending Window – Last 30 days of a season gradually mix in the next season’s parameters.
Dynamic Weather
Weather events are defined as Weather ScriptableObjects and evaluated by ClimateData each frame.
Weather Conditions – Define the type, behaviour intensity, allowed months, and dependencies (e.g., rain requires clouds).
Duration & Cooldowns – Randomized durations prevent repetition, with cooldowns ensuring natural variation.
Seasonal Influence – Weather likelihood and intensity adapt to the current season (e.g., fog in winter, stronger sun in summer).
Inter-Weather Communication – Active weather events are registered so others can adjust their probabilities (e.g., heavy rain increases thunder chance).
Real-Time Shadows
Designed for mobile performance, this system avoids URP’s expensive shadow rendering.
Shadow Instances – Registered objects that scale and rotate based on sun position.
LightInterpolator – Interpolates between predefined light frames to simulate shadow shapes and lengths.
Shadow Curves – Animation curves define shadow length and rotation throughout the day.
Weather Integration – Cloud cover slightly reduces shadow contrast for overcast conditions.
Designer-Friendly Features
Data-Driven Architecture – All core parameters (season curves, gradients, weather rules, shadow shapes) are defined in ScriptableObjects.
Plug-and-Play – Systems can be reused in other projects by importing the climate package.
Performance-Optimized – Avoids real-time expensive shadow rendering, reducing GPU cost for mobile.
Interconnected Logic – Each system influences the others for consistent and immersive environmental behaviour.
Result
The result is a cohesive climate simulation where:
The sun rises earlier in summer and casts longer shadows in winter.
Fog rolls in only on cold mornings, while thunderstorms require both clouds and rain.
Vegetation gradually shifts colors across the year.
Lighting, weather, and shadows all react dynamically to time-of-day, season, and atmospheric conditions.
Key Takeaways
Learned how to design data-driven, modular systems that are easy to extend and reuse.
Improved performance optimization skills by replacing expensive real-time shadows with lightweight alternatives.
Developed interconnected gameplay systems where lighting, seasons, weather, and shadows influence each other.
Strengthened ability to make designer-friendly tools using ScriptableObjects and clear code structure.