bullet@Posted: Tue Aug 10, 2004 4:37 pm :
Particle Effects Tutorial 2: Using Custom Assetts



This tutorial assumes that you've read the first tutorial and are a little comfortable with the editor. You should at least know what the different settings I showed you last time do.

In the last tutorial I went over the Particle Editor and how it's used. I also gave a brief description of what a particle is. In this tutorial we will actually be using the Editor, so I hope you've played with it a little. If you haven't, you should still be able to follow along without much trouble if you've read the other tutorial.

We will be making our own particle, making Doom recognize its existence, then you'll be making it pretty.

Download the required files HERE



1. The Image


The first thing to do when creating your own effect is to craft the image that the effect uses. This will impact your effect more than anything else, since depending on your colors and the density, etc etc etc, it will look different with different settings.

I mainly use photoshop for this sort of thing, although I've come up with some neat things using Texture Maker and Painter. If you don't have Photoshop, you should be able to follow along in another image-editing program like Painter or The Gimp. If not, I've packaged the image I made in that pk4 you should have downloaded, and you can use that.

Make a new image with a blank background that is 64x64 pixels. You could make it as big as you want, but it'll need to be shrunken down at the end. There is no reason to make a particle larger than 64x64 pixels. I would even reccommend making them smaller if possible. But for now, 64x64 is big enough to work on without being so big that we get caught up in little details that will disappear wen we scale it down.

Now, I'm going to start by using the paintbrush and painting about half of our image black, with Opacity at about 80%

Image

It doesn't have to be perfect, and can sometimes turn out better if it isn't. Makes the particles look more interesting if they're oddly-shaped.

I'm going to do the same thing to the other side, but with light blue. I'm also going to fill in the gaps in my black with the blue, and my gaps in the blue with black. Then I'm going to turn my opacity down to 40% and go over some of the lighter areas with yellow. Giving us something like this:

Image

From here we could make tons of stuff. We have highlights, and we have shadows, and there are even some midtones in there. If you really wanted to, you could make another smoke effect, or some steam, maybe. I think there's already plenty of that sort of thing already, so I'm going to go a different route. First, I'm going to apply a radial blur with spin at 75.

Image

Next I'll use the Accented Edges filter, and then grab the Burn tool before Embossing the image, which gives us this:

Image

Now, that's pretty much it for making our particle. There is, however a problem. If we put this on a particle right now, it'll look like a bunch of squares with some circular stuff in the center. So I'm going to use the pain brush with 100% opacity, and paint black all the way around the borders of the image, so just the circular part is left. Sometimes using the smudge tool is good for this, too, but this time around there isn't really anything I want to keep outside of that circle.

The black plays a very important role, here. Any place that is completely black in this image, will show up as being completely transparent (or "see-thru") when you look at it in-game. This is how you can use little square images to make stars, circles, dots, crosses, etc. This is why I blackned more than just the edges of the image. If I did just the edges, then the whole circle thing would show up. I blackened two areas inside the circle, and you should be able to see through them once you're in the game.

Image

Voila! Our finished image!

save it as "myevileye.tga" and add it to empty.pk4 inside of the directory textures/bullet/tuts/particles2/
You can use WinZip to do this.

You can close photoshop (or whatever other imaging proggy you have open) and open your favorite text editor.


2. The Material

The next step is to write a material file for our preciiousss which will allow Doom 3 to recognize its existence. The most basic material files just contain a list of all the textures that go into it. This is how diffuse, normal, and specular maps can be combined. We need to do a little bit more than that, though, since we're making a particle effect.

First, some basic stuff:

the first two lines of your material file should read:

Code:
textures/bullet/particletut2/evileye
{


The first line is what's called a virtual path. It doesn't really exist. You can, technically, put anything you want there. This virtual path is what Doom uses to find all the files in a material. In the material browser in the Particle Editor (and in Radiant) you browse through these virtual paths. One virtual path can lead to several images (some of Id's materials have five or six). This system helps out by not requiring you to type out all six of the images for the object you're applying the texture to. You only need one line, in this case that line is textures/bullet/particletut2/evileye

The next step is one people can often get confused on, so I'm going to keep it simple this time, and we'll use a more complex material in the next tutorial.

On the next two lines after your curly brace (should be lines 3 and 4) add this:

Code:
translucent
   noShadows


These two lines add attributes to the material. Attributes are always declared before the actual files are referenced.

The first one, translucent, will allow light to pass through the particles. It won't make them transparent, but it won't stop light when light comes into contact with them.

The second attribute, noShadows, stops the particles from casting shadows. This is a good thing, trust me :)
There are more attributes we could assign, but these are the only ones that are necessary for now.

Now, one of the most important parts of our material: adding the image.

Code:
{
blend add
map textures/bullet/tuts/particles2/myevileye.tga
}


The curly braces are Very Important. Make sure you don't forget them :P
The line blend add is also important. blend is used for a number of things. In this instance, it is rendering all areas of the image that are 100% black invisible. That's what the add is for. Think of it as 'adding colors.' If black is 0, then there's nothing to display, but the other colors are above zero, so they are displayed more prominently the further from zero they get. There are many more blend modes to play with later :D

The next line points to the image, itself. map means that the rest of the line will target a file to be used in the blendmode above. This must use the true path to the file, not the virtual path, since the virtual path points to the true path which points to the file.

Now just finish off your material with a final curly brace. It should look something like this:

Code:
textures/bullet/particletut2/evileye
{
     translucent
     noShadows
          {
               blend add
               map textures/bullet/tuts/particles2/myevileye.tga
          }
}



Save the file as "bullet_particletuts.mtr" and put it in the 'materials' directory inside of 'empty.pk4'

Now Doom will be able to see our image. 8)


3. The Particle

First off, rename 'empty.pk4' to 'bullet_particletuts.pk4' and move it to your Base directory.

Now boot up Doom 3 in windowed mode, pull down the console and type editParticles.

Wait for it....

before you do anything in the Editor, go back to doom's console and type 'map testmaps/test_box'

This will load one of Id's testmaps, which is just an empty box, really. Great for testing out particles. I'll include a testmap wiht a later tutorial that's specifically geared toward particles.

After the map loads, click the New... button to create a new particle.

Name it myevileye, and when it asks where you want to save it, tell it to put it in base/particles/ for now (we're just keeping it there while we play with it. When we're done we'll add it to the .pk4 and delete the one in the /particles/ directory). Go ahead and call it myevileye.prt as well. You know you want to :wink:
When you're asked if you want to copy the current particle, say no.

Now click the testmodel button (the T in the lower-left corner of the Editor). You should see a bunch of black squares floating upward:

Image

First, we'll apply our material. Click the button that says ... on it and browse through to textures/bullet/particletut2/evileye
*hint* If you push B on the keyboard 11 times you will be right on top of the Bullet folder. Must faster than scrolling.

Once you've selected it, you should see the little black squares magically transform into our little friend. Also, Doom may look exactly the same as before, except for a small box in the lower-left of the Doom Window that has the updated image in it. Take your mouse, hold it down on the titlebar of the Doom window, and shake that thing around until the whole window is showing the way it should.

Image

As you may have noticed, they don't look like eyes at all, let alone evil. In fact.. they look kind of like bubbles.

While we can't make it look sinister, since it's too bright, we can stop the bubble effect.

First set Gravity to -13. That ought to teach them to stop floating around like that. Under Distribution set the X Y and Z values to anything between 1 and 10. To the right of that, set Outward as the direction, and Aimed for the Orientation. Upward bias should be something small. Like between 1 and 5.

Now try setting a large positive speed for the first value (like 100) and an even larger negative speed for the second (like 200). Then play with the Bunching. Slide the Time up and down between 2 and 8. Watch how you get blobs with a size of 30, but lines with a size of 3. All three Distribution forms (rect, cylinder, sphere) will give a similar result, but it'll be a little different for each one. In the next tutorial I will go more in-depth about how to achieve specific effects with these settings, and how they each affect your effect.

When you're all done, add the .prt file to the /particles directory of the .pk4. A word of warning, for some reason whenever I have a particle inside of the particles folder (inside the base folder) Doom crashes to the desktop when I try to join a multiplayer game. Watching the console real close revealed that it had some error about not being able to load the particle, which is awfully strange since it shouldn't even be trying for a multiplayer level that doesn't contain it. Works fine in a .pk4, though.

Another thing is, remember to click the Save button! It may update in real-time, but it doesn't save it at all until you tell it to.



Yarik@Posted: Tue Aug 10, 2004 4:52 pm :
Great job man!



bullet@Posted: Tue Aug 10, 2004 5:11 pm :
Thanks!

I don't think I'll have the time to have the third one done this week, though, unfortunately. I'm shooting for next monday or tuesday...



bozo@Posted: Tue Aug 10, 2004 7:09 pm :
@bullet
great tutorials :)

the file myevileye.prt in bullet_particletuts.pk4 seems to be wrong, it is not your created praticle effect, only some default particlesettings, or should this be like that?



bullet@Posted: Tue Aug 10, 2004 7:45 pm :
d'oh! I must have forgotten to hit that Save button.... I'll fix that now an upload it again.

*EDIT* : Fixed and uploaded. That effect can be made with the same settings I reccommended. I didn't use any settings I didn't point to :)
Enjoy!



»$hinz0n_0f_R3mu$«@Posted: Fri Jan 27, 2006 11:16 am :
:( I'd like to see the images, but since it's 2years ago there is not a great chance of seeing them, is it? I'd really like to see the pictures so i can figure out what is meant with "the half black" :/