Increasing the size of a smoke sprite.


(HHLethal) #1

A friend of mine wants to shoot a movie with a tank in it, he asked me to make him a map and I wanted to do some special reality effects in it.
One of my ideas was to have a cloud of dust hanging behind the tank.
I tried putting a couple target_smoke’s inside the wheels and info_notnull_big’s a little bit further behind them.

Since smoke can only be white or black, and sand/dust is usually brownish, I gave the smoke the following keys:

angle -90
classname target_smoke
delay 25
scriptname smoke_1
shader textures/hm713/dust
spawnflags 6
target smoke_target_1
targetname smoke_1
wait 1

This is the shader:

textures/hm713/dust
{
cull none
deformVertexes autoSprite
surfaceparm nomarks
surfaceparm nolightmap
surfaceparm trans
{
clampmap textures/hm713_v002/sandstorm.tga
blendFunc blend
rgbGen identity
}
}

My problem is that the sprites are too small to appear as dust clouds.
I tried increasing the size of the image inside the .tga, that didn’t help.

I’ve got lots of little dust puffies but I think they should be bigger for good measure.

The start and endsizes on the target_smoke only change the size of the area’s wherein smoke clouds will be emitted, not the size of the sprite.

So how can I make something like this look more natural ? Is there anything I can do to the target_smoke or the shader to make them appear bigger ?

If anoyone has other ideas to achieve the same effect, those are welcome too.


(Diego) #2

Interesting idea, I have only tried using the smoke for standard uses. But I thought the default black smoke had a pretty large sprite at the end of it’s lifespan. Maybe the directionality is messing it up?

There are also dust effects. I forgot where they are, but EB has them in his “func” tutorial. They are also more like the desert color you need and might be a better choice for what you want to pull off.

Another effect you might try is the firetrails. It has no velocity, so you could turn it off when the tank stops moving. I’m just assuming you can change the shader to use something more dust-like.


(carnage) #3
// This file was automatically created by Particle Studio.
// For more information about Particle Studio, please
// visit http://www.quake3stuff.com/freebrief

// If this file was created with work-around code switched on,
// you will have to remove all occurences of the string
// "//-UNCMT4RELEASE-//" after you compile the map.
// 
// If you forget to do this,  your particles will look flat and 
// will have misaligned textures.

textures/mymap/myeffect_1
{
qer_editorimage textures/particle_studio/editor.tga
surfaceparm noimpact
surfaceparm nolightmap
cull none
surfaceparm trans
surfaceparm nonsolid
surfaceparm nodlight
deformvertexes autosprite
deformvertexes move 63.115513 -78.219742 45.837914 sawtooth 0 1 0.265816 0.217259
{
clampmap textures/sfx/fan.tga
tcMod rotate 0.000000
AlphaGen wave sawtooth 0.700000 -0.700000 0.265816 0.217259
rgbGen wave sawtooth 1.000000 0.000000 0.265816 0.217259
tcMod stretch sawtooth 15.000000 35.000000 0.265816 0.217259
blendfunc blend
}
}

you could look for the tool particle studio that i used to generate that shader file. Although it can make very nice results much better then just using smoke entites the code shader it exprots isnt exactly bug free and requires a shader for each puff of smoke so you can easily push number of shaders in 100’s

tcMod stretch sawtooth 15.000000 35.000000 0.265816 0.217259

this at a gess is the code that makes the smoke cloud get bigger as it moves away from the origin point. but it seems to be working on a ratation and im gessing it is set that it begins the roatation at is smallest where it will be at the point of origin and reach the largest value when its about to disapear

the size of my particles moves from 15 units to 35 so perhaps you could make it just stay the same size by using

tcMod stretch sawtooth 35.000000 35.000000 0.265816 0.217259

EDIT// ignore the above surgestion

tcMod stretch

therefore

tcMod stretch sawtooth 1 0 1 1

should mean that your particle will stay the same size thought its use

tcMod stretch sawtooth 10 0 1 1

should mean that your particle will be ten times the original size and not change size during use


(HHLethal) #4

It was worth the try, but it doesn’t increase the size of the particle. Instead the dust clouds appeared square as if they were zoomed in 10x, the effect was something looking more solid but with the square edges all around, it’s not looking natural.

I tried some of the other deformvertexes stuff which appeared to make my smoke rise up in the air and then drop down fast, in combination with the autosprite. I’m going to examine that line a little bit further, see if something can be done with that one.

You’re right, I tried those first but I got nothing at all. I even put a func_timer to trigger it repeatedly but nothing happened. I may have done it wrong though so once I get stuck messing with the shader itself, I’m going to start going trough your suggestions. Including this one:


(carnage) #5

mmm looking into why my surgestion only stretched the texture but dint actuly make the tris any larger

could you apply this shader and recompile and tell me if there is any differenace or at least if anyhting changes

textures/hm713/dust
{
cull none
deformVertexes autoSprite
surfaceparm nomarks
surfaceparm nolightmap
surfaceparm trans
{
clampmap textures/hm713_v002/sandstorm.tga
tcMod rotate 0.000000
tcMod stretch sawtooth 15.000000 35.000000 0.265816 0.217259
blendFunc blend
rgbGen identity
}
}


(HHLethal) #6

I get the same kind of cube like things I saw on my own first attempt. The cubes are all equal in size and don’t look much bigger than what my sprites were before I changed them.

Have a look for yourself and feel free to try some more of your shader options : download the map


(CooperHawkes) #7

target_smoke
-------- KEYS --------
“delay” this is the maximum smoke that will show up, default 100ms
“time” time before the smoke disipates, default 5000ms
“duration” time before the smoke starts to alpha, default 2000ms
“start_size” default 24
“end_size” default 96
“wait” the rate at which it will travel up, default 50
“shader” custom shader to use, overrides spawnflags

increasing the values of the red keys works quite fine for me…


(carnage) #8

clampmap textures/hm713_v002/sandstorm.tga
tcMod rotate 0.000000
tcMod stretch sawtooth 15.000000 35.000000 0.265816 0.217259

though it was unusual why this was not working even having any effect on the size of the tris even though the shader is saying they should be changing. i gess the smoke entity keys override any shader commands


(HHLethal) #9

All I ever saw it doing is increasing the size of the area where random smoke puffs are created from, and the size of the area they will flow towards. The sprites themselves don’t appear to change sizes.


(Diego) #10

Try taking the directionality off your smoke. You shouldn’t really need it anyway if you want the smoke to rise. Or make the gravity affect the smoke. You don’t want it to look like it is shooting out of the back anyway. You just want it to looked like it was stirred up by the tracks. In which case, it would simply rise up a bit and then settle back down in place.

But I have altered the end size of one of my smoke particles to make it a smaller thin line and it worked fine.


(HHLethal) #11

I seem to have found the cause of my problem, but not the solution.

Most ideas given here were indeed correct, changing the end size of your smoke will indeed increase the size of your cloud, if, and only if, you don’t use a shader !

Here you see the result of one cloud of ‘normal’ smoke with a start size of 16 and and end size of 128.

The one next to it has exactly the same settings, except for my custom shader.

I think I’ll try and put a bunch of ‘remapshader’ commands to work on some of that standard black/white smoke stuff and see what happens.


(HHLethal) #12

Hmmm…

g_target.c : void SP_target_smoke (gentity_t *ent)


	if(G_SpawnString("shader", "", &buffer)) {
		ent->s.modelindex2 = G_ShaderIndex( buffer );
	} else {
		ent->s.modelindex2 = 0;
	}
	if (ent->spawnflags & 2)
		ent->s.density = 4;
	else
		ent->s.density = 0;

(spawnflag 2 = white)

:roll: if(G_SpawnString(“shader”, “”, &buffer)) {
ent->s.modelindex2 = G_ShaderIndex( buffer );
} :roll: Personal shader sets modelindex2

cg_ents.c : static void CG_Smoker( centity_t *cent )


		if(cent->currentState.modelindex2) {
			CG_ParticleSmoke (cgs.gameShaders[cent->currentState.modelindex2], cent);
		} else if (cent->currentState.density == 3) { // cannon
			CG_ParticleSmoke (cgs.media.smokePuffShaderdirty, cent);
		} else if (!(cent->currentState.density)) {
			CG_ParticleSmoke (cgs.media.smokePuffShader, cent);
		} else {
			CG_ParticleSmoke (cgs.media.smokePuffShader, cent);
		}

So far no difference between using my shader or the default shader.

:roll:if(cent->currentState.modelindex2) {
CG_ParticleSmoke (cgs.gameShaders[cent->currentState.modelindex2], cent);
:roll: There we go :slight_smile:

cg_particles.c : void CG_ParticleSmoke (qhandle_t pshader, centity_t *cent)


	if (!pshader)
		CG_Printf ("CG_ParticleSmoke == ZERO!
");

Yep, seen this a lot when my shader was messed up :slight_smile:


	if (cent->currentState.density == 1 || cent->currentState.modelindex2)
	{
		p->rotate = qfalse;
		p->height = 8;
		p->width = 8;
		p->endheight = 32;
		p->endwidth = 32;
	}

:bash: || cent->currentState.modelindex2 :bash: Got it !
And therefore my friends, your personal shader won’t change size !


	else if (cent->currentState.density == 4) // white smoke
	{
		p->rotate = qtrue;
		p->height = cent->currentState.angles2[0];
		p->width = cent->currentState.angles2[0];
		p->endheight = cent->currentState.angles2[1];
		p->endwidth = cent->currentState.angles2[1];
		p->color = GREY75;
	}
	else if (cent->currentState.density == 5) // mustard gas
	{
		p->rotate = qtrue;
		p->height = cent->currentState.angles2[0];
		p->width = cent->currentState.angles2[0];
		p->endheight = cent->currentState.angles2[1];
		p->endwidth = cent->currentState.angles2[1];
		p->color = MUSTARD;
		p->alpha = 0.75;
	}
	else // black smoke 
	{
		p->rotate = qtrue;
		p->height = cent->currentState.angles2[0];
		p->width = cent->currentState.angles2[0];
		p->endheight = cent->currentState.angles2[1];
		p->endwidth = cent->currentState.angles2[1];

		{
			int rval;
			rval = rand()%6;
			if (rval == 1)
				p->pshader = cgs.media.smokePuffShaderb1;
			else if (rval == 2)
				p->pshader = cgs.media.smokePuffShaderb2;
			else if (rval == 3)
				p->pshader = cgs.media.smokePuffShaderb3;
			else if (rval == 4)
				p->pshader = cgs.media.smokePuffShaderb4;
			else
				p->pshader = cgs.media.smokePuffShaderb5;
		}
	}

White is one single shader, black is a couple of them.
I can remap the shader for white but then when a covert throws a smoke grendade, he’s throwing dust.
If I want to tackle black, I need to change 5 shaders. Mustard gas I can’t create unless I use a mod :bash:


(Diego) #13

I was looking into the smoke for a different problem and came across this old post regarding the custom shader for smoke:

Chavo One

… I went through the code, and if I’m reading this right, you’ll never get this to work right unless you make a mod. If you set “shader” equal to anything, then the size of the particles get hard-coded with the following parameters:
start_size=8
end_size=32
no particle rotation

I see you found the same thing, but the hard way.

I guess we should have looked harder. This topic is linked under the “TUTORIALS AND ET MAPPING RESOURCES” sticky Thread.

The full topic is here:
http://www.splashdamage.com/forums/viewtopic.php?t=7832


(HHLethal) #14

:banghead:
And I did try the search function. Hard to look for something if you are not yet sure what you’re looking for :slight_smile:


(Detoeni) #15

The shader that was posted above by carnage is sort of the way to go.
Particle Studio is what I use for this type of thing but it needs alot of reworking to get good results.

The prefabs that get exported from PS are too small, and need to be rescaled to the max size you want to see the partical in game. The shader clamps the corners of the texture so it wont tile, so when you scaled it bigger above, you got to see a few pixels in the middle. Now if you start the partical very small (0.1) and let it expaned to 1, where it will fit your rescaled prefab it will work fine.


(carnage) #16

yes i used particl studio to generate part of that shader but for ever cloud of smoke or particle you generate one shader and so you can very quickly run up large amounts of shaders. if your making a video this might not be a problem. however you will not be ale to achive very nice reults when turning the smoke on/off as it would all have to dispear instantly

and as detoni says there is a lot of setting up involved as the export if far from perfect

EDIT// i dont fully understand all that code but i see why the white shader cannot be changed for the cov ops but the engine is able to remap more then 5 shaders. do these effect other things apart from the tank smoke


(Diego) #17

It’s too bad we can’t just use the white smoke shader and apply a “color” value to the entity in radient. But that would make things too easy. :x


(TNR360) #18

sometimes the simpest of things work

did you try messing with the start_size and end_size? :stuck_out_tongue:


(murka) #19

seems that the only way is to remap the black smoke. long work. sometimes things can’t be changed.