You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add fog effects to Weather component with shader optimizations
- Enhanced the Weather component to support fog effects alongside existing rain and snow options, including customizable parameters for density, speed, and height.
- Introduced a new fog shader with optimizations for performance and realism, including dynamic height concentration and improved visual quality.
- Updated documentation to include detailed guidelines for fog parameters and examples for various fog scenarios.
- Refactored existing rain and snow shaders for better performance and consistency across weather effects.
- Modified sample application to demonstrate the new fog effect in a canvas environment.
The Weather component creates realistic weather effects using WebGL shaders. It supports multiple weather types including rainand snow, with customizable parameters for wind influence, density, and speed control. The effects are inspired by Zelda-style weather systems and provide beautiful, performant weather overlays for your games.
7
+
The Weather component creates realistic weather effects using WebGL shaders. It supports multiple weather types including rain, snow, and fog, with customizable parameters for wind influence, density, and speed control. The effects are inspired by Zelda-style weather systems and provide beautiful, performant weather overlays for your games.
8
8
9
9
## Features
10
10
11
-
-**Multiple Weather Effects**: Support for rainand snow with different visual characteristics
11
+
-**Multiple Weather Effects**: Support for rain, snow, and fog with different visual characteristics
12
12
-**Procedural Generation**: Weather particles are generated using hash functions for natural randomness
13
13
-**Wind Simulation**: Particles are affected by wind direction and strength as they fall
14
14
-**Density Control**: Adjust the number of visible particles from light to heavy weather
@@ -27,6 +27,9 @@ The Weather component creates realistic weather effects using WebGL shaders. It
27
27
28
28
<!-- Basic snow with default settings -->
29
29
<Weathereffect="snow" />
30
+
31
+
<!-- Basic fog with default settings -->
32
+
<Weathereffect="fog" />
30
33
</Canvas>
31
34
32
35
<script>
@@ -52,6 +55,9 @@ The Weather component creates realistic weather effects using WebGL shaders. It
-**Atmospheric Background**: Use light presets (density 60-100) for subtle ambiance
364
-
-**Gameplay Events**: Use medium presets (density 150-250) for weather-related gameplay
365
-
-**Dramatic Moments**: Use heavy presets (density 280-380) for cutscenes or intense moments
366
-
-**Performance**: Lower density (60-120) for mobile devices or when many effects are active
464
+
-**Atmospheric Background**: Use light presets (density 60-100 for rain/snow, 0.3-0.6 for fog) for subtle ambiance
465
+
-**Gameplay Events**: Use medium presets (density 150-250 for rain/snow, 0.7-1.0 for fog) for weather-related gameplay
466
+
-**Dramatic Moments**: Use heavy presets (density 280-380 for rain/snow, 1.2-1.5 for fog) for cutscenes or intense moments
467
+
-**Performance**: Lower density (60-120 for rain/snow, 0.3-0.6 for fog) for mobile devices or when many effects are active
468
+
-**Fog Specific**: Use ground fog (height 0.0-0.2) for valley/mountain scenes, high fog (height 0.6-1.0) for atmospheric backgrounds
367
469
368
470
## Technical Details
369
471
@@ -383,4 +485,12 @@ The Weather component uses specialized fragment shaders for each effect:
383
485
4.**Optimizes rendering** using efficient GPU calculations
384
486
5.**Supports real-time updates** through uniform buffer updates
385
487
386
-
Both shaders render approximately 150-200 potential particles per frame, with the actual visible count controlled by the density parameter.
488
+
### Fog Shader
489
+
1.**Generates organic fog layers** using fractal noise (FBM) for natural cloud-like shapes
490
+
2.**Creates multiple fog layers** with depth perception and overlapping patterns
491
+
3.**Simulates natural movement** with wind direction and vertical wave oscillations
492
+
4.**Applies height-based concentration** for valley effect (fog gathers at bottom)
493
+
5.**Optimizes rendering** using efficient GPU calculations with multiple layered passes
494
+
6.**Supports real-time updates** through uniform buffer updates
495
+
496
+
Both rain and snow shaders render approximately 150-200 potential particles per frame, with the actual visible count controlled by the density parameter. The fog shader uses 4 overlapping layers with fractal noise generation for organic, realistic fog patterns.
0 commit comments