Jump to content
  • Advertisement
Sign in to follow this  
asafpolt

effects in directx

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, i'm kind of a newcommer to directx and I have a question: I want to have an explosion effect in my game. The thing is, I know that there are X files that can be loaded to display meshes. My question is are there similar files for effects. Thanks, Asaf, Israel.

Share this post


Link to post
Share on other sites
Advertisement
Hi asafpolt,
How are you doing?

In directX, you are provided with a number of different approaches to do explosions or effects.

1) You can load a mesh that has an explosion and use the animation of the mesh. This will be bloated though.
2) You can use the ID3DXSprite interface to create what you would call a particle system. The nice things about sprites are is that they are billboarded which means they always face the camera and you don't have to worry about that.
3) You can use a textured quad (2 triangles drawn with IDirect3DDevice9::DrawPrimitives). Here you have to make sure that the quads are always facing the camera.

Pick your option and play with it. Someone else might have more solutions :)
Have fun, I hope I've added some insight to what you were looking for.

Share this post


Link to post
Share on other sites
Thanks Armadon, still I would like to hear some more sugguestions
and if antone can expand what was written on the 2nd option (with the sprites)
thata would be great.

Share this post


Link to post
Share on other sites
You could use a volume texture to store the animation, every stage of the volume texture presents one frame (picture) of you animation and you change the stage of the texture to draw every frame.

If you don't know, Volume textures are 3D textures and to give a vertex a texture coord you need a 3d vector instead of a 2d vector, the z (in texture coords called w) part is the depth of the texture, in the case of an animation it's the frame you want to display.

It's a way to make animated sprites, but some graphic cards don't support them.

Share this post


Link to post
Share on other sites
Quote:
Original post by asafpolt
... I know that there are X files that can be loaded to display meshes. My question is are there similar files for effects.


Hi Asaf,
Effect files have a .fx file extension. See the documentation in the SDK help file for the functions D3DXCreateEffectFromFile and D3DXCreateEffectFromFileEx.

Also check out the "Effect Edit" utility which comes with the SDK. This utility enables you to create, load, edit, save and test effect files.

HTH,
Cambo_frog

[Edited by - Cambo_frog on July 30, 2005 11:53:10 AM]

Share this post


Link to post
Share on other sites
I think you are confusing the ID3DXEffect interface, known as "effects" in direct3D, with the concept of "special effects" such as explosions, glows, etc.

Effect files in D3D are simply a way of combining pixel and vertex shaders with render and sampler state changes all contained in a handy (.fx) file format.

Special effects in games is a huge topic usually involving the use of billboarded semi-transparent polygons or sprites alongside blended geometry to create various phenomenon such as fire and smoke.

Share this post


Link to post
Share on other sites
Quote:
Original post by Source
I think you are confusing the ID3DXEffect interface, known as "effects" in direct3D, with the concept of "special effects" such as explosions, glows, etc.

Effect files in D3D are simply a way of combining pixel and vertex shaders with render and sampler state changes all contained in a handy (.fx) file format.

Special effects in games is a huge topic usually involving the use of billboarded semi-transparent polygons or sprites alongside blended geometry to create various phenomenon such as fire and smoke.


Hi Source,
I asume you were repling to me.
Yes I agree, I may have had a misunderstanding of terminologly here ("effect", "effects").
I was refering to ID3DXEffect.
To the OP (Asaf), if you were using this terminology in the general sense (per Source' post) then there is no direct support for this, using a file format directly supported via the DirectX SDK.

Sorry for any misunderstanding,
Cambo_frog

Share this post


Link to post
Share on other sites
Sorry Cambo_frog, I wasn't really implying that, I assumed from the subsequent posts that the OP had skipped the distinction.

To the OP: A special effect can have any file format that you choose - it is entirely dependent on your engine. You could create your own format to create particles at certain times and create geometry with certain parameters: there is no "standard" format as yet (perhaps you could attempt to create one?).

The alternative to file formats is of course scripting - which is really a general file format for any operation - this can be slower than a set format, but of course gives you unlimited flexibility as long as you expose enough functionality from your engine to the script layer.

Share this post


Link to post
Share on other sites
Quote:
Original post by Source
Sorry Cambo_frog, I wasn't really implying that, I assumed from the subsequent posts that the OP had skipped the distinction.

To the OP: A special effect can have any file format that you choose - it is entirely dependent on your engine. You could create your own format to create particles at certain times and create geometry with certain parameters: there is no "standard" format as yet (perhaps you could attempt to create one?).

The alternative to file formats is of course scripting - which is really a general file format for any operation - this can be slower than a set format, but of course gives you unlimited flexibility as long as you expose enough functionality from your engine to the script layer.


Hi Source,
Just re-thought that .x files could "support effects" in the general sense as the .x file format is very open, but would involve doing your own .x file parsing.

Maybe a general scripting language could be better though.
Do you know of any references, samples, examples or tutorials of using a scripting language in a DirectX app?

TIA,
Cambo_frog

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!