Skip to main content
gamedev.net
🔒 Locked

Thruster Fire

Started by Cuchulainn 11 replies 800+ views
Original Post
Cuchulainn
Cuchulainn
Hi - i''m looking for a way to make thruster fire. I was wondering how this is done in games. It needs to be semitransparent and needs to be scaleable ie - the higher your throttle, the longer the thruster engine fire goes out the back of the ship. Should i use a semi-transparent mesh - if so, how do i do this. Should i use volumetric lighting(not sure what this is) - if so how do i use this. All help is appreciated.
You'll Never Beat The Irish!
Muhammad Haggag
Muhammad Haggag
Suggestion : Try using a particle system. There are a lot of tutorials about particle systems on the web.

Waverider
Waverider
An animated texture on a pyramid shape pointing out the back might work. You would need to set up a parameter for the length of the pyramid to simulate stronger fire. It should be alpha blended, and I suppose you could try rendering it front-face only OR back-face only, and see how that looks.

A flare at the center might not look too bad either (make it large when the flame is viewed head on and close, and smaller as the angle of view or distance increases )

[edited by - Waverider on October 31, 2002 3:29:28 PM]
It's not what you're taught, it's what you learn.
lucid999
lucid999
A Particle System or Engine is by far the best way to go. That is how most games implement fire, explosions, confetti, etc.. There is a good paper on particle engines by Andrew Witkin. Try doing a google search for it.
Cuchulainn
Cuchulainn
I have made a semitransparent cone in my 3d prg as an x object and loaded it but when i run my game its not transparent.
If it worked it would be perfect and that complictated particle system could be avoided. I might use it for when my ship explodes though....

Anyway - i would love to know why my loaded x file doesnt show up as semitransparent - is there any option that i have to enable?
this is what i''ve tried so far
g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );

and

d3ddm.Format = D3DFMT_A8R8G8B8;

where am i going wrong.
You'll Never Beat The Irish!
helix
helix
I tried alpha blending my .x mesh as well and didn''t have any luck. I found some functions that gave me access to the vertex buffers so I could modify the alpha in the vertex colors but I never was able to get it working.
Cuchulainn
Cuchulainn
Beoch - i''ve figured it out.

just to let you know.
add



g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCCOLOR);

g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);

to the end of your function that initialised direct3d
You'll Never Beat The Irish!
BrianH
BrianH
If you want to use a texture with alpha blending.. here are the states to set (for just 1 texture stage)

//color operation
//to modulate the material and texture color do this:
SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
//to just select the texture color do this:
SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG2);

//set the color arguments
SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_DIFFUSE);
SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_TEXTURE);

//alpha operation
//to select the alpha value from the material color:
SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
//to select the alpha channel from the texture:
SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG2);

//set alpha arguments
SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_DIFFUSE);
SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_TEXTURE);


edit: by the way, these are in addition to what you already have there.

BH


[edited by - BrianH on October 31, 2002 6:37:12 PM]
Cuchulainn
Cuchulainn
opps - Beoch -
quote:
i''ve figured it out.

just to let you know.
add



g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCCOLOR);

g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);

to the end of your function that initialised direct3d


this doesnt really work - it only makes it semitransparent to itself - not to all other objects.

BrianH - error C2065: ''SetTextureStageState'' : undeclared identifier


i''m presuming i need to include something.

but nothing works
You'll Never Beat The Irish!
Cuchulainn
Cuchulainn
ok i added g_pd3dDevice-> to all of those settexturestage calls.
It runs but it doesnt work - its still not translucent.
You'll Never Beat The Irish!
CpMan
CpMan
Particle engine here. If you want to use it you are welcome to. Use the editor to create an effect, load it with the particle engine source in your code.

Gamedev for learning.
libGDN for putting it all together.
VSEDebug Visual Studio.NET Add-In. Enhances debugging in ways never thought possible.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.