[Searching] Particle Smoke Muzzle

Posted By: Ch40zzC0d3r

[Searching] Particle Smoke Muzzle - 11/25/13 18:03

Hey guys, I tried building this particle effect so often but I never succeeded...
I mean the smoke coming out of th gun when you DONT fire it.
Does anybody done it already?
Would be awesome.
VID: http://www.youtube.com/watch?v=vjB3SO1a0Pw
Posted By: Ch40zzC0d3r

Re: [Searching] Particle Smoke Muzzle - 12/03/13 19:14

Just asking again, sorry for pushing but I cant get something like this working with particles frown
Posted By: EpsiloN

Re: [Searching] Particle Smoke Muzzle - 12/03/13 19:30

Why cant you get it working with particles? It would require a lot of small particles to look smooth, but I think it shouldnt be that hard...

BTW , from what I saw in the video, the particles are the only way, because the smoke changes spawn point as the barrel moves, but the old smoke is still hanging somewhere lower than the barrel during reloading. This can only be done with a trail of particles left from the movement of the barrel.

Get the vertex you want to spawn from, use an effect with lots of small particles (somewhat smooth at the edges, but not too smooth) and set them with a very, very slow upwards movement and medium fading, to create a visible trail effect. I think this should look similar to the video...
Posted By: rayp

Re: [Searching] Particle Smoke Muzzle - 12/03/13 19:33

Iam interested in this one too.
edit:
Quote:
I am 99% sure that they aren't using particles.
+1
edit end

@EpsiloN
Are you sure its done this way ? I mean the amount of particles needed for that cant be good for the performance.
Posted By: Kartoffel

Re: [Searching] Particle Smoke Muzzle - 12/03/13 19:37

I am 99% sure that they aren't using particles.

I bet they're using a mesh which they deform in realtime.
Posted By: Ch40zzC0d3r

Re: [Searching] Particle Smoke Muzzle - 12/03/13 19:39

I would do it like you described it, but it looks like shit :|
My code:
Code:
#include <acknex.h>
#include <default.c>

function part_ev(PARTICLE *p)
{
	p->alpha -= 15 * p->vel_z * time_step;
	p->size += 0.05 * time_step;
	
	if(p->alpha <= 0)
		p->lifespan = 0;
}

function part(PARTICLE *p)
{
	p->vel_x = 0;
	p->vel_y = 0;
	p->vel_z = 1.2;
	p->gravity = 0;
	p->size = 0.1;
	p->flags = MOVE | TRANSLUCENT | BEAM;
	p->event = part_ev;
}

function main()
{
	fps_max = 60;
	video_mode = 10;
	level_load(NULL);
	
	ENTITY *pGun = ent_create("UZI_V.mdl", camera.x, NULL);
	ent_animate(pGun, "Take", 100, 0);
	camera.clip_near = 1;
	camera.arc = 85;
	
	int i = 0;
	
	while(1)
	{
		proc_mode = PROC_LATE;
		vec_set(pGun.pan, camera.pan);
		vec_set(pGun.x, camera.x);
		
		VECTOR v1, v2;
		vec_for_vertex(v1, pGun, 1778);
		vec_for_vertex(v2, pGun, 1788);
		vec_add(v1, v2);
		vec_scale(v1, 0.5);
		
		effect(part, 100, vector(v1.x, v1.y, v1.z), nullvector);
		
		/*for(i = 0; i < 50; i++)
		{
			effect(part, 1, vector(vPos.x, vPos.y, vPos.z + i*time_step), nullvector);
		}*/
		
		wait(1);
	}
}

Posted By: Ch40zzC0d3r

Re: [Searching] Particle Smoke Muzzle - 12/03/13 19:49

BTW, I downloaded the package which contains the images for the particles and the compiled particle effects as *.pcf files.
So these are particles, Im sure, but how the hell does it work? xD

EDIT: Picture of the Particle Editor (They can use rope particles -.-)
Posted By: EpsiloN

Re: [Searching] Particle Smoke Muzzle - 12/03/13 20:00

Originally Posted By: rayp
I mean the amount of particles needed for that cant be good for the performance.

I've overused particles before, and I can say from experience, the engine can handle 300-600 particles/gun, assuming the players weapon would be the most detailed, because its right infront of the screen. The other guns could be less detailed, depending on the distance to the player.

Even if you make the player's gun with 800 particles, and the others with less, IMHO the engine will handle that...



*EDIT* I ran your code with the m4a1 model from the resources, and I see some strange "lines" if I move backwards.
What are the 2 vertices for? Where are they located on your UZI model ?
Posted By: Ch40zzC0d3r

Re: [Searching] Particle Smoke Muzzle - 12/03/13 20:11

The vertices are the 2 points arround the run of the weapon, if I middle them I get the perfect middle of the run laugh
The lines are exactly the problem Im speaking of, IDK where they are comming from frown
Posted By: EpsiloN

Re: [Searching] Particle Smoke Muzzle - 12/03/13 20:22

I dont have time to tweak it more, but here's what I've came up with in 10 mins.
Code:
#include <acknex.h>
#include <default.c>

function part_ev(PARTICLE *p)
{
	p->alpha -= random(25) * p->vel_z * time_step;
	p->size += 0.005 * time_step;
	
	if(p->alpha <= 0)
		p->lifespan = 0;
}

function part(PARTICLE *p)
{
	p->vel_x = 0;
	p->vel_y = 0;
	p->vel_z = random(0.01) + 0.09;
	p->gravity = 0;
	p->size = random(0.1) + 0.3;
	p->flags = MOVE | TRANSLUCENT;
	p->event = part_ev;
}

function main()
{
	fps_max = 60;
	video_mode = 10;
	level_load(NULL);
	
	ENTITY *pGun = ent_create("m4a1.MDL", camera.x, NULL);
	ent_animate(pGun, "Take", 100, 0);
	camera.clip_near = 1;
	camera.arc = 85;
	
	int i = 0;
	
	while(1)
	{
		proc_mode = PROC_LATE;
		vec_set(pGun.pan, camera.pan);
		vec_set(pGun.x, camera.x);
		
		VECTOR v1, v2;
		vec_for_vertex(v1, pGun, 39);
		//vec_for_vertex(v2, pGun, 1788);
		//vec_add(v1, v2);
		//vec_scale(v1, 0.5);
		
		effect(part, 10, vector(v1.x, v1.y, v1.z), nullvector);
		
		/*for(i = 0; i < 50; i++)
		{
			effect(part, 1, vector(vPos.x, vPos.y, vPos.z + i*time_step), nullvector);
		}*/
		
		wait(1);
	}
}



Fix your MDL name and, I've commented one of the vertices, because you really need only one...
Include a sprite image for the particles, it'll look better.

PS.: Tested with 1600 particles. Doesnt look like in the video, but in slower movements it appears smooth. Faster movements separate the particles too much, so you might need even more particles for the players gun.
Posted By: MasterQ32

Re: [Searching] Particle Smoke Muzzle - 12/03/13 20:23

you could use sprites instead of particles
just store them in an array and place them every frame as needed
Posted By: rayp

Re: [Searching] Particle Smoke Muzzle - 03/11/14 22:58

Im happy, now i have such an effect in my weapon script. Not perfect, but pretty cool, 4 my taste. Invested some work into smoke - sprites + alpha channels, combined them with player's movement vectors. Then i "rayp-ed" an Shade-C(evo[beta]) - effect, normally used 4 steam, softfog etc.
Code:
sc_ent_softFog (ent, vector, vector, vector, var); // see shade-c(evo) script 4 more infos

"ent.alpha" keeps working with this effect applyed, nice ^^

In some weeks ( maybe month ) i planned a small videoupload, if someone interested, he / she can watch it then to see the result / effect in motion.

Maybe one of the shader-gurus is bored ... would be a nice contribution ^^

Peace
Posted By: Kartoffel

Re: [Searching] Particle Smoke Muzzle - 03/12/14 05:45

I don't wanna call myself a shader guru but I might give it a shot if there's enough time
Posted By: rayp

Re: [Searching] Particle Smoke Muzzle - 03/12/14 09:30

I ( and iam sure many others too ) would love 2 see this contribution. Thanks alot in advance, even 4 the offer, nice!

Is it a bird ? ... Is it a plane ? ... No, its POTATO MAN shadering the game! ^^
or
nananananananana POTATO MAN !!!!!!! *baaaam* *claaaasshhh* *etc*
Posted By: Ch40zzC0d3r

Re: [Searching] Particle Smoke Muzzle - 03/12/14 10:28

Haha, would be very awesome laugh
Thanks in advance tongue
© 2024 lite-C Forums