Particle Effects

From Wolfire Games Wiki
(Redirected from Effects System)
Jump to: navigation, search

There isn't much information released about Overgrowth's particle system. Running or jumping on the ground creates small dust clouds at the characters' feet, and particle streams were added in A128 along with blood dripping. Particles are controlled through scripts, examples below.

Simple Particle Example

MakeParticle("Data/Particles/impactfast.xml",pos,vec3(0.0f));

Particle Stream Example

float blood_force = sin(time*_spurt_frequency)*0.5f+0.5f;
uint32 id = MakeParticle("Data/Particles/blooddrop.xml",bleed_pos,(head_transform*vec3(0.0f,blood_amount*blood_force,0.0f)+this_mo.velocity));
if(last_blood_particle_id != 0){
   ConnectParticles(last_blood_particle_id, id);
}
last_blood_particle_id = id;

File Structure

There appear to be two different kinds of particles. Both are defined by an .xml file, however, one version is based on a video file, while the other is based on a static texture.

OGV-Based

One Particle Effect is based on .ogv files found under Data/Textures/anims/ (though they are not referenced as .ogv but as .xml files in the Particle XML)

This format is deprecated and no longer works.

<?xml version="1.0" ?>
<particle>
    <textures animation_effect = "Data/Textures/anims/bigexplosion.xml"
              shader = "theorabluescreen"
              soft_shader = "theorabluescreensoft"/>
    <size val="40.0"/>
    <color red =   "1.0"
           green = "1.0"
           blue =  "1.0"
           alpha = "1.0"/>
    <behavior inertia="1.0" gravity="0.0" wind="0.0" size_decay_rate="0.0" opacity_decay_rate="0.0"/>
    <no_rotation />
</particle>

<textures/> - This tag has 3 attributes.

  • animation_effect - this is the only attribute specific to ogv-based particles and references the file path, starting from the Data folder, to a video file. NOTE: for some reason, as of a209, the files referenced are xml format, however all files under Data/Textures/anims/ are ogv format. Is the reference is a typo?
  • shader - the name (not including file extension, typically .frag) of the shader in folder Data/GLSL/
  • soft_shader - The shader used when soft particles are on, usually just the name of the shader with the word "soft" appended to the end.

<size/> - This tag uses the attribute "val" (floating point number) to specify the size of the particle. Can also be defined by "min" and "max" attributes, see Texture-Based Particle below NOTE: Units are unknown

<color/> - This tag has a varying number of attributes, one for each channel (RGB + Alpha), while the Alpha Channel may be defined as a range, requiring two attributes, alpha_min and alpha_max Range? perhaps floating point values from 0.0 to 1.0

<behavior/> - This tag has 5 attributes.

  • inertia - If this is 1.0 the particle retains all speed, the lower the value the more the particle slows down over time
  • gravity - Degree with which a downwards gravitational force acts upon the particle
  • wind - Degree with which wind effects the particle vector
  • size_decay_rate - Rate at which the size of the particle decreases per second.
  • opacity_decay_rate - Rate at which the alpha channel values of the particle decreases in seconds.

Texture-Based

<?xml version="1.0" ?>
<particle>
    <textures color_map = "Data/Textures/smoke.tga" 
              normal_map = "Data/Textures/smoke_normal.tga"
              shader = "litsprite"
              soft_shader = "litspritesoft"/>
    <size min = "0.4" max = "0.7"/>
    <color red =   "0.5"
           green = "0.5"
           blue =  "0.5"
           alpha_min = "0.5" alpha_max = "1.0"/>
    <behavior inertia="0.9" gravity="0.0" wind="1.0" size_decay_rate="0.0" opacity_decay_rate="0.0"/>
    <quadratic_expansion speed="4.0"/>
    <quadratic_dispersion persistence="1.0"/>
</particle>

<textures/> - With texture-based particles, the "animation_effect" attribute has been replaced by two different ones

  • color_map - Path to a file in .tga format. Note: Constraints? Do textures need to be square, does their size need to be a power of two?
  • normal_map - Path to a file in .tga format.

Relevant blog posts

A summary of most blog posts explaining Overgrowth's graphical features, focusing on more technical details. There are additional links below, some of which are not mentioned in the summary.

http://blog.wolfire.com/2008/12/object-lighting-part-1/ http://blog.wolfire.com/2010/02/Gamma-correct-lighting

http://blog.wolfire.com/2009/09/character-rim-lighting/ http://blog.wolfire.com/2009/10/character-normal-maps/ http://blog.wolfire.com/2009/09/soft-normal-maps-for-fur/

http://blog.wolfire.com/2009/09/trees-in-the-breeze/ http://blog.wolfire.com/2010/10/Imposters

http://blog.wolfire.com/2009/05/decals-editor-part-one/ http://blog.wolfire.com/2009/05/decals-editor-part-two/ http://blog.wolfire.com/2009/06/decals-editor-part-three/