Absolute beginners guide to decals

Decals are a type of particle. In the code they are defined as “type cdecal”.

1. In Gimp, make a new image, size 256×256 (or 64², 128² etc), advanced options->fill with background color, and start drawing your decal. Alternatively, if you already have an existing image: layers-> “add alpha channel”, and delete the areas (ie on top layer) which will be invisible.

2. Export as (eg) foo.png, and put it in “particles/foo.png”

3. Open/make text file and make a particle:

[code]

r_part blast_damage
{
type cdecal
texture particles/foo.png // name of the image
scale 10 // how big is it?
die 30 // how many seconds till it fades away?
rgb 255 255 255 // this will use the original colours
}

[/code]

4. Save as Quake\yourmodname\particles\ my_decals.cfg

5. qc: Use particleeffectnum to give the particle a (global) number that pointparticles() can use later.

// a global
float PARTICLE_BLAST_DAMAGE = particleeffectnum(“my_decals.blast_damage”); // NOTE: “filename.particlename”, ie the file is called my_decals, the particle is called blast_damage

6. qc: call pointparticles!

[code]

// pointparticles void(float effectnum, vector origin, optional vector dir, optional float count) = #337;

pointparticles(PARTICLE_BLAST_DAMAGE, somesurface.origin, ‘0 0 0’, 1);

// because decals don’t move, and we only use one, we can condense this to:
pointparticles(PARTICLE_BLAST_DAMAGE, somesurface.origin);

[/code]

NOTES:
1. blend mode merges by default. However this means you can see gunshots in darkness. Spoike says: “the problem is that as a post-process effect, the decal is unable to distinguish between light and surface. subtract assumes they’re the same thing while merge totally ignores the actual surface behind along with its lighting etc”

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>