Difference between revisions of "HPL3/SOMA/Level Design/Environment Particles"
(Add source-verified reference; mark undocumented workflow and behavior for expansion.) |
(Expand the SOMA guide with verified stock examples, practical steps and precise remaining documentation gaps.) |
||
| Line 1: | Line 1: | ||
{{shortPageTitle}} | {{shortPageTitle}} | ||
| + | |||
{{stub}} | {{stub}} | ||
| − | The <code>EnvParticles</code> element | + | Environment particles add a field of textured particles to a level. SOMA’s underwater maps use them with the shipped <code>waterdust_tiny_3x3.dds</code> texture. The renderer turns the particle faces toward the camera and wraps their positions inside a box, so this is a repeating particle field. |
| + | |||
| + | == Find the controls == | ||
| + | Open '''Level Settings''' and select its '''Env Particles''' tab. '''Active''' toggles the particles, '''Color''' tints them, and '''Brightness''' controls how bright that tint appears. | ||
| + | |||
| + | The SOMA editor also contains controls labelled '''Texture''', '''Box Size''', '''Box Distance''', '''Num Particles''', '''Particle Size''', '''SubDivs''', '''Affected by light''', '''Num of iterations''', '''Gravity Velocity''', '''Wind Velocity''', '''Rotate Velocity''', '''Fade In''' and '''Fade Out'''. The following example gives the authored map values rather than treating them as editor defaults. | ||
| + | |||
| + | == Reproduce the Delta particle settings == | ||
| + | Use a map inside your own mod, with the working editor/save/launch setup from [[HPL3/SOMA/Getting Started/Edit Your First Map|Edit Your First Map]]. The example below copies only Delta’s environment-particle settings; Delta’s fog, lighting and other map settings are separate. | ||
| + | |||
| + | # Close the mod map in the editor before editing its <code>.hpm</code> file. | ||
| + | # Open your mod’s <code>maps/sample_map/sample_map.hpm</code> in a text editor. Inside <code>GlobalSettings</code>, replace its <code>EnvParticles</code> element with the following element from <code>maps/chapter02/02_03_delta/02_03_delta.hpm</code>. | ||
| + | # Reopen the mod map in <code>LevelEditor.exe</code> and inspect the '''Env Particles''' tab. The texture is populated and the particles are active, whereas the bundled sample map stores an empty texture and <code>Active="false"</code>. | ||
| + | |||
| + | <syntaxhighlight lang="xml"> | ||
| + | <EnvParticles | ||
| + | Color="0.898438 0.959534 1 1" | ||
| + | Brightness="0.3" | ||
| + | BoxDistance="0.1" | ||
| + | GravityVelocity="0 0.01 0" | ||
| + | GravitySpeedRandomAmount="0" | ||
| + | WindVelocity="0 0 0" | ||
| + | WindSpeedRandomAmount="0" | ||
| + | WindDirRandomAmount="0" | ||
| + | RotateVelocity="0.005 0.005 0.005" | ||
| + | RotateSpeedRandomAmount="1" | ||
| + | RotateBothDirs="true" | ||
| + | NumIterations="2" | ||
| + | FadeInStart="0.1" | ||
| + | FadeInEnd="1" | ||
| + | FadeOutStart="10" | ||
| + | FadeOutEnd="16" | ||
| + | BoxSize="10" | ||
| + | NumParticles="3000" | ||
| + | ParticleSize="0.08 0.08" | ||
| + | SubDivUV="3 3" | ||
| + | AffectedByLight="false" | ||
| + | Texture="particles/underwater/materials/waterdust_tiny_3x3.dds" | ||
| + | Active="true" | ||
| + | /> | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | # Save the mod map and launch it. The particle field uses the small underwater-dust texture and the pale blue tint from the copied settings. | ||
| + | # Make one visible comparison in the '''Env Particles''' tab: turn '''Active''' off, save, and restart the map; then turn it on again and repeat. This checks the particle layer separately from fog and other effects. Use [[HPL3/SOMA/Getting Started/Test Debug and Continue|the development loop]] for restarting and reading errors. | ||
| + | |||
| + | == Read the example == | ||
| + | * <code>Texture</code> references a shipped texture under <code>particles/underwater/materials/</code>; it is a texture filename, not a <code>.ps</code> particle-system file. | ||
| + | * <code>NumParticles="3000"</code>, <code>ParticleSize="0.08 0.08"</code> and <code>SubDivUV="3 3"</code> are Delta’s authored values. They are not a recommended count or a universal preset. | ||
| + | * <code>GravityVelocity="0 0.01 0"</code>, <code>WindVelocity="0 0 0"</code> and <code>RotateVelocity="0.005 0.005 0.005"</code> are distinct motion parameters. The script API has separate setters for all three. | ||
| + | * The fade-in begins at distance <code>0.1</code> and finishes at <code>1</code>; fade-out begins at <code>10</code> and finishes at <code>16</code>. These are distance thresholds, not durations. The map helpers document their meaning, and the rendering shader computes their effect from particle depth. | ||
| + | |||
| + | == Let a script change the field == | ||
| + | Map scripts can change the particle field after the map loads. Include <code>helpers/helper_map.hps</code> alongside your existing map-script includes. The Delta map enables the field with: | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | Map_SetEnvironmentParticlesActive(true); | ||
| + | </syntaxhighlight> | ||
| − | + | During its transition towards Theta Outside, the same stock script fades all matching particle layers to a new color and brightness: | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | == | + | <syntaxhighlight lang="cpp"> |
| − | The | + | Map_FadeEnvironmentParticleColor("*", cColor(0.295,0.556,0.59,1.0), 7); |
| + | Map_FadeEnvironmentParticleBrightness("*", 1, 7); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | Here <code>"*"</code> selects all particle layers. The last argument is the fade duration; the Map Effects Handler accumulates elapsed update time for these fades. These calls alter existing layers rather than define their texture, particle count or box size. | ||
| + | |||
| + | == If the particles disappear == | ||
| + | * Check both the saved <code>Active</code> value and map-script calls: stock SOMA scripts can enable or disable the field at runtime. | ||
| + | * Check that the texture exists; the worked example uses <code>particles/underwater/materials/waterdust_tiny_3x3.dds</code>. | ||
| + | * Check the fade distances. A particle at the fully faded-out distance contributes no visible alpha. | ||
| + | * Check clipping when using water areas. The Liquid area definition exposes <code>EnvParticlesToClip</code> for naming the layers constrained to that area, and accepts wildcards and space-separated names. | ||
| + | |||
| + | == Still to expand == | ||
| + | The exact units and ranges for the motion and randomization controls, the meaning of Box Distance and iteration count, and a visually verified editor demonstration still need documentation. The stock values above establish an authored setup, not those undocumented semantics. | ||
== See also == | == See also == | ||
| − | * [[HPL3/Level Design/Level Settings|Level | + | * [[HPL3/Level Design/Level Settings|Level Settings]] |
| − | + | * [[HPL3/SOMA/Scripting/Map Helper|Map scripting helpers]] | |
| − | + | * [[HPL3/SOMA/Scripting/Map Effects Handler|Fading level effects]] | |
| − | |||
[[Category:English]] | [[Category:English]] | ||
Latest revision as of 14:48, 2 October 2026
|
This article or section is a stub. You can help by adding to it. |
Environment particles add a field of textured particles to a level. SOMA’s underwater maps use them with the shipped waterdust_tiny_3x3.dds texture. The renderer turns the particle faces toward the camera and wraps their positions inside a box, so this is a repeating particle field.
Contents
Find the controls
Open Level Settings and select its Env Particles tab. Active toggles the particles, Color tints them, and Brightness controls how bright that tint appears.
The SOMA editor also contains controls labelled Texture, Box Size, Box Distance, Num Particles, Particle Size, SubDivs, Affected by light, Num of iterations, Gravity Velocity, Wind Velocity, Rotate Velocity, Fade In and Fade Out. The following example gives the authored map values rather than treating them as editor defaults.
Reproduce the Delta particle settings
Use a map inside your own mod, with the working editor/save/launch setup from Edit Your First Map. The example below copies only Delta’s environment-particle settings; Delta’s fog, lighting and other map settings are separate.
- Close the mod map in the editor before editing its
.hpmfile. - Open your mod’s
maps/sample_map/sample_map.hpmin a text editor. InsideGlobalSettings, replace itsEnvParticleselement with the following element frommaps/chapter02/02_03_delta/02_03_delta.hpm. - Reopen the mod map in
LevelEditor.exeand inspect the Env Particles tab. The texture is populated and the particles are active, whereas the bundled sample map stores an empty texture andActive="false".
<EnvParticles
Color="0.898438 0.959534 1 1"
Brightness="0.3"
BoxDistance="0.1"
GravityVelocity="0 0.01 0"
GravitySpeedRandomAmount="0"
WindVelocity="0 0 0"
WindSpeedRandomAmount="0"
WindDirRandomAmount="0"
RotateVelocity="0.005 0.005 0.005"
RotateSpeedRandomAmount="1"
RotateBothDirs="true"
NumIterations="2"
FadeInStart="0.1"
FadeInEnd="1"
FadeOutStart="10"
FadeOutEnd="16"
BoxSize="10"
NumParticles="3000"
ParticleSize="0.08 0.08"
SubDivUV="3 3"
AffectedByLight="false"
Texture="particles/underwater/materials/waterdust_tiny_3x3.dds"
Active="true"
/>
- Save the mod map and launch it. The particle field uses the small underwater-dust texture and the pale blue tint from the copied settings.
- Make one visible comparison in the Env Particles tab: turn Active off, save, and restart the map; then turn it on again and repeat. This checks the particle layer separately from fog and other effects. Use the development loop for restarting and reading errors.
Read the example
Texturereferences a shipped texture underparticles/underwater/materials/; it is a texture filename, not a.psparticle-system file.NumParticles="3000",ParticleSize="0.08 0.08"andSubDivUV="3 3"are Delta’s authored values. They are not a recommended count or a universal preset.GravityVelocity="0 0.01 0",WindVelocity="0 0 0"andRotateVelocity="0.005 0.005 0.005"are distinct motion parameters. The script API has separate setters for all three.- The fade-in begins at distance
0.1and finishes at1; fade-out begins at10and finishes at16. These are distance thresholds, not durations. The map helpers document their meaning, and the rendering shader computes their effect from particle depth.
Let a script change the field
Map scripts can change the particle field after the map loads. Include helpers/helper_map.hps alongside your existing map-script includes. The Delta map enables the field with:
Map_SetEnvironmentParticlesActive(true);
During its transition towards Theta Outside, the same stock script fades all matching particle layers to a new color and brightness:
Map_FadeEnvironmentParticleColor("*", cColor(0.295,0.556,0.59,1.0), 7);
Map_FadeEnvironmentParticleBrightness("*", 1, 7);
Here "*" selects all particle layers. The last argument is the fade duration; the Map Effects Handler accumulates elapsed update time for these fades. These calls alter existing layers rather than define their texture, particle count or box size.
If the particles disappear
- Check both the saved
Activevalue and map-script calls: stock SOMA scripts can enable or disable the field at runtime. - Check that the texture exists; the worked example uses
particles/underwater/materials/waterdust_tiny_3x3.dds. - Check the fade distances. A particle at the fully faded-out distance contributes no visible alpha.
- Check clipping when using water areas. The Liquid area definition exposes
EnvParticlesToClipfor naming the layers constrained to that area, and accepts wildcards and space-separated names.
Still to expand
The exact units and ranges for the motion and randomization controls, the meaning of Box Distance and iteration count, and a visually verified editor demonstration still need documentation. The stock values above establish an authored setup, not those undocumented semantics.