1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"[]> 2<html xml:lang="en-US" lang="en-US"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/document.css" type="text/css" /> 7 <title>Basic Particle Features</title> 8 </head> 9 <body> 10 <h1>Features Used in Particle Calculations</h1> 11 <div class="section"> 12 <h2><a name="animframe" id="animframe"></a>Animation Frame Control</h2> 13 <p><a href="../../../nw/gfx/ParticleModel/Overview.html">ParticleModel</a> and <a href="../../../nw/gfx/ParticleEmitter/Overview.html">ParticleEmitter</a> both store <a href="../../../nw/anim/AnimFrameController/Overview.html">nw::anim::AnimFrameController</a>. <br /> They can be obtained using the ParticleAnimFrameController function.</p> 14 <p>Time can be advanced by making a set setting (SetStepFrame) and updating the frame (UpdateFrame).<a href="../../../nw/anim/AnimFrameController/SetStepFrame.html"> To advance to a particular frame, apply an offset from the previous frame to the animation. Depending on the animation type, values may differ when advancing one frame at a time.</p> 15 <p>In addition, the emitter emits for the amount of time that has advanced since an update was last called. A large volume of particles is therefore emitted if many frames are suddenly advanced at once.</p> 16 <p>This is not supported for reverse playback (where frame numbers are decreased).</p> 17 <h2><a name="deleteall" id="deleteall"></a>Deleting All Particles</h2> 18 <p>When <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>* particleSet is set for a <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>,<br />Particles are deleted using particleSet-><a href="../../../nw/gfx/ParticleSet/ClearParticleCollection.html">ClearParticleCollection()</a>;<br /></p> 19 <p>When <a href="../../../nw/gfx/ParticleModel/Overview.html">ParticleModel</a>* particleModel is set for a <br />ParticleModel<a href="../../../nw/gfx/ParticleModel/Overview.html">,</a>Particles are deleted using particleModel-><br />ForeachParticleSet<a href="../../../nw/gfx/ParticleModel/ForeachParticleSet.html">(</a>ParticleSetsClear<a href="../../../nw/gfx/ParticleSetsClear/Overview.html">());</p> 20 <p><strong>Note</strong></p> 21 <p>The clear function initializes streams. Just as when destryong a class, this function can only be used when there is no stream access from the GPU. This function is used for the purpose of initialization when re-using a class no longer being used. </p> 22 <h2><a name="destroytiming" id="destroytiming"></a>Destroying Classes</h2> 23 <p>If <a href="../../../nw/gfx/SceneNode/DetachChild.html">DetachChild</a> is executed from <a href="../../../nw/gfx/SceneNode/Overview.html">SceneNode</a> and <span>nw::gfx::SceneNode::TraverseScene</span> is invoked when removing <a href="../../../nw/gfx/ParticleEmitter/Overview.html">ParticleEmitter</a> and <a href="../../../nw/gfx/ParticleModel/Overview.html">ParticleModel</a> from the scene tree, calculations and rendering will stop being performed.</p> 24 <p>Finally, care is required when destroying a class to free memory.</p> 25 <p>After issuing drawing commands, do not free memory until the drawing is actually complete. If only a drawing command is issued, there is still a possibility of GPU access, and sometimes the GPU does not function correctly depending on the content of memory.<BR> The same goes for textures. </p> 26<h2><a name="changeresource" id="changeresource"></a>Changing Resource Parameters</h2> 27 <p>If you want to apply an effect to all nodes created from the same resource, you can change them by obtaining the resource and directly accessing associated parameters.</p> 28 <p>If you want to apply an effect to only one node out of all nodes created from the same resource, copy the resource for that node and manipulate the copied resource.<br /> Resources can be copied automatically at time of node creation. If the IsResourceCopyEnable flag inside a resource is set before node creation, that resource is copied and stored at the time of node creation.<br /> If the copied resource is for a given created node node only and that node is destroyed, the copied resource is also destroyed. Therefore, be sure to pay attention to the node's duration of existence when using a copied resource outside a node. In addition, since the original resource is also accessed even if it has been copied, be sure to carry out resource management as usual for the original resource. <br /> Flags can be set ahead of time in the CreativeStudio UI. Set the flags for the following resources appropriately, when making changes after loading resources with an application. Resources that include IsResourceCopyEnabled</p> 29 <ul> 30 <li><a href="../../../nw/gfx/res/ResParticleEmitter/Overview.html">ResParticleEmitter</a></li> 31 <li><a href="../../../nw/gfx/res/ResParticleForm/Overview.html">ResParticleForm</a></li> 32 <li><a href="../../../nw/gfx/res/ResParticleInitializer/Overview.html">ResParticleInitializer</a></li> 33 <li><a href="../../../nw/gfx/res/ResParticleUpdater/Overview.html">ResParticleUpdater</a></li> 34 </ul> 35 <p>APIs for getting copied resources</p> 36 <ul> 37 <li><a href="../../../nw/gfx/ParticleEmitter/GetResParticleEmitterParameterCopy.html">ParticleEmitter::GetResParticleEmitterParameterCopy</a></li> 38 <li><a href="../../../nw/gfx/ParticleEmitter/GetResParticleFormCopy.html">ParticleEmitter::GetResParticleFormCopy</a></li> 39 </ul> 40 <p>By specifying true as an argument to these API functions, you can get resources that are only valid when being copied for use by a node. If it only has shared resources, IsValid() returns false. The default value of the API function arguments is false. If false is specified, resources can be obtained while prioritizing use by nodes, but if there are none, the function returns the shared resource.</p> 41<p>A list of management information for initializers/updaters can be obtained using the <a href="../../../nw/gfx/ParticleSet/GetInitializers.html">GetInitializers</a> and <a href="../../../nw/gfx/ParticleSet/GetUpdaters.html">GetUpdaters</a> functions of <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>. </p> 42<h3>Notes on Changing Emission Volume, Lifespan, Etc.</h3> 43<p>Pay attention to possible memory shortages with <a href="../../../nw/gfx/ParticleCollection/Overview.html">ParticleCollection</a> when making changes to parameters (such as the emission volume, emission interval, and lifespan) that will change the number of particles that exist simultaneously. Memory capacity cannot be changed after nodes are created. Be sure to make any changes to values in <span>nw::gfx::Res::ResParticleCollection</span> before creating nodes.</p> 44<p>In addition to changing memory capacity at run-time, you can also allocate the maximum number of bytes anticipated ahead of time using CreativeStudio.</p> 45<p>If there is a memory shortage, some particles that should have been emitted won't be. Once a particles has failed to be emitted it will no longer be generated at all, even if a spot opens for it due to another particle disappearing. A particle borne after the spot opens will be emitted. This can make it appear that particles are being emitted intermittently.</p> 46<h2><a name="changestream" id="changestream"></a>Changing Particle Information</h2> 47 <p>Since most particle information is passed directly to the GPU shader, it's hard to manage a program built to reflect the internal implementation. A degree of knowledge regarding the internal structure is required for an application to change this information. Here's the explanation for this.</p> 48 <p>Included in particle information are streams that can include different values for each particle and fixed-value parameters in <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>.</p> 49 <p>Whether particle information is a parameter or a stream is determined by optimization of the binary output from CreativeStudio. </p> 50 <h3><a name="optimizestream" id="optimizestream"></a>Conditions for Optimizing Streams to Parameters</h3> 51 <p>If all of the following conditons are satisfied, the Initializer is deleted and the stream is also output as parameters (fixed-value).</p> 52 <ul> 53 <li>The type must be one of: Color, Alpha, TextureScale0, TextureRotate0,TextureTranslate0, Scale, ScaleExt, Rotate, or Life</li> 54 <li>There must be no updater for the target stream</li> 55 <li>Target stream initialize results must be a constant </li> 56 </ul> 57 <p>In addition to the distinction between parameters and streams, there is also a distinction between information that is used only in calculations by the CPU and information (VBO and vertex parameters) directly handled by the shader. This information is divided up at run-time depending on the attribute type. A double buffer is used for vertex attributes. A single buffer is used for other information.</p> 58 <h3>Handling Attribute Types at Runtime</h3> 59 <table border="1"> 60 <tr> 61 <th scope="col">Type</th> 62 <th scope="col">Role</th> 63 <th scope="col">Type</th> 64 <th scope="col">Parameter Availability</th> 65 <th scope="col">Vertex Attribute?</th> 66 </tr> 67 <tr> 68 <th scope="row">TRANSLATE</th> 69 <td>Location (local coordinate system)</td> 70 <td><CODE>VEC3</CODE></td> 71 <td>Stream only</td> 72 <td>Vertex attribute</td> 73 </tr> 74 <tr> 75 <th scope="row">SCALE</th> 76 <td>Scale (local coordinate system)</td> 77 <td><CODE>VEC3</CODE></td> 78 <td>Stream/Parameter</td> 79 <td>Vertex attribute</td> 80 </tr> 81 <tr> 82 <th scope="row">ROTATE</th> 83 <td>Rotation (local coordinate system)</td> 84 <td><CODE>VEC3</CODE></td> 85 <td>Stream/Parameter</td> 86 <td>Vertex attribute</td> 87 </tr> 88 <tr> 89 <th scope="row">COLOR</th> 90 <td>RGB Color</td> 91 <td><CODE>VEC3</CODE></td> 92 <td>Stream/Parameter</td> 93 <td>Vertex attribute</td> 94 </tr> 95 <tr> 96 <th scope="row">ALPHA</th> 97 <td>Alpha</td> 98 <td>f32</td> 99 <td>Stream/Parameter</td> 100 <td>Vertex attribute</td> 101 </tr> 102 <tr> 103 <th scope="row">TEXTURETRANSLATE0</th> 104 <td>Texture coordinate translation.</td> 105 <td><CODE>VEC2</CODE></td> 106 <td>Stream/Parameter</td> 107 <td>Vertex attribute</td> 108 </tr> 109 <tr> 110 <th scope="row">TEXTURESCALE0</th> 111 <td>Texture coordinate scale.</td> 112 <td><CODE>VEC2</CODE></td> 113 <td>Stream/Parameter</td> 114 <td>Vertex attribute</td> 115 </tr> 116 <tr> 117 <th scope="row">TEXTUREROTATE0</th> 118 <td>Texture coordinate rotation.</td> 119 <td>f32</td> 120 <td>Stream/Parameter</td> 121 <td>Vertex attribute</td> 122 </tr> 123 <tr> 124 <th scope="row">SCALE_EXT</th> 125 <td>Scale (extended)</td> 126 <td><CODE>VEC3</CODE></td> 127 <td>Stream/Parameter</td> 128 <td>Vertex attribute</td> 129 </tr> 130 <tr> 131 <th scope="row">BIRTH</th> 132 <td>Date created.</td> 133 <td>ParticleTime</td> 134 <td>Stream only</td> 135 <td>-</td> 136 </tr> 137 <tr> 138 <th scope="row">LIFE</th> 139 <td>Lifetime</td> 140 <td>ParticleTime</td> 141 <td>Stream/Parameter</td> 142 <td>-</td> 143 </tr> 144 <tr> 145 <th scope="row">VELOCITY</th> 146 <td>Speed</td> 147 <td><CODE>VEC3</CODE></td> 148 <td>Stream only</td> 149 <td>-</td> 150 </tr> 151 <tr> 152 <th scope="row">ACTIVEINDEX</th> 153 <td>Indirect reference index to the element in use.</td> 154 <td>u16</td> 155 <td>Stream only</td> 156 <td>Vertex attribute</td> 157 </tr> 158 <tr> 159 <th scope="row">FREEINDEX</th> 160 <td>Indirect reference index to a usable element.</td> 161 <td>u16</td> 162 <td>Stream only</td> 163 <td>-</td> 164 </tr> 165 <tr> 166 <th scope="row">NGE_TIMELIMIT</th> 167 <td>Negative number (for speedup purposes) indicates the time when the particle should disappear.</td> 168 <td>ParticleTime</td> 169 <td>Stream only</td> 170 <td>-</td> 171 </tr> 172 </table> 173 <p> </p> 174 <h3>Changing Values</h3> 175<p>There are four methods of changing values. The one to use differs depending on whether information is a stream or parameter and whether it's a vertex attribute or other information.</p> 176<p>For a sample implementation, see <a href="../demo/ParticleChangeVtxDemo.html">ParticleChangeVtxDemo</a>.</p> 177<h4>Changing parameters</h4> 178<p>Overwrite parameters using <span>nw::gfx::ParticleCollection::SetParameter</span>. In the case of LIFE, overwriting is also possible using ParticleColection::SetLifeParameter. (Recommended.)</p> 179<p>In the case of non-vertex parameters (LIFE only), only content of memory pointed to by the parameter pointer obtained by ParticleCollection::GetParameterPtr can be re-written. Because a single-buffer is used, the content of both PARTICLE_BUFFER_FRONT and PARTICLE_BUFFER_BACK is the same.</p> 180<p>In the case of vertex attribute parameters, in addition to the content of memory pointed to by the parameter pointer obtained by ParticleCollection::GetParameterPtr, commands already created can be re-written. Because commands are double-buffered, only one side of the buffer can be re-written per call. Note that a command that does not specify a buffer does not re-write anything. There may be some difference between the contents of the address obtained using <a href="../../../nw/gfx/ParticleCollection/GetParameterPtr.html">ParticleCollection::GetParameterPtr<br /> and command double-buffer status. Although PARTICLE_BUFFER_FRONT/PARTICLE_BUFFER_BACK can be specified, do not change PARTICLE_BUFFER_BACK at any time a command may be issued to the GPU. Essentially, you should not write to PARTICLE_BUFFER_BACK at all because this timing is hard to grasp.<BR> 181</p> 182<p>Moreover, inside the library, parameters are never changed after commands are created.<BR> 183</p> 184<h4>Changing streams</h4> 185 <p>Streams can be obtained using <a href="../../../nw/gfx/ParticleCollection/Overview.html">ParticleCollection</a>::<a href="../../../nw/gfx/ParticleCollection/GetStreamPtr.html">GetStreamPtr</a>. If NULL is returned, either the arguments are wrong or the specified class is being used as a parameter.</p> 186 <p>In general, obtain the stream from PARTICLE_BUFFER_FRONT. </p> 187 <p>The obtained stream is an array of types determined based on the class. The maximum number of entries that can be stored in the array can be obtained using the <a href="../../../nw/gfx/ParticleCollection/Overview.html">ParticleCollection</a>::<a href="../../../nw/gfx/ParticleCollection/GetStreamPtr.html">GetStreamPtr</a> function. This stream is not necessarily used padded from the start. An index that can be obtained by the PARTICLEUSAGE_ACTIVEINDEX class must be used.</p> 188 <p>See <a href="../demo/ParticleUpdaterDemo.html">ParticleUpdaterDemo</a> for a sample implementation of making changes using UserUpdater.</p> 189<h3>Getting ACTIVEINDEX</h3> 190 <p>This section describes how to get ACTIVEINDEX, which is required to access streams.</p> 191 <p>ACTIVEINDEX is used as the vertex index of DrawElements as a VBO. Applications cannot re-write this value because it affects various internal elements.</p> 192 <p>Although ACTIVEINDEX is usually stored starting from the start in the order created, if the rendering order is reversed (ResParticleShapeBuilder::IsAscendingOrder), it is stored starting from the end. The number of valid instances can be obtained using <a href="../../../nw/gfx/ParticleCollection/Overview.html">ParticleCollection</a>::<a href="../../../nw/gfx/ParticleCollection/GetCount.html">GetCount()</a>.</p> 193<p>Basically, obtain streams from PARTICLE_BUFFER_FRONT, but obtain them from PARTICLE_BUFFER_BACK when getting PARTICLEUSAGE_ACTIVEINDEX inside UserUpdater. Even then, be sure to get all information other than ACTIVEINDEX from FRONT.</p> 194 <p>This requirement is due to the following process flow.</p> 195 <ol> 196 <li>Particle creation (AddParticles/InitializeParticles) </li> 197 <ul> 198 <li>Create new particles in the available region of FRONT</li> 199 </ul> 200 <li>Perform update processing (UpdateParticles) 201 </li> 202 </ol> 203 <ol> 204 <ol> 205 <li>Swap FRONT and BACK by swapping buffers.</li> 206 <li>Copy the VBO stream other than ACTIVEINDEX from BACK to FRONT.</li> 207 <li>Perform update processing (UserUpdater is called here).</li> 208 <li>In the delete due to lifespan process, delete unnecessary particles from BACK and arrange in FRONT.</li> 209 </ol> 210 </ol> 211 <p>Because the deletion process overlaps copying of the stream, ACTIVEINDEX used by UserUpdater must be obtained from BACK.<br /> Do not overwrite contents because rendering for BACK may be in progress.</p> 212 <h2>Particle Memory Usage</h2> 213 <p>This section describes the memory used per particle as of NintendoWare 1.0.1.</p> 214 <p>Because particles are drawn by passing memory that stores particle information directly to the GPU, values are handled as floating point numbers. (This is done because quantizing multiple attributes increases the processing load on the GPU.)</p> 215 <table border="1"> 216 <tr> 217 <th scope="col">Type</th> 218 <th scope="col">Role</th> 219 <th scope="col">Size</th> 220 <th scope="col">Omittability</th> 221 <th scope="col">Number of buffers</th> 222 </tr> 223 <tr> 224 <th scope="row">TRANSLATE</th> 225 <td>Location (local coordinate system)</td> 226 <td>12 bytes</td> 227 <td>×</td> 228 <td>2</td> 229 </tr> 230 <tr> 231 <th scope="row">SCALE</th> 232 <td>Scale (local coordinate system)</td> 233 <td>12 bytes</td> 234 <td>○</td> 235 <td>2</td> 236 </tr> 237 <tr> 238 <th scope="row">ROTATE</th> 239 <td>Rotation (local coordinate system)</td> 240 <td>12 bytes</td> 241 <td>○</td> 242 <td>2</td> 243 </tr> 244 <tr> 245 <th scope="row">COLOR</th> 246 <td>RGB Color</td> 247 <td>12 bytes</td> 248 <td>○</td> 249 <td>2</td> 250 </tr> 251 <tr> 252 <th scope="row">ALPHA</th> 253 <td>Alpha</td> 254 <td>4 bytes</td> 255 <td>○</td> 256 <td>2</td> 257 </tr> 258 <tr> 259 <th scope="row">TEXTURETRANSLATE0</th> 260 <td>Texture coordinate translation.</td> 261 <td>8 bytes</td> 262 <td>○</td> 263 <td>2</td> 264 </tr> 265 <tr> 266 <th scope="row">TEXTURESCALE0</th> 267 <td>Texture coordinate scale.</td> 268 <td>8 bytes</td> 269 <td>○</td> 270 <td>2</td> 271 </tr> 272 <tr> 273 <th scope="row">TEXTUREROTATE0</th> 274 <td>Texture coordinate rotation.</td> 275 <td>12 bytes</td> 276 <td>○</td> 277 <td>2</td> 278 </tr> 279 <tr> 280 <th scope="row">SCALE_EXT</th> 281 <td>Scale (extended)</td> 282 <td>12 bytes</td> 283 <td>○</td> 284 <td>2</td> 285 </tr> 286 <tr> 287 <th scope="row">BIRTH</th> 288 <td>Date created.</td> 289 <td>4 bytes</td> 290 <td>×</td> 291 <td>1</td> 292 </tr> 293 <tr> 294 <th scope="row">LIFE</th> 295 <td>Lifetime</td> 296 <td>4 bytes</td> 297 <td>○</td> 298 <td>1</td> 299 </tr> 300 <tr> 301 <th scope="row">VELOCITY</th> 302 <td>Speed</td> 303 <td>12 bytes</td> 304 <td>×</td> 305 <td>1</td> 306 </tr> 307 <tr> 308 <th scope="row">ACTIVEINDEX</th> 309 <td>Indirect reference index to the element in use.</td> 310 <td>2 bytes</td> 311 <td>×</td> 312 <td>2</td> 313 </tr> 314 <tr> 315 <th scope="row">FREEINDEX</th> 316 <td>Indirect reference index to a usable element.</td> 317 <td>2 bytes</td> 318 <td>×</td> 319 <td>1</td> 320 </tr> 321 <tr> 322 <th scope="row">NGE_TIMELIMIT</th> 323 <td>Negative number (for speedup purposes) indicates the time when the particle should disappear.</td> 324 <td>4 bytes</td> 325 <td>×</td> 326 <td>1</td> 327 </tr> 328 </table> 329 <p>50 bytes if all omittable items can be omitted. 210 bytes if they could not all be omitted.</p> 330 <p>The number of bytes specified for "work memory at runtime" under CreativeStudio will be allocated per ParticleSet.</p> 331 <p>Memory used by main classes (main base classes are given in parentheses)</p> 332 <table border="1"> 333 <tr> 334 <th scope="col"></th> 335 <th scope="col">sizeof(values in parentheses are for version 1.1)</th> 336 </tr> 337 <tr> 338 <th scope="row"><CODE>ParticleModel</CODE></th> 339 <td>636 (564)</td> 340 </tr> 341 <tr> 342 <th scope="row"><CODE>ParticleSet</CODE></th> 343 <td>144 (136)</td> 344 </tr> 345 <tr> 346 <th scope="row">ParticleCollection</th> 347 <td>444 (436)</td> 348 </tr> 349 <tr> 350 <th scope="row"><CODE>ParticleShape</CODE></th> 351 <td>528 (516)</td> 352 </tr> 353 <tr> 354 <th scope="row"><CODE>ParticleEmitter</CODE></th> 355 <td>400 (388)</td> 356 </tr> 357 <tr> 358 <th scope="row">(SceneObject)</th> 359 <td>12 (12)</td> 360 </tr> 361 <tr> 362 <th scope="row">(SceneNode)</th> 363 <td>80 (72)</td> 364 </tr> 365 <tr> 366 <th scope="row">(TransformNode)</th> 367 <td>336 (324)</td> 368 </tr> 369 <tr> 370 <th scope="row">(Model)</th> 371 <td>556 (508)</td> 372 </tr> 373 </table> 374 <p>In addition, memory for pointers such as to materials, the command cache, and children is also allocated.</p> 375 <p>1296 bytes per ParticleShape is allocated for the command cache to be used for particles.</p> 376 <p></p> 377<h2><a name="layer" id="layer"></a>Processing When Using Hierarchical Structures</h2> 378 <p>When a particle is born, its position is determined by the emitter. However, coordinate conversion is performed so that its position does not shift when passed to the particle model. In other words, regardless of how the hierarchy is arranged, emitted particles appear in the emitter position at this point.</p> 379 <p>After emission, particles are drawn using the model coordinate system.</p> 380 <p>As an exceptional option for hierarchical structures, particle sets include an option for forcing the use of the world coordinate system. If this option is specified, the world coordinate system is used for the particle set regardless of the hierarchical structure. In other words, status is the same as if there was no hierarchical structure.</p> 381 <h2><a name="userupdater" id="userupdater"></a>User Updater</h2> 382 <p>An updater is a processing unit used to perform particle animations for <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>. Mechanisms that can be added to a user-defined updater have been prepared in the library. Use of these mechanisms allows features not provided by the library to be used by an application.<br /> <a ref="../demo/ParticleUpdaterDemo.html">ParticleUpdaterDemo<a href="../demo/ParticleUpdaterDemo.html"> is a sample demo of a user-defined updater.</p> 383 <div> 384 <h3>Preparing resources</h3> 385 </div> 386 <p>The resource <a href="../../../nw/gfx/res/ResParticleUserUpdater/Overview.html">ResParticleUserUpdater</a> is supported for user updaters. A user process is called as a callback when processing of this resource is performed by <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>.</p> 387 <p>Currently, intermediate files created using CreativeStudio are not supported by <a href="../../../nw/gfx/res/ResParticleUserUpdater/Overview.html">ResParticleUserUpdater</a>. To add a user-defined updater, add the following to the ParticleUpdaters list in the intermediate file: <br /> <ParticleUserUpdaterXml IsUpdaterEnabled="true" UserParameter="0"><br /> <ParticleAnimationData /><br /> <TargetStreams /><br /> </ParticleUserUpdaterXml><br /> Although the addition and deletion of user updaters is not supported by CreativeStudio, reading and writing of intermediate files, binary output, and viewing of contents are possible. ParticleUserUpdater is a setting for each <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>.</p> 388 <div> 389 <h3>Using User-defined Updaters with Applications</h3> 390 </div> 391 <p>Search for updaters supported by <a href="../../../nw/gfx/res/ResParticleUserUpdater/Overview.html">ResParticleUserUpdater</a> from among updaters for the created <a href="../../../nw/gfx/ParticleSet/Overview.html">ParticleSet</a>, and set a user-defined function pointer for updater.work.</p> 392 <p>For details, see how the SetUserUpdater function is used in <a href="../demo/ParticleUpdaterDemo.html">ParticleUpdaterDemo</a>.</p> 393 <h2>Emission volume from an emitter</h2> 394 <p>This section gives an overview of parameters related to emitter emission and what they mean.</p> 395 <h3>Emission timing</h3> 396 <p>First, the basic concept is summed up as follows:</p> 397 <ul> 398 <li>Emission is calculated for integral frames. </li> 399 <li>Actual emission is carried out at time of evaluation and treated as if born at that time.</li> 400 </ul> 401<p>This is the fundamental concept. </p> 402<p>This timing provides an opportunity at the integral frame level to control emission based on whether the actual time has exceeded this timing.<BR> Evaluation is performed during actual calculations. Particles emitted between the last evaluation and the next are all treated as if born at time of evaluation. For example, consider a particle set to be emitted each frame and a playback rate of 2.0. In this case, double emission will take place once every two frames. There is no need to consider the time difference of unevaluated frames.</p> 403<p>There is no opportunity for emission with an emission period of 0. With an emission period of 1, there is only one chance for generation (the first frame).</p> 404<p>The emitter stores the timing for the next emission an updates information during emission processing.<BR> Timing for the next emission is given by the following formula.</p> 405<p>(int)(emission_interval * (1.0f + emission_interval_random * random_number_between(-1.0f, +1.0f))</p> 406<p>This is calculated to find the time of next emission. However, if the calculated value is less than 1, 1 is used. This means there is no emission until the next frame even if a random number is included.</p> 407<h3>Emit Volume</h3> 408 <p>The following calculation is performed at each time of emission.</p> 409 <p>emission_volume * (1.0f + emission_volume_random * random_number_between(-1.0f, +1.0f))</p> 410 <p> The integer part of the accumulated value is the number of particle to be emitted at time of evaluation. </p> 411 <p>As an exception, an emission volume less than 1 is handled as 1 at time of first evaluation if the emitter's emission volume exceeds 0. This is due to the fact that, even though it may take a long time to accumulate a value of 1 given emission volume values less than 1, there are many cases where you want to emit exactly one particle in the first frame.<BR> If this operation bothers you, either make it so that the emitter is not evaluated until actual time of emission or control things so the emission volume is 0.</p> 412 </div> 413 <hr><p>CONFIDENTIAL</p></body> 414</html> 415