Author Topic: A question about effects...  (Read 24925 times)

0 Members and 1 Guest are viewing this topic.

Offline Nighteyes

  • 211
A question about effects...
I would like adding some new effects to the game, but I have no idea how to convert a *.avi to the files of the game...
anyone here has a clue? I want to break it up to frames, and also for it to keep trancperacy so it will look normal in the game :)

 

Offline Angelus

  • 210
  • The Angriest Angel
Re: A question about effects...
I would like adding some new effects to the game, but I have no idea how to convert a *.avi to the files of the game...
anyone here has a clue? I want to break it up to frames, and also for it to keep trancperacy so it will look normal in the game :)

Avi is a video file, so get VLC Media player, it's free and it can save screencaps from the video.
You can play the vid in slow-mo and take as many caps as you need.
The pics can be saved in png and jpg format.

not so FREE Alternative:

Get Fraps ( not free ), and configure it for screenshots, taken every second.
Put the video you want to capture on slowmo (with VLC-player its 0.13 speed) and start capturing.

« Last Edit: April 24, 2009, 02:33:47 pm by Angelus »

 

Offline Nighteyes

  • 211
Re: A question about effects...
Thanks for the info about VLC, ill do that :)
but about the frames saved as jpg, will the game know that black is transparent? wont it just put a black box with the effect in it?
another question, do you know how the 2d shockwave mechanic works in the game? what I mean is, is the 2d plane expanding or is it a set size and the animation itself is expanding?
hopefully ill have something to show in a while, but I'm still learning this stuff :) but I do have some ambitions in mind :)

 

Offline blowfish

  • 211
  • Join the cult of KILL MY ROUTER!!!!!!!!!!1
Re: A question about effects...
The game knows black is transparent, assuming the format you use has no alpha channel.  Also, don't use JPG.  Ultimately, you want the files to be in DDS format (probably DXT1 or U888, if that means anything).  Also, you will need to name them all correctly (i.e. myeffect_0000.dds, myeffect_0001.dds, etc), and create a corresponding EFF file (look in the mediavps for examples of those).

 
Re: A question about effects...
I'd say to download VirtualDub, a truly useful piece of freeware. It's not hard to learn, but it can do a lot. It can, for example, convert an AVI to an image sequence.

 

Offline Nighteyes

  • 211
Re: A question about effects...
The game knows black is transparent, assuming the format you use has no alpha channel.  Also, don't use JPG.  Ultimately, you want the files to be in DDS format (probably DXT1 or U888, if that means anything).  Also, you will need to name them all correctly (i.e. myeffect_0000.dds, myeffect_0001.dds, etc), and create a corresponding EFF file (look in the mediavps for examples of those).
is it better to use an alpha channel? or I shouldn't worry about that?

  

Offline blowfish

  • 211
  • Join the cult of KILL MY ROUTER!!!!!!!!!!1
Re: A question about effects...
Don't worry about it.  It's commonplace to use effects without an alpha chennel (the game uses additive blending for such effects).

 

Offline Nighteyes

  • 211
Re: A question about effects...
An update, my idea is to use this effect for the shockwave *.eff, so that capital ships will explode in a more dramatic way :)
I also plan to look into the "flashy deaths" script someone put up here, can be interesting  ;)
only problem is that the animation has quite a bit of frames(30 frames per second, about 18 seconds, 800x600)... but I'll deal with that in due time :)

By gbtf67 at 2009-04-25

By gbtf67 at 2009-04-25

By gbtf67 at 2009-04-25

By gbtf67 at 2009-04-25

 

Offline blowfish

  • 211
  • Join the cult of KILL MY ROUTER!!!!!!!!!!1
Re: A question about effects...
Also, I fogot to mention.  The resolution should be a power of two (i.e. 512x512 or 1024x1024)

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: A question about effects...
Should this be moved to Modding forum? Seems (at this point) more related to there than here.

The explosion itself looks nice, although a tad artefacted (although seeing it's an animation it would hardly matter aside from screenshots). I'm just curious about the intellectual property. Where does it come from? Who made it and would they mind if it were used in the MediaVP's?
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Nighteyes

  • 211
Re: A question about effects...
I'm aware that stock footage is expensive, but what I did is edit clips from www.detonationfilms.com, they offer free stock footage, as well as some clips from *cough*google video*cough* :eek:, and these I think were free samples at a very low resolution of 320x240... nothing you can really use... but in After Effects I edited them all together and added some glow.  :cool: but still, there is more work that needs to be done...

 

Offline Nighteyes

  • 211
Re: A question about effects...
can you tell me how to make an  image sequence from avi in Virtualdub? looked at the wiki but couldn't find it...
I'm also guessing it doesn't know how to save as dds, probably as jpg, and then ill need to convert it to dds? I have paint.net, and it can convert to dds, but will i need to convert it manually frame by frame?? that can be a very long and boring task :)
 

 

Offline Nighteyes

  • 211
Re: A question about effects...
I also forgot to ask, I'm currently rendering it at 30 frames per second, 512x512, is that good enough for in game?

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: A question about effects...
can you tell me how to make an  image sequence from avi in Virtualdub? looked at the wiki but couldn't find it...
I'm also guessing it doesn't know how to save as dds, probably as jpg, and then ill need to convert it to dds? I have paint.net, and it can convert to dds, but will i need to convert it manually frame by frame?? that can be a very long and boring task :)
 


I suggest exporting into a lossless format like bitmap or TGA rather than JPG. FS2_Open can use TGA files, which means that you can use them as work copies, and only after you have finished the work on the animation you should use a batch converter like nvDXT to convert all the files to DDS. That part is not really a problem.

VirtualDub's image exporter works by selecting Export -> Image sequence and setting up the directory and file name and format. Targa files are what I would use for this kind of purpose.

30 frames per second 512^2 is very much sufficient as far as quality goes. How many frames is the effect in total though?
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Nighteyes

  • 211
Re: A question about effects...
about 15 seconds...

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: A question about effects...
Hmmm...

15 x 30 x 174,904 bytes...

That's 450 frames and it makes up to 78,706,800 bytes. For DXT1 compressed DDS files, that is.

It's a huge effect. :nervous: I'm not saying it can't be used but... damn, that's a heck of a long animation anyway. Normal FreeSpace explosions last like few seconds at maximum.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Nighteyes

  • 211
Re: A question about effects...
First of all, I want to thank all who replied here, because in only 2 days i got this in the game :)
but! there are a few problems yet!
first, the nvDXT didn't want to work :( so I used another converter from tga to dds... the strange thing was, that after conversion, instead of 70mb(tga) it was 188mb(dds)!!! good compression hu?  ;)
second, the game doesn't recognize tga files... tried with them, and changed the *.eff to tga, but it didn't recognize the files... so I used the dds files instead  :D 188mb video memory here we go!!
well, it worked :) but two more problems came about...
first, big ugly and very not transparent black box around the effect  :eek2:
second, the effect only plays for 1/4 way through and dissapears...  :(

By gbtf67 at 2009-04-27

By gbtf67 at 2009-04-27
oh, and is there a way to make the ships exploding time longer? the whole breaking from middle to sides thing...

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: A question about effects...
First of all, I want to thank all who replied here, because in only 2 days i got this in the game :)
but! there are a few problems yet!

You're welcome.


Quote
first, the nvDXT didn't want to work :(


How does it not work?

Does it just not start when you type nvdxt on command line? It should show you an instructions page, but if it's showing something like "unknown command":

Did you check that it's in your PATH variable?

If it's not, you need to add the location of the nvDXT.exe into your PATH in order to be able to use it from other directories. The installer should have done this, but if you didn't restart Windows after installation, the PATH doesn't automatically update.

You can check what is in your path by running Windows->Start->cmd and entering command PATH. It prints the currently active PATH variable (it's probably a long string of directories). If C:\Program Files\NVidia Corporation\DDS Utilities is not there, the program won't work except if you run it directly.

In case you just don't know how to get started with it, here's what I would use:

Navigate to your image directory first, then enter
> nvdxt -file *.TGA -dxt1c -quality_highest -Triangle

Quote
so I used another converter from tga to dds... the strange thing was, that after conversion, instead of 70mb(tga) it was 188mb(dds)!!! good compression hu?  ;)

Okay, here's how it works: DDS files can take more space on hard disk than RLE compressed TGA files.

Run Length Encoding is a lossless format of compression that basically converts the pixels of the bitmap into a line of data, and blocks of pixels that have same colour can be marked as, for example, 512 x #000000 instead of 512 entries of #000000, so it can take a lot less memory in situations like this.

However, when the game reads a TGA file, the amount of video memory it takes is the amount that an uncompressed bitmap takes. For a 512^2 24bit file, this is about 768 kilobytes. It is not a coincidence that a non-RLE-encoded TGA file of size 512^2 is almost exactly this size.

To understand why games benefit from DDS files, you need to know that the DXT compression doesn't need to be decompressed like the run length encoding of TGA files. Video cards can use DXT compressed files directly, without opening them to full uncompressed bitmap size, and that's why they are beneficial in games. That, and the in-built mipmapping feature saves resources as well.

Typically, DXT1 compression reduces the size of single layer to about 1/6th of uncompressed data. DXT3 and DXT5 to about 1/4th of uncompressed data. DXT1 doesn't have alpha channel, while DXT3 and DXT5 have. For an effect like explosion we don't want an alpha channel, so you should use DXT1 compression.

Quote
second, the game doesn't recognize tga files... tried with them, and changed the *.eff to tga, but it didn't recognize the files... so I used the dds files instead  :D 188mb video memory here we go!!

Does too recognize TGA's. You're doing something wrong; describe how you set up the TGA files and the *.eff file.

And no, the whole effect isn't in the video memory all the time. If the DDS files take 188 MB of space, you do spend 188 MB of system RAM as the files are cached there, but as far as I know and if I haven't mistaken anything, the video card only uses one frame at the time. It doesn't (and it can't) keep all the effect frames in it's dedicated memory all the time, it would be full before you can say DIVE DIVE DIVE.


Quote
well, it worked :) but two more problems came about...
first, big ugly and very not transparent black box around the effect  :eek2:


This means you converted to a DDS format that has alpha channel. This is bad because the original images probably don't have alpha channel so the DDS converter builds a completely opaque alpha channel for the file and... yes, you guessed it, now it has the black on edges specified as opaque. My guess is your DDS compressing software defaults to DXT5.

Save it without alpha channel (into DXT1 format) and it should work. Alternatively, use the u888 format, which means "uncompressed, three 8-bit channels" aka uncompressed RGB file. These DDS file types do not have alpha channel.

Although you should get it working with TGA's as well. It will save you trouble in the future if you learn that kind of things in the beginning.

Quote
second, the effect only plays for 1/4 way through and dissapears...  :(

By gbtf67 at 2009-04-27

By gbtf67 at 2009-04-27
oh, and is there a way to make the ships exploding time longer? the whole breaking from middle to sides thing...

Can't help you with the effect ending prematurely; that sounds like a code-enforced limit to length of the animations. You could run debug build, and the debug log will likely tell use why it's cutting the animation short. It might also give clues as to what goes wrong with the TGA version.

Ships' dying times can be changed in the ships table files but I have no real knowledge on that field, and ships dying generally tend to be pretty mystic and partially random procedure (death time depends on the amount of damage taken at the time of death or somesuch stuff...).
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Nighteyes

  • 211
Re: A question about effects...
Got it working :)
the nvDXT didn't work because I didn't restart...
The way I set up my TGA files was the same way I did the dds, named all of them correctly, and in the eff file changed $Type:DDS to $Type:TGA, did I miss something?
about the animation cutting short, ill deal with that tomorrow :) I'm going to sleep...
meanwhile I used another shorter explosion I made...
b.t.w aren't the main two explosions in the game called ABexp05 and 06? wanted to test it on a ship not a shockwave  :lol:

By gbtf67 at 2009-04-27

 

Offline Nighteyes

  • 211
Re: A question about effects...
Hmmm...

15 x 30 x 174,904 bytes...

That's 450 frames and it makes up to 78,706,800 bytes. For DXT1 compressed DDS files, that is.

It's a huge effect. :nervous: I'm not saying it can't be used but... damn, that's a heck of a long animation anyway. Normal FreeSpace explosions last like few seconds at maximum.
lol I know :) but its meant to be used only when capships explode, not every second, I tested it with about 5-6 capships exploding, and my comp didn't mind at all :)
I also have a strange problem, when i renamed the effect to exp04\exp05\exp06, the game didn't use my *.eff file, but instead used the original VP file, that was the thing that cut it off, it ended after only +-90 frames... what was more strange was when i renamed it to shockwave01 it works fine, playing all the frames as needed. (only works with shockwave01, renaming back gives the cut off version=not using my eff file)
now I want to test it with this script: http://www.hard-light.net/wiki/index.php/Script_-_Flashy_Deaths_(new)
but I dint know how to add scripts... i created the files needed in notepad, but where do i place them and where do i activate it?
I think the explosion looks really nice ingame :) shall i make a video?

By gbtf67 at 2009-04-28