Difference between revisions of "Particle Effects"

From Wolfire Games Wiki
Jump to: navigation, search
(New page: = Particle Effects = 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 parti...)
 
(OGV-Based: Removed information about the floats being between 1 and 0, corrected explanation of how inertia works.)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Particle Effects =
+
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 [http://blog.wolfire.com/2011/04/Overgrowth-a128-video-changelog A128] along with blood dripping. Particles are controlled through scripts, examples below.
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 [http://blog.wolfire.com/2011/04/Overgrowth-a128-video-changelog A128] along with blood dripping. Particles are controlled through scripts, examples below:
 
  
== Simple Particle Example ==
+
==Simple Particle Example==
 +
<pre>
 +
MakeParticle("Data/Particles/impactfast.xml",pos,vec3(0.0f));
 +
</pre>
  
            MakeParticle("Data/Particles/impactfast.xml",pos,vec3(0.0f));
+
==Particle Stream Example==
  
== Particle Stream Example ==
+
<pre>
            float blood_force = sin(time*_spurt_frequency)*0.5f+0.5f;
+
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));
+
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){
+
if(last_blood_particle_id != 0){
                ConnectParticles(last_blood_particle_id, id);
+
  ConnectParticles(last_blood_particle_id, id);
            }
+
}
            last_blood_particle_id = id;
+
last_blood_particle_id = id;
 +
</pre>
  
= Post Processing Effects =  
+
==File Structure==
''Post processing effects are image filters that are applied as a final step before each rendered frame is drawn to the screen -- much like Photoshop filters.'' This explanation is lifted word-for-word from David's blog post on the subject. He doesn't go into much detail about it in his blog posts, but here's links to [http://blog.wolfire.com/2009/04/post-processing-part-one/ part one] and [http://blog.wolfire.com/2009/04/post-processing-part-two/ part two] any way.
+
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.
  
= Shaders =
+
===OGV-Based===
Overgrowth uses GLSL shader language, and the users can create custom shaders. Some blog posts explain how some of the shaders work, such as the posts about [http://blog.wolfire.com/2008/12/object-lighting-part-1/ Object Lightning], [http://blog.wolfire.com/2009/09/character-rim-lighting/ Character Rim Lighting] and [http://blog.wolfire.com/2009/09/trees-in-the-breeze/ Trees in the Breeze]. Overgrowth's character animation is also done through a shader, as David mentioned in [http://blog.wolfire.com/2009/10/character-normal-maps/#comment-18448230 a blog comment].
+
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)
  
            The skeletal animation is done in the vertex shader anyway, so it's actually
+
<!--bigexplosion.xml-->
            faster and smoother-looking to just apply the bone matrices to the object-space
+
<pre>
            normal map than it is to recalculate transformed normals and tangents for
+
<?xml version="1.0" ?>
            each vertex.
+
<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>
 +
</pre>
  
= Motion Blur for Weapons =
+
'''<textures/>''' - This tag has 3 attributes.
Overgrowth's weapons use motion blur based on stippling. Stippling is also used to render soft shadows, and the technique of stippling is explained in [http://blog.wolfire.com/2009/10/transparent-shadows-using-stippling/ this old blog post]. The motion blur for weapons works by drawing the weapon several times along it spath using different stipple patterns for each instance, as mentioned in the [http://blog.wolfire.com/2011/06/Overgrowth-a135-video-changelog A135 video].  
+
* 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===
 +
 
 +
<!--bloodcloud.xml-->
 +
<pre>
 +
<?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>
 +
</pre>
 +
 
 +
'''<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 =
 
= Relevant blog posts =
Line 46: Line 98:
 
http://blog.wolfire.com/2009/05/decals-editor-part-two/
 
http://blog.wolfire.com/2009/05/decals-editor-part-two/
 
http://blog.wolfire.com/2009/06/decals-editor-part-three/
 
http://blog.wolfire.com/2009/06/decals-editor-part-three/
 +
 +
[[Category: Tutorials]]
 +
[[Category: Modding]]
 +
[[Category: Overgrowth]]

Latest revision as of 12:46, 11 September 2015

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)

<?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/