• Create Account

Sparks Effect

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

37 replies to this topic

#1Medo3337  Members

Posted 13 May 2013 - 07:12 PM

How do I create realistic sparks effect?

I used different textures but I couldn't get it to look like realistic sparks.

Can someone show me a simple texture for sparks? I'm not sure how the texture should look like (1 spark texture, few sparks texture, etc...)

I'm trying to accomplish something like this:

#2Rhetorician  Members

Posted 14 May 2013 - 12:31 AM

Are you using point-sprite billboards? lol

#3Rhetorician  Members

Posted 14 May 2013 - 12:46 AM

Well are you? Don't downvote me. I'm trying to help. Common...

Edited by Reflexus, 14 May 2013 - 12:47 AM.

#4Medo3337  Members

Posted 14 May 2013 - 03:07 AM

Hi,

It's the first time to see your comment now, I'm not using point sprites, I'm using billboards.

#5kauna  Members

Posted 14 May 2013 - 07:52 AM

If you look closely the sparks you can see that they aren't just camera facing quads (billboards), so you can't make the effect with just a texture. You'll need to use something like camera facing wide lines in order to give the sense of trail.

Cheers!

#6Medo3337  Members

Posted 14 May 2013 - 09:06 AM

Do I have to use camera facing wide lines to create any realistic sparks effect?

Any example?

#7belfegor  Members

Posted 14 May 2013 - 10:17 AM

You got something here Volumetric lines.

#8Medo3337  Members

Posted 14 May 2013 - 02:17 PM

@belfegor: What I know is that Volumetric lines can be used for laser beam, what that has to do with the particles engine?

#9JTippetts  Moderators

Posted 14 May 2013 - 02:36 PM

@belfegor: What I know is that Volumetric lines can be used for laser beam, what that has to do with the particles engine?

They're also useful for elongating particles to simulate motion blur of particles moving faster than the frame-rate can depict.

Edit: The posted video was rendered in Blender which can simulate motion blur during the render process. For a real-time application such as a game, however, such motion blur tricks as Blender uses might not be feasible. In that case, you can use elongation of the particles to fake it.

Edited by JTippetts, 14 May 2013 - 02:40 PM.

#10belfegor  Members

Posted 14 May 2013 - 02:37 PM

Who says it can't be used in particle systems?

#11Medo3337  Members

Posted 14 May 2013 - 03:37 PM

The example is showing how to do it using effect file, how do I accomplish that without using effect file? I want a pure C++/D3D9 way.

#12belfegor  Members

Posted 14 May 2013 - 04:03 PM

I really don't know if it is possible with FFP, but my guess is that it would be very difficult and limiting on what you could achieve against shader approach which is by far better, flexible and standard for many years from now.

Why are you avoiding to learn shaders? There is no reason not to use them and they are not that difficult once you grasp basic concept.

#13Medo3337  Members

Posted 14 May 2013 - 04:21 PM

The thing that frustrated me is that I can't use FFP light and that I'll be forced to create light using Shader.

Can you show me a simple texture that could be used for sparks? I'm not sure how the texture should look like.

Edited by Medo3337, 14 May 2013 - 04:23 PM.

#14kauna  Members

Posted 14 May 2013 - 04:34 PM

You may create the required geometry on the CPU and feed it to a vertex buffer. That way you don't have to use a shader.

"The simple texture" method (if there is one) won't give you the effect you are looking for.

Cheers!

#15Hodgman  Moderators

Posted 14 May 2013 - 08:01 PM

The thing that frustrated me is that I can't use FFP light and that I'll be forced to create light using Shader.

Sparks are emissive (they are lights) so they don't need to be lit.

Can you show me a simple texture that could be used for sparks? I'm not sure how the texture should look like.

I would render them as lines, as mentioned above, and colour them with a gradient from the front to the back of the line.

You could either do this with a 1D texture, or by simply using vertex colours:

What I know is that Volumetric lines can be used for laser beam, what that has to do with the particles engine?

There's many ways to draw particles.

Instead of drawing a quad where the particle currently is right now, you can draw a line between where it is now, where it was a moment ago, and where it was a moment before that. This gives you a curved line. If you colour that line with a gradient like above, and render it with additive blending, then you get the impression of a very fast moving bright object.

#16ankhd  Members

Posted 14 May 2013 - 09:19 PM

Hello there. one of the older directx 9 sdks has what you want. its the pointSprite demo looks like thats would be a good start for you

they look nice. early 2007 DirectX SDK.

#17Medo3337  Members

Posted 15 May 2013 - 05:56 AM

When I use the following code to create volumateric lines, I see the lines are stuck on the camera all the time.

How do I position the lines at certain position in the 3D space?

FLOAT g_fSpinX = 0.f;
FLOAT g_fSpinY = 0.f;
FLOAT g_fTX = 0.f;
FLOAT g_fTY = 0.f;
FLOAT g_fTZ = 14.f;

D3DXMATRIX mWorld;
D3DXMATRIX mWorldProjection;
D3DXMATRIX mTranslation;
D3DXMATRIX mRotation;

D3DXMATRIX g_mProjection = camera->GetProjectionMatrix();

D3DXMatrixTranslation( &mTranslation, g_fTX, g_fTY, g_fTZ );//0.f, 0.f, 14.f );
mWorld = mRotation * mTranslation;

mWorldProjection = mWorld * g_mProjection;

// We will not be using a viewing transformation, so the view matrix will be identity.
effect->SetMatrix( "mWV", &mWorld );
effect->SetMatrix( "mWVP", &mWorldProjection );

UINT passes = 0;
if( SUCCEEDED( effect->Begin( &passes, 0 ) ) )
{
effect->BeginPass( 0 );
device->SetFVF( TVertex::FVF );
for( UINT i=0; i < ARRAY_SIZE( g_aLines ) / 2; i++ )
RenderLine( g_aLines[i*2], g_aLines[i*2 + 1] );
effect->EndPass();
effect->End();
}


#18Medo3337  Members

Posted 15 May 2013 - 03:55 PM

Up, need some assistance.

#19belfegor  Members

Posted 15 May 2013 - 04:14 PM

Did you see something here?

// We will not be using a viewing transformation, so the view matrix will be identity.
effect->SetMatrix( "mWV", &mWorld );
effect->SetMatrix( "mWVP", &mWorldProjection );


#20Medo3337  Members

Posted 15 May 2013 - 04:32 PM

Yes, I tried to change it.

I tried setting mWorldProjection to the camera projection and mWorld to the transformation of the volumetric lines.

When I do that I don't see the lines anymore.

Edited by Medo3337, 15 May 2013 - 04:39 PM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.