How to Boost Visuals Using Particles in Unreal Engine*

How to Boost Visuals Using Particles in Unreal Engine*

By | December 3rd, 2018
No Comments on How to Boost Visuals Using Particles in Unreal Engine*

Boost Visuals with Particle Parameters in Unreal Engine* 4

<p>Particle parameters are a powerful system built into the Unreal

Engine* that allows the customization of particle systems outside of Unreal

Engine 4&#39;s Cascade particle editor. This tutorial creates such a

system and demonstrates how you can use it to boost visual

fidelity.</p> <p><strong>Why use particle […]


														
							

Boost Visuals with Particle Parameters in Unreal Engine* 4

<p>Particle parameters are a powerful system built into the Unreal Engine* that allows the customization of particle systems outside of Unreal Engine 4&#39;s Cascade particle editor. This tutorial creates such a system and demonstrates how you can use it to boost visual fidelity.</p>

<p><strong>Why use particle parameters?</strong></p>

<p>Particle parameters are essential to any game that seeks to leverage particle systems to their maximum potential. The goal is to make particle systems respond dynamically to the world around them.</p>

<p><strong>Overview</strong></p>

<p>In this tutorial, we use particle parameters in conjunction with CPU particles to change the lighting of a scene based on a gameplay element, in this case the fuel left on a fire (see Figure 1). As the amount of fuel on the fire decreases, so does the visual effect created by the particle system and the lighting created by the fire particles in that system. Once the fuel is completely gone, we start to fill the fuel back up again until the fuel is back to where it started. This creates a nice loop that demonstrates the entire range of the particle effect.</p>

<p style=”text-align:center”><img alt=”digital campfire” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig1a-campfire.png” /></p>

<p style=”text-align:center”><img alt=”digital campfire” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig1b-campfire.png” /></p>

<p>Figure 1. Campfire with particle parameters.</p>

<p><strong>Adding Parameters to P_Fire</strong></p>

<p style=”text-align:center”><img alt=”Particle parameters interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig2-particles-parameters.png” style=”width:650px” /><br />
Figure 2. Particle parameters.</p>

<p>To make this particle effect, we modify the P_Fire particle system included in the Unreal Engine starter content. In Figure 2, modules that we modify are highlighted in purple, and modules we add are highlighted in orange.</p>

<p><strong>Modifying light</strong></p>

<p>Lighting is one of the major benefits of using CPU particles and will form the core of this effect.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig3-first-flame-emmiter.png” /><br />
Figure 3. First flame emitter.</p>

<p><strong>Select parameter distribution on the distribution drop-down menu</strong></p>

<p>In the details panel of the first flame emitter in the P_Fire particle system, select <strong>Distribution Float Particle Parameter</strong> from the <strong>Brightness Over Life Distribution</strong> drop-down menu as shown at the top of Figure 3. This allows us to tie the amount of light emitted to a variable, in this case, the amount of fuel left in the fire.</p>

<p><strong>Set name</strong></p>

<p>The next step is to specify which particle parameter this distribution will be tied to. We&#39;ll use the name &quot;<strong>FuelLeft</strong>&quot;. Enter this in the <strong>Parameter Name</strong> field, as show in Figure 3.</p>

<p><strong>Set mapping mode</strong></p>

<p>A powerful feature of particle parameters is input mapping. This feature allows us to specify the max and min input that we will accept and to scale those values to a given range in order to make a single input parameter function seamlessly for many different modules. This capability allows us to make different parts of the particle effects scale down at different points. Effects like the sparks and embers will only start to change once the fire starts burning low, and we will set their input range to reflect that. We&#39;ll use <strong>DPM Normal</strong> for all the distributions in this tutorial as we want to both clamp the input and scale it to a particular range. This is selected under the <strong>Param Mode</strong> drop-down menu shown in Figure 3.</p>

<p><strong>Set input range</strong></p>

<p>Next we specify the min and max output. For this effect, we&#39;ll use <strong>0.0</strong> for the min and <strong>1.0</strong> for the max, as shown in Figure 4. This means the light from this part of the fire will scale from 0 percent fuel (fully dark) to 100 percent fuel (a nice campfire glow).</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig4-input-range.png” /><br />
Figure 4. Setting input range.</p>

<p><strong>Set output range</strong></p>

<p>The output range lets us specify the minimum and maximum brightness for this part of the fire. Set these to the values shown in Figure 5.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig5-output-range.png” /><br />
Figure 5. Setting output range.</p>

<p><strong>Set default input value</strong></p>

<p>Now we need to set a default input value in case the effect is not given a value. This is done with <strong>Constant</strong> (see Figure 6). For this particle system, we&#39;ll set the default at <strong>1.0</strong>, or a full flame.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig6-default-value.png” /><br />
Figure 6. Setting the default value.</p>

<p><strong>Setting up the rest of the modules</strong></p>

<p><strong>Second emitter light</strong></p>

<p>To ensure the light emitted by the fire is consistent with the particles in the particle system, we modify the light module on the second emitter as well. Change the <strong>Brightness Over Life</strong> section on the light module on the second emitter to match the values shown in Figure 7. If we didn&#39;t scale this light source as well, the fire would still emit a full glow when it is just embers.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig7-second-emitter-light.png” /><br />
Figure 7. Second emitter light.</p>

<p><strong>First and second emitter scale</strong></p>

<p>Presently, the amount of light that our fire produces will change with fuel, but the size of the flames will not. To change this, we add a Size Scale emitter to both the first and second emitter as shown in Figure 2. This distribution will be a Vector Particle Parameter instead of a Float Particle Parameter. Since we are giving it the same parameter name as the Float Particle Parameter, Cascade copies the float value across all three fields for our vector. For both modules, we want the graphics to scale in size from 0 percent to 100 percent fuel, so the only fields we need to change are <strong>Parameter Name</strong> and <strong>Constant</strong>. Set both modules to match the values shown in Figure 8.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig8-emitter-scale.png” /><br />
Figure 8. Emitter scale.</p>

<p><strong>Smoke spawn rate</strong></p>

<p>Smaller fires produce less smoke, and we can modify our particle system to reflect that. To do this, we set up a particle parameter on the rate section of the spawn module on the smoke emitter. However, unlike the previous particle parameters we set up, we only want to start scaling down the smoke spawned when we reach 40 percent fuel and below. To do this, set the <strong>Max Input</strong> to <strong>0.4</strong> instead of <strong>1</strong>. Set <strong>Distribution</strong> to match the values shown in Figure 9.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig9-smoke-spawn-rate.png” /><br />
Figure 9. Smoke spawn rate.</p>

<p><strong>Embers spawn rate</strong></p>

<p>Embers also scale with the size of the fire, but don&#39;t start scaling down until our fire gets really small. We&#39;ll start scaling down embers at 50 percent (0.5) for this effect. Set the <strong>Spawn Rate Distribution</strong> on the Embers emitter to match the values shown in Figure 10.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig10-embers-spawn-rate.png” /><br />
Figure 10. Embers spawn rate.</p>

<p><strong>Distortion spawn rate</strong></p>

<p>The distortion caused by the flames needs to be scaled in the same way that the flames are scaled. Since we scaled the flames from 0 percent to 100 percent fuel, we need to do the same with the distortion. Set the <strong>Spawn Rate Distribution</strong> on the Distortion emitter to match the values shown in Figure 11.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig11-distortion-spawn-rate.png” /><br />
Figure 11. Distortion spawn rate.</p>

<p><strong>Set up a blueprint</strong></p>

<p>Now that our fire effect can be scaled with the amount of fuel, we need to set up a blueprint to set the amount of fuel. In this tutorial, the amount of fuel slowly depletes, and then fills back up again to demonstrate the effect. To create a blueprint for this effect, drag the particle system into the scene, and then click <strong>Blueprint/Add Script</strong> in the details panel.</p>

<p><strong>Setting up the variables</strong></p>

<p>For this effect we will need just two variables, as shown in Figure 12 below:</p>

<p><strong>FuelLeft:</strong> A float that keeps track of how much fuel is in our fire, ranging from 1 for 100 percent fuel to 0 for 0 percent fuel. The default is set to 1, so the fire starts at full flame.</p>

<p><strong>FuelingRate:</strong> A float that dictates how quickly we deplete or fill fuel. For this tutorial, we&#39;ll set the default value to -0.1 (-10 percent per second) for this tutorial.</p>

<p>When both variables have been created, the variable section of the blueprint should match that of Figure 12.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig12-fire-variables.png” /><br />
Figure 12. Fire variables.</p>

<p><strong>Changing fuel left</strong></p>

<p>For this effect, we need to change the amount of fuel left every tick and apply it to the particle system. To do this, we multiply the <strong>Fueling Rate</strong> by <strong>Delta Seconds</strong> and add it to <strong>Fuel Left</strong>. This value then gets set to <strong>Fuel Left</strong>.</p>

<p>To apply <strong>Fuel Left</strong> to the particle system, we use the <strong>Set Float Parameter</strong> node. For the target, we use our modified P_Fire particle system component, and for <strong>Param</strong> we use <strong>Fuel Left</strong>. The parameter name needs to be the name we used in our particle system, which in this tutorial is <strong>FuelLeft</strong>.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig13-modify-fuel-left.png” style=”width:650px” /><br />
Figure 13. Modifying fuel left.</p>

<p><strong>Bounding fuel left </strong></p>

<p>Eventually our fire will run out of fuel. In this tutorial, we want to switch to fueling the fire instead of depleting it at that point. To do this, we continue to work on the tick and check whether our new fuel value is too low (less than or equal to -0.1) or too high (greater than or equal to 1.0). The reason we set the low bounds to -0.1 is so that the fire will stay depleted for a bit before refueling. This doesn&#39;t cause any problems because any values passed to our particle system below 0 are treated as 0 due to the min input we set up.</p>

<p>If we find that <strong>Fuel Left</strong> is out of bounds, we multiply the <strong>Fueling Rate</strong> variable by -1. If <strong>Fuel Left</strong> is being decreased, this will cause it to be increased in subsequent ticks, or vice versa if it is being increased.</p>

<p style=”text-align:center”><img alt=”Settings interface” src=”https://software.intel.com/sites/default/files/managed/6e/e1/particle-parameters-fig14-bound-fuel-left.png” style=”width:650px” title=”” /><br />
Figure 14. Bounding fuel left.</p>

<p>Click&nbsp;<a href=”https://www.digit.in/tracker/intel-gamedevnews.html” rel=”nofollow” target=”_blank”>here&nbsp;</a>to Join the Intel&reg; Game Dev program for free tools, resources, and opportunities to help you bring the best game experience to the biggest worldwide audience</p>

<p>Source:&nbsp;https://software.intel.com/en-us/articles/boost-visuals-with-particle-parameters-in-unreal-engine-4</p>

Google
Ashutosh Gupta
Share a little biographical information to fill out your profile. This may be shown publicly. In WordPress version 2.9, a new filter was added to make changing the [...] string in the excerpt. Do not use both of these methods in