SWHC (File Format): Difference between revisions

From Retro Modding Wiki
Jump to navigation Jump to search
imported>Jackoalan
imported>Jackoalan
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{research|2|Key parameters need reverse-engineering}}
{{research|1|Properties beyond MP1 need to be discovered and documented}}
The '''SWHC''' [[Effect Script|effect script]] format is used to build swoosh effects in the ''Metroid Prime'' series.
The '''SWHC''' [[Particle Script|particle script]] format is used to build swoosh effects in the ''Metroid Prime'' series.
Swooshes are characterized as dynamically-generated, trailing ''triangle-strips'' "brushed" into space.
Swooshes are characterized as dynamically-generated triangles "brushed" into space.
 
Each swoosh system emits ''particle instances'' once per frame, connecting each new instance with the previous instance.
The system will not render until it has a history of ''at least'' 2 swoosh particles (2 frames of updates). Swoosh cross-sections may
form simple planes through space (<code>SIDE==2</code>) or extruded prism shapes (<code>SIDE>=3</code>).
 
To smooth out intra-frame geometry, vertices connecting particle instances may be calculated using [[wikipedia:Tricubic interpolation|tricubic interpolation]].
SPLN defines the number of subdivisions with which to perform interpolation.


== Properties ==
== Properties ==
Line 28: Line 35:
{{ParticlePropertyRow|COLR|ColorElement|Color|Particle Creation and Update|Modulation color of swoosh surfaces|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|COLR|ColorElement|Color|Particle Creation and Update|Modulation color of swoosh surfaces|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|SIDE|IntElement|Side Count|System Init|Count of swoosh cross-section sides (2 for plane, 3+ for extruded prism)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|SIDE|IntElement|Side Count|System Init|Count of swoosh cross-section sides (2 for plane, 3+ for extruded prism)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|IROT|FloatElement|Instance Rotation|Particle Creation|Rotation bias evaluated for new particle instances (in degrees)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|IROT|FloatElement|Initial Rotation|Particle Creation|Rotation bias evaluated for new particle instances (in degrees)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|ROTM|FloatElement|Rotation Master|Particle Update|Rotation bias evaluated per particle instance, per frame (in degrees)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|ROTM|FloatElement|Rotation Master|Particle Update|Rotation bias evaluated per particle instance, per frame (in degrees)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|POFS|VectorElement|Particle Offset|Particle Creation|Local translation bias evaluated for new particle instances|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|POFS|VectorElement|Particle Offset|Particle Creation|Local translation bias evaluated for new particle instances|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|IVEL|VectorElement|Particle Offset|Particle Creation|Relative velocity evaluated for new particle instances|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|IVEL|VectorElement|Initial Velocity|Particle Creation|Relative velocity evaluated for new particle instances|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|NPOS|VectorElement|Particle Offset|Particle Update|Local translation bias updated per particle instance, per frame|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|NPOS|VectorElement|Next Position|Particle Update|Local translation bias updated per particle instance, per frame|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VELM|ModVectorElement|Velocity 1|Particle Update|Continuous position and velocity source of particle instances|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VELM|ModVectorElement|Velocity 1|Particle Update|Continuous position and velocity source of particle instances|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VLM2|ModVectorElement|Velocity 2|Particle Update|Second position and velocity source evaluated after VELM|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VLM2|ModVectorElement|Velocity 2|Particle Update|Second position and velocity source evaluated after VELM|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
Line 38: Line 45:
{{ParticlePropertyRow|TEXR|UVElement|Texture|System Render|Texture and UV source for swoosh surfaces|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|TEXR|UVElement|Texture|System Render|Texture and UV source for swoosh surfaces|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|TSPN|IntElement|Texture Span|System Render|Count of particle instances over which to scale UV coordinate cycle|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|TSPN|IntElement|Texture Span|System Render|Count of particle instances over which to scale UV coordinate cycle|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|LLRD|BoolElement|Left Radius for Right|System Init|Use LRAD value for RRAD|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|LLRD|bool|Left Radius for Right|System Init|Use LRAD value for RRAD|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|CROS|BoolElement|Cross|System Init|Intersect surfaces across cross-section verts, as opposed to a non-intersecting prism|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|CROS|bool|Cross|System Init|Intersect surfaces across cross-section verts, as opposed to a non-intersecting prism|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VLS1|BoolElement|Local Velocity 1|System Init|Evaluate VELM in particle-local space|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VLS1|bool|Local Velocity 1|System Init|Evaluate VELM in particle-local space|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VLS2|BoolElement|Local Velocity 2|System Init|Evaluate VLM2 in particle-local space|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|VLS2|bool|Local Velocity 2|System Init|Evaluate VLM2 in particle-local space|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|SROT|BoolElement|Single Rotation|System Init|Update IROT per particle instance, per frame and ignore ROTM, otherwise once per system update|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|SROT|bool|Single Rotation|System Init|Update IROT per particle instance, per frame and ignore ROTM, otherwise once per system update|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|WIRE|BoolElement|Single Rotation|System Init|Render surfaces as triangle wireframe|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|WIRE|bool|Wireframe|System Init|Render surfaces as triangle wireframe|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|TEXW|BoolElement|{{unknown}}|System Init|Unused|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|TEXW|bool|{{unknown}}|System Init|Unused|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|AALP|BoolElement|Additive Alpha|System Init|Draw using additive alpha blending|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|AALP|bool|Additive Alpha|System Init|Draw using additive alpha blending|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|ZBUF|BoolElement|Z-buffer Update|System Init|Enable Z-buffer updates|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|ZBUF|bool|Z-buffer Update|System Init|Enable Z-buffer updates|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|ORNT|BoolElement|View Orient|System Init|Render surface facing view (2-SIDE only, no SPLN)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|ORNT|bool|View Orient|System Init|Render surface facing view (2-SIDE only, no SPLN)|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|CRND|BoolElement|View Orient|System Init|Use current CPU time for random seed, rather than 99|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
{{ParticlePropertyRow|CRND|bool|Clock Random|System Init|Use current CPU time for random seed, rather than 99|{{check}}|{{nocheck}}|{{nocheck}}|{{nocheck}}|{{nocheck}}}}
|}
|}

Latest revision as of 06:24, 8 June 2017

This file format is almost completely documented
Properties beyond MP1 need to be discovered and documented

The SWHC particle script format is used to build swoosh effects in the Metroid Prime series. Swooshes are characterized as dynamically-generated triangles "brushed" into space.

Each swoosh system emits particle instances once per frame, connecting each new instance with the previous instance. The system will not render until it has a history of at least 2 swoosh particles (2 frames of updates). Swoosh cross-sections may form simple planes through space (SIDE==2) or extruded prism shapes (SIDE>=3).

To smooth out intra-frame geometry, vertices connecting particle instances may be calculated using tricubic interpolation. SPLN defines the number of subdivisions with which to perform interpolation.

Properties

Particle generator properties are assembled into a particle script file tagged with SWSH. Any of the following properties are loaded into a description class for constructing an arbitrary number of particle generators.

FourCC Type Description Scope Notes MP1 MP2 MP3 DKCR DKCTF
PSLT IntElement Particle System Lifetime System Init Count of frames to emit new particle instances
TIME RealElement Time Multiplier Pre Particles Update Factor that defines number of evaluation frames per real frame
LRAD RealElement Left Radius Particle Update Radius of swoosh cross-section's left side
RRAD RealElement Right Radius Particle Update Radius of swoosh cross-section's right side
LENG IntElement Length System Init Maximum history of swoosh sections to retain (must be at least 2)
COLR ColorElement Color Particle Creation and Update Modulation color of swoosh surfaces
SIDE IntElement Side Count System Init Count of swoosh cross-section sides (2 for plane, 3+ for extruded prism)
IROT FloatElement Initial Rotation Particle Creation Rotation bias evaluated for new particle instances (in degrees)
ROTM FloatElement Rotation Master Particle Update Rotation bias evaluated per particle instance, per frame (in degrees)
POFS VectorElement Particle Offset Particle Creation Local translation bias evaluated for new particle instances
IVEL VectorElement Initial Velocity Particle Creation Relative velocity evaluated for new particle instances
NPOS VectorElement Next Position Particle Update Local translation bias updated per particle instance, per frame
VELM ModVectorElement Velocity 1 Particle Update Continuous position and velocity source of particle instances
VLM2 ModVectorElement Velocity 2 Particle Update Second position and velocity source evaluated after VELM
SPLN IntElement Spline Segments System Init Count of intra-frame faces to draw per particle connection, using tricubic spline interpolation
TEXR UVElement Texture System Render Texture and UV source for swoosh surfaces
TSPN IntElement Texture Span System Render Count of particle instances over which to scale UV coordinate cycle
LLRD bool Left Radius for Right System Init Use LRAD value for RRAD
CROS bool Cross System Init Intersect surfaces across cross-section verts, as opposed to a non-intersecting prism
VLS1 bool Local Velocity 1 System Init Evaluate VELM in particle-local space
VLS2 bool Local Velocity 2 System Init Evaluate VLM2 in particle-local space
SROT bool Single Rotation System Init Update IROT per particle instance, per frame and ignore ROTM, otherwise once per system update
WIRE bool Wireframe System Init Render surfaces as triangle wireframe
TEXW bool Unknown System Init Unused
AALP bool Additive Alpha System Init Draw using additive alpha blending
ZBUF bool Z-buffer Update System Init Enable Z-buffer updates
ORNT bool View Orient System Init Render surface facing view (2-SIDE only, no SPLN)
CRND bool Clock Random System Init Use current CPU time for random seed, rather than 99