[Feature Request]Ooh

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

[Feature Request]Ooh

Post by Chilvence »

Someone tell me how to make particles use additive blending
Attachments
DOOM0004.png
DOOM0004.png (104.86 KiB) Viewed 499 times
Last edited by Chilvence on Tue Jan 04, 2005 12:21 pm, edited 1 time in total.
User avatar
Cutmanmike
Posts: 11336
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

What the..... how did you do that?
User avatar
Chris
Posts: 2942
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Post by Chris »

Ditto. Does it actually flash and fade away without falling/rising?
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

Chris wrote:Ditto. Does it actually flash and fade away without falling/rising?
Well, I could make it do so, but I thought it looked better if it flashed instantly and then disappeared. Give me 10 minutes and I'll attach the effect to the chaingun....

Also, theres the unfortunate fact that it eats many many particles, probably more than the railgun, which you can only get a few simultaneous shots off without them starting to dissappear
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

User avatar
Nmn
Posts: 4629
Joined: Fri Apr 16, 2004 1:41 pm
Preferred Pronouns: He/Him
Contact:

Post by Nmn »

Like WOW man, this looks impressing. Tough shouldn't it illuminate the area? There's a LIGHTning and it's dark :roll:
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

Hey this is Doom, what can you do about that :p?

Though its simple enough to use the weapon flash function or script a sector light change, I cant make it do it automatically...
User avatar
Cutmanmike
Posts: 11336
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

ooooh it's a new .exe. I thought it was some new particle feature :roll:
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

Well just let me finish it properly and I'll submit it :D

So back to my question... how would I go about using additive blending?

BTW - It is a new particle feature. At least it is made of particles and is a feature, how much closer can you get?
User avatar
Cutmanmike
Posts: 11336
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

Ok so can you make your own pretty patterns out of particles without butchering up the source?
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

If you could spawn them in ACS, then yeah I suppose. You'd need to do some math though to work out your effect, this one uses lots of vectors. LOTS of vectors, In fact, I just noticed I mixed up two in the above exe.

Code: Select all

void P_ConnectLightning (vec3_t start, vec3_t end)
{
	float length;
	int steps, i;

	vec3_t step, dir, pos;

	VectorSubtract (end, start, dir);
	length = VectorLength (dir);
	steps = (int)(length);

	if (length){length = 1 / length;}else{return;}

	VectorScale2 (dir, length);
	VectorScale (dir, 1, step);
	VectorCopy (start, pos);

	int div = 128-M_Random()*2000;
	for (i = steps; i; i--)
	{
	
		particle_t *p = LightningParticle (2);

		if (!p)
			return;

		p->size = 6;
		p->x = FLOAT2FIXED(pos[0]);
		p->y = FLOAT2FIXED(pos[1]);
		p->z = FLOAT2FIXED(pos[2]);
		p->color = 168;
		/*
		we'll leave out the halo effect for now...

		particle_t *h = LightningParticle (10);

		if (!h)
			return;

		h->size = 13;
		h->x = FLOAT2FIXED(pos[0]);
		h->y = FLOAT2FIXED(pos[1]);
		h->z = FLOAT2FIXED(pos[2]);
		h->color = 162;
		h->trans = 128;*/ 

		VectorAdd (pos, step, pos);
	}

}

void P_DrawLightning (vec3_t start, vec3_t end)
{
	float length;
	int steps, i;

	vec3_t step, dir, pos;

	VectorSubtract (end, start, dir);
	length = VectorLength (dir);
	steps = (int)(length);

	if (length){length = 1 / length;}else{return;}


	vec3_t linepos; //where the real hitscan trace would be
	vec3_t linestep; //step to follow the imaginary hitscan line
	vec3_t kludge;  //used for measuring the distance between the current arc and the line
	vec3_t connect; //point from which to connect one arc to the next

	VectorScale2 (dir, length);
	VectorScale (dir, 1, step);
	VectorCopy (start, pos);
	VectorCopy (start, linepos);
	VectorCopy (start, connect);
	VectorCopy (step, linestep);
	VectorScale2 (step, 0.2f); //shorten the ligtning arcs a little bit...

	//arc amount, x, y, and z
	//I am assuming M_Random gives a number between 0 and 255, I hope this is correct)
	int ax = 128-M_Random();
	int ay = 128-M_Random();
	int az = 128-M_Random();

	for (i = steps; i; i--)
	{
		VectorSubtract (pos, linepos, kludge);
			if( VectorLength (kludge) > 30) //if the lightning deviates too far
			{
				//draw a line between the last closest position of the lightning to the hitscan line 
				//and the new arc start position(which is the hitscan line itself)
				P_ConnectLightning(connect, linepos);
				//...
	
				VectorCopy(linepos, pos); // then reset the lightning trail to the hitscan line
				VectorCopy(linestep, step);
				
			}
			else if(VectorLength (kludge) < 12 ) //when the arc deviates more than 12 units, save this position
			{
				VectorCopy(pos, connect);
			}

		particle_t *p = LightningParticle (2);

		if (!p)
			return;

		p->size = 6;
		p->x = FLOAT2FIXED(pos[0]);
		p->y = FLOAT2FIXED(pos[1]);
		p->z = FLOAT2FIXED(pos[2]);
		p->color = 168;

		/*
		we'll leave out the halo effect for now...

		particle_t *h = LightningParticle (10);

		if (!h)
			return;

		h->size = 13;
		h->x = FLOAT2FIXED(pos[0]);
		h->y = FLOAT2FIXED(pos[1]);
		h->z = FLOAT2FIXED(pos[2]);
		h->color = 162;
		h->trans = 128;*/ 

		//direction change: in effect this just generates a random vector and adds it to the arc line
		//this can potentially compress or extend the arc, but ultimately it doesnt matter since the 
		//connector joins the arcs together, and we get free forks as a side effect without even
		//needing to calculate them

		if (M_Random() < 200)//add some randomness to the direction change
		{ 
			ax = (M_Random()-128)*50;
			ay = (M_Random()-128)*50;
			az = (M_Random()-128)*50;
		}

		float tempx = FIXED2FLOAT(ax);
		float tempy = FIXED2FLOAT(ay);
		float tempz = FIXED2FLOAT(az);
		
		step[0] += tempx; 
		step[1] += tempy; 
		step[2] += tempz;	

		VectorAdd (pos, step, pos);
		VectorAdd (linepos, linestep, linepos);
	}
}
User avatar
Cutmanmike
Posts: 11336
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

:mono: looks simple to me....
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

Well, it is really, its just the nature of the language that makes it look complicated. It takes the point of origin, adds a tiny random vector change, spawns a single particle, then repeats until it reaches the end. If the random vector arcs too far away from the actual hitscan line, then it snaps back and starts randomising again. Now the railgun effect, THATS complicated. What I've done is pathetic compared to that...
User avatar
Cutmanmike
Posts: 11336
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

Who coded the railgun?
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

Apparently id did - it seems Randy based it on the Quake 2 version, possibly just as an experiment.
Locked

Return to “Editing (Archive)”