Gorilla.Particle.Rain Unit Reference
Pre-configured rain particle emitter with falling droplets and splash effects.
TGorillaRainParticleEmitter
Realistic rain effect with integrated wind and splash emitters.
Inheritance: TGorillaParticleEmitter → TGorillaRainParticleEmitter
Platforms: All Gorilla platforms
Unit: Gorilla.Particle.Rain
Constructor/Destructor
Create
constructor Create(AOwner: TComponent); override;
Creates rain emitter with preconfigured settings:
- Downward velocity
- Small elongated particles
- Color transition (light to transparent)
- Wind influencer
- Splash sub-emitter
Destroy
destructor Destroy(); override;
Cleans up rain emitter and integrated splash emitter.
Properties
SpawnSize
property SpawnSize: Single;
Relative spawning area size (0.0 - 1.0) from top of emitter downwards.
Default: 0.05 (5% of emitter height)
Usage:
// Spawn in top 10% of emitter
LRain.SpawnSize := 0.1;
// Spawn across full height (not recommended)
LRain.SpawnSize := 1.0;
Note: Lower values create more natural rain appearance.
Wind (Read-Only)
property Wind: TGorillaWindParticleInfluencer read FWind;
Integrated wind influencer for directing rain.
Usage:
// Enable wind
LRain.Wind.Enabled := True;
LRain.Wind.Force.Point := Point3D(-5, 0, 0); // Wind from right
LRain.Wind.Size.Point := Point3D(100, 50, 50);
Colored (Read-Only)
property Colored: TGorillaColoredParticleInfluencer read FColored;
Integrated color influencer for raindrop fading.
Default: Light blue to transparent
Splashes (Read-Only)
property Splashes: TGorillaSpotParticleEmitter read FSplashes;
Integrated splash emitter for ground impacts.
Usage:
// Enable splashes
LRain.Splashes.Visible := True;
LRain.Splashes.Position.Y := -10; // Ground level
ParticleMaterial (Read-Only)
property ParticleMaterial: TGorillaParticleMaterialSource read GetParticleMaterial;
Attached particle material source for raindrop textures.
Methods
Start
procedure Start(); override;
Starts rain and splash emitters.
Stop
procedure Stop(); override;
Stops rain and splash emitters.
Splash
procedure Splash(const APosition: TPoint3D); virtual;
Manually emit a splash particle at specified position.
Parameters:
APosition- 3D position for splash
Usage:
// Create splash on raindrop collision
if RaindropHitsGround(LParticle) then
LRain.Splash(LParticle^.Position);
Default Configuration
The rain emitter is preconfigured with these settings:
| Property | Value | Description |
|---|---|---|
| EmitParticles | 10 | Particles per interval |
| MaxParticles | 2000 | Maximum active particles |
| EmitTime | 16ms | ~60 FPS updates |
| AutoEmit | True | Automatic emission |
| Reuse | True | Particle caching enabled |
| ParticleSize | 1-4 | Small elongated droplets |
| ParticleLifeTime | 2-5 seconds | Lifetime range |
| BlendMode | Alpha | Transparent droplets |
| SpawnSize | 0.05 | 5% from top |
Integrated Influencers
- TGorillaColoredParticleInfluencer - Light blue to transparent
- TGorillaWindParticleInfluencer - Optional wind effect (disabled by default)
Integrated Sub-Emitters
- Splashes - TGorillaSpotParticleEmitter for ground impacts
Examples
Basic Rain
var
LRain: TGorillaRainParticleEmitter;
begin
LRain := TGorillaRainParticleEmitter.Create(Self);
LRain.Parent := GorillaViewport1;
LRain.Camera := Camera1;
// Cover large area
LRain.Width := 100;
LRain.Height := 50;
LRain.Depth := 100;
LRain.Start();
end;
Rain with Wind
var
LRain: TGorillaRainParticleEmitter;
begin
LRain := TGorillaRainParticleEmitter.Create(Self);
LRain.Parent := GorillaViewport1;
LRain.Camera := Camera1;
LRain.Width := 100;
LRain.Height := 50;
LRain.Depth := 100;
// Enable wind
LRain.Wind.Enabled := True;
LRain.Wind.Force.Point := Point3D(-8, 0, 0); // Strong wind
LRain.Wind.Origin.Point := Point3D(50, 25, 0);
LRain.Wind.Size.Point := Point3D(100, 50, 100);
LRain.Start();
end;
Rain with Splashes
var
LRain: TGorillaRainParticleEmitter;
begin
LRain := TGorillaRainParticleEmitter.Create(Self);
LRain.Parent := GorillaViewport1;
LRain.Camera := Camera1;
LRain.Width := 50;
LRain.Height := 30;
LRain.Depth := 50;
// Configure splashes
LRain.Splashes.Visible := True;
LRain.Splashes.Position.Y := 0; // Ground level
LRain.Splashes.AutoEmit := True;
LRain.Splashes.EmitParticles := 5;
LRain.Start();
end;
Heavy Rain
var
LHeavyRain: TGorillaRainParticleEmitter;
begin
LHeavyRain := TGorillaRainParticleEmitter.Create(Self);
LHeavyRain.Parent := GorillaViewport1;
LHeavyRain.Camera := Camera1;
// Large coverage
LHeavyRain.Width := 200;
LHeavyRain.Height := 100;
LHeavyRain.Depth := 200;
// More particles
LHeavyRain.EmitParticles := 30;
LHeavyRain.MaxParticles := 5000;
// Faster falling
LHeavyRain.ParticleVelocity.RangeY.Preset(5000, 8000, 1000, False);
// Enable splashes
LHeavyRain.Splashes.Visible := True;
LHeavyRain.Splashes.EmitParticles := 10;
LHeavyRain.Start();
end;
Light Drizzle
var
LDrizzle: TGorillaRainParticleEmitter;
begin
LDrizzle := TGorillaRainParticleEmitter.Create(Self);
LDrizzle.Parent := GorillaViewport1;
LDrizzle.Camera := Camera1;
LDrizzle.Width := 50;
LDrizzle.Height := 30;
LDrizzle.Depth := 50;
// Fewer particles
LDrizzle.EmitParticles := 3;
LDrizzle.MaxParticles := 500;
// Slower falling
LDrizzle.ParticleVelocity.RangeY.Preset(2000, 3000, 1000, False);
LDrizzle.Start();
end;
Tips
Performance
- Adjust MaxParticles based on visible area
- Disable splashes if not visible or needed
- Use lower EmitParticles for light rain
Visual Quality
- Position emitter above camera view
- Match emitter dimensions to scene size
- Enable wind for more dynamic rain
- Use splashes sparingly for performance
Realism
- Vary particle velocity for natural appearance
- Combine with sound effects
- Add fog/mist for atmosphere
- Use smaller SpawnSize for better distribution
See Also
- Gorilla.Particle.Spot - Splash emitter
- Gorilla.Particle.Emitter - Base emitter class
- Gorilla.Particle.Influencer - Wind influencer
- Particle System User Guide