Difference between revisions of "HPL1/Tutorials/Particles"
(Upload from wiki) |
m (Mudbill moved page Hpl1:Tutorials:tutorial 4 - particles to HPL1/Tutorials/Particles without leaving a redirect) |
Latest revision as of 20:32, 19 July 2020
TUTORIAL 4.1 – Particles
Creating particles for HPL is easy and fun much thanks to an advanced but easy to use editor. In this tutorial we will create two different particles. Let's get started
First make sure you have placed the tutorial directory in the redist directory. And make sure that you have added all the tutorial_x directories to the resource.cfg file using HPLHelper.
Now, open the ParticleEditor.exe and what you will be presented with is many tabs with lots of options. To make this as easy as possible, lets add a material to use as a particle and simply see how it looks in the preview window. To do this, select the ”Material” tab, in the file input area click the ”...” button and select the material ”tut_particle.mat” located in ”tutorials/tutorial_4”. This is all you have to do for now, using the File menu and save your particle to your ”mystuff” directory and name it ”mystuff_particle.ps”. You can now click the ”save and view particle system” button.
You should get a window that displays an explosion, for each second it draws a new explosion on top of the old one. Not very fun, but a working particle, lets try and make it slightly more interesting.
Go to the ”Life” tab and change Life span Min and Max to 2 for both. This means that a particle will be rendered for two seconds, if you set different Min and Max values you will get a random effect. Lets move over to the ”Rendering” tab, at the bottom you have Size fading, set the ”start relative size” and ”end relative size” to 0 and leave ”middle realtive size” set to 1. Set ”middle relative start” to 0.1 and leave ”middle realtive length” at 0. Now view your particle system.
You should have an explosion that quickly fades in and slowly out in a pulsating manner. Slightly more interesting. Lets get some random colours for the explosion, go to the ”color” tab.
In General set ”Min Color” to 0 for R, G, B. If you view the particle now you get explosions in random colors. Go to the ”Movement” tab and for Box velocity set ”Min Velocity” to -1 on X,Y and Z. On ”Max Velocity” set X,Y and Z to 1. This will move the particles away from the center start location in random directions and speeds.
Finally lets go to the ”General” tab and set ”particles per sec” to 100, uncheck the ”respawn dead particle option and finaly set the ”Warmup Time” to 0.1. What this will do is it will create 1 burst of parciles, starting 0.1 seconds into the calculation resulting in a colorful pretty explosion.
To make the explosion slightly more interesting we are going to add one more material to the effect. In the General tab, Click Add below the Emitters: dropdown menu.
We now have the abillity to add a smoke particle as well. First go to ”Materials” tab and load the ”tut_particlesmoke.mat” found in ”tutorials/tutorial_4”. To keep the colorful style we will not simply add some smoke, we will add some colored smoke that will start in the center and move away in a sphere pattern creating a shockwave effect.
First lets make it smaller, in Rendering change Min and Max size for both X and Y to 0.2. ”Set End relativ size” to 6 and ”Middle relative start” to 0.2. This will shrink the particle 0.2 and just before the particle disapears it will have grown to 6 times the size.
Go to ”life” tab and change it to 3. Continue to ”Movement” tab and set ”Velocity type” to Sphere instead of box and check the ”uses direction” option. For sphere velocity leave Min and Max X as they are but set Min and Max Y to 0. The last thing on this page is to set both the Min and Max speed to 3. What we have done now is that this particle will spread in a circle out of the center. But currently it is in the wrong direction to be viewed.
To change this go to ”General” tab and change ”Offset Angles” Y to 90. We also want more particles so set ”Max Particles” to 50 and ”Particles per sec” to 10000 to create an instant ”puff”. Finally change ”Start time offset” to 0.2 and uncheck the ”spawn dead particles” option. This will create the shockwave slightly after the explosion particle. If you look at the particle now you have a shockwave but not a very pretty one.
To improve this lets go to the ”color” tab and first set ”middle relativ start” to 0.2. Change ”End relativ color” to 0 for XYZ. This will fade out the smoke cloud at the end. If you also set ”Start relativ color” to 0 for XYZ it will quickly fade in the ring at the start.
There you have it. Perhaps not the prettiest particle effect, but you did get to fiddle with a bunch of the options.
TUTORIAL 4.2 – Let's play a little more
Next we will do a simple effect that uses gravity, acceleration and such to create a more dynamic life to the particle. The effect will be a quite simple smoke exhaust thing.
Start a new particle project and add the ”tut_particlesmoke.mat” as a material. In the general tab set Max particles and Particles per sec to 20. In the color table add set the following:
^R ^G ^B ^ |
0.85 |0.88 |0.91 | |
---|
0.88 |0.91 |0.94 | |
---|
| | | |
---|
0. |0.3 |0.3 | |
---|
1 |1 |1 | |
---|
0 |0 |0 | |
---|
Middle relativ start and length to 0.2
This we do because we want to add minor changes in the color to the smoke cloude each time it generates a particle. And it start's almost black, fades in quickly and then slowly fades out.
Moving on to the ”Start” tab. Set all Min to -0.2 and all Max to 0.2 for the Box Start area. What this will do is that the particles will appear randomly within a very small area, making it slightly more dynamic.
Heading over to the ”Movement” tab, For Gravity select Vector and set X -3 and Y 1. This will create a ”wind” effect where the particles will be dragged to the left as well as a little upwards.
For box velocity set Min X to 3 and Max X to 5, leave the rest at 0. This will give the particles a push in the beginning to the right, increasing the feel of a wind going left. The particles will have a random speed between 3 and 5. To increase the randomness further lets also add some acceleration.
Set Min X to 1 and Max 2 to 2. This will give more random speed going right. Then add -1 to both Y and Z Min and 1 to both Y and Z Max. Creating a spree effect were particles more a little different upwards and in depth.
”Life” tab, set life to 5 for both min and max. In the ”Rendering” tab Change the size Min to be 0.8 for X and Y and the Max for both to 1.6. This will create particles of various sizes. If we also adde some Size fading values they will change over time, set Start to 0.5, middle to 1 and end to 3. Also set Middle realtive start to 0.1 and middle relative length to 0.2. You will now get an effect of clouds that quickly grown in size, then hoover for a while before expanding and at the same time fading away(if you go back and look at the color properties you can see they are quite simillar).
There you have an exhaust puff like effect! As a bonus we can also test how to add some collision to the effect, this is perhaps not best used for this particular example but let's do it anyway.
In the ”general” tab tick the ”show room” option at the top. If you view the particle now you can see that it blows right through the wall to the right. To make the wall solid, go to the ”collision” tab and activate ”use collisions”. As it might see it bounces quite a lot, lower the Bounce ammount to 0.1 for both Min and Max.
The collisions are great to use for explosions effects with debris and similar, or sprinkling water. This concludes the particle tutorial, hope you enjoyed it!