Author Topic: Smoke?  (Read 16134 times)

0 Members and 1 Guest are viewing this topic.

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
I just started to play FS2 Open using the hires media, and when firing rockets I noticed they had no smoke trail! I think having missiles expel smoke from their thrusters would look just awesome in FS2. I have implemented a simple particle emitter in D2X-XL that shouldn't be too hard to adapt to FS/FS2 open.

I cannot do it as I don't know the FS code, but I would certainly help as much as I can. What you basically have to do is to create a smoke emitter, set it up with a few parameters like smoke density, particle size, particle lifetime, attach it to an object, update its position as long as the emitting object is alive and kill if if the object gets destroyed. It's really not hard.

How about it? I would look fricken awesome.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
A lot of missiles leave trails, but I believe these are generally ribbon-like textures instead of particle effects. I'm not an expert on the code, so somebody with more know-how should probably comment on it.

One big concern is performance.


 

Offline Flipside

  • əp!sd!l£
  • 212
Missiles already use particles, and the Engines had an inbuilt particle system as well, but I'm not sure if it's still implemented.

The problem was that the original 'puffs' used in game could not be black because they were multiplied (iirc) which the screen value, however, that's been fixed, for example, I believe the Babylon 5 Mod uses black smoke effects.


 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
What I have seen so far in-game looks pathetic and not like a real nice smoke trail. Watch this: http://www.descent2.de/downloads/movies/d2x-xl-volcano-part-1.wmv , and you'll understand what I'm talking about.

The original missile trails probably are just short fire trails.
« Last Edit: May 06, 2009, 02:43:03 pm by karx11erx »

 

Offline Flipside

  • əp!sd!l£
  • 212
The original missile trails are just stretched Bitmaps, FSO has a seperate particle system added for missiles. the particle system itself is a standard particle ejection/lifetime/fade system, so the quality of the output depends totally on the quality of the images/animations used. And the fact is that smoke is the only media in that entire video that is of a higher quality than FSO, and you can see the frame-rate plummet whenever there is a large amount of smoke in view.

BTRL doesn't use black smoke, more light grey, but this gives an idea of the newer particle system in action:

http://www.youtube.com/watch?v=0yoxcWYehyI


 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
That looks pretty neat. That's what I would like to see in FS/FS2 Open. Framerate for that kind of particle system depends very much on the graphics card's fill rate, and the closer you get and the bigger the smoke appears, the slower it will get - unless you have fast gfx hardware.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
BTRL is, in fact, running on FS2Open, so it appears the system is ingame and working fine.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
And that's before you get to the fact that the video is at least a couple of years old.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Flipside

  • əp!sd!l£
  • 212
http://www.hard-light.net/wiki/index.php/Weapons.tbl#.24Pspew:

That's the wiki entry for the particle system, might be handy :)

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
So how do I enable smoke trails for missiles with that info?

 

Offline Flipside

  • əp!sd!l£
  • 212
You need to edit the weapons.tbl and add the PSpew function to the required weapon:

http://www.hard-light.net/wiki/index.php/Weapons.tbl#Weapons_Table

The factors for the PSpew function are:

# +Count:

    * Defines how many particles are spawn when they are ready to be created
    * Syntax: Integer

# +Time:

    * Defines the time in milliseconds between next particle(s) spewed
    * Syntax: Integer, milliseconds

# +Vel:

    * Defines the created particles velocity as percentage of the weapons velocity
    * Syntax: Float

# +Radius:

    * Defines the size of the created particles
    * Syntax: Float, meters

# +Life:

    * Defines how long the particles last.
    * Syntax: Float, seconds

# +Scale:

    * Defines the particle spread. Small value will make particles group together
    * Syntax: Float

# +Bitmap:

    * Defines the animation used to create the particle spew effect
    * Syntax: String, filename

You need to add 'Particle Spew' to the weapons flags and add the PSpew details later on in the table, though it'll need someone else to clarify where, it's been a while since I modded those tables ;)

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
i did write some high level particle code that would make particle effects more versitile. the problem is the low level particle code was designed for a small number of detailed particles, instead of a larger number of more primitive particles. using point sprites instead of quads would probibly allow for more particles. there have been some issues with point sprites so quads are still used. i think these issues arise from the fact that point sprites were always intended as primitives, not to be used in place of detailed sprites.  could add an alternative render meathod to use pointsprites and a small texture/rgba vaule.

ive done some nice smoke effects with the current particle system, but it tends to slow up the game a lot.
« Last Edit: May 06, 2009, 07:32:10 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
D2X-XL's smoke doesn't slow the game down very much, unless you're up close and there's a real lot of smoke (or you have a weak gfx card - fill rate, again). The original particle system probably was rather built to create a fire effect which doesn't have many particles.

Flipside,

I had understood I have to modify these tables, but I don't know where they are in. Are they plain text? And what has the particle bitmap's format to be (1xM frames stacked vertically, or NxN frames, where N = sqrt (M)?)

Edit:

Can someone point me to the latest FS2 source code? I have read you'd like to have shadows, too. ;)
« Last Edit: May 07, 2009, 03:06:07 am by karx11erx »

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Thanks. I hope so much there's a Visual Studio solution available for fs2open ... :rolleyes:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Yep. For VC6, 2005 and 2008 (although the middle one might be a little out of date since I don't think anyone still uses it).
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Thanks. Got the source code now.

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Is it right that rendering has not been optimized at all, using vertex buffers and stuff like that, but that it has been left pretty much in the original state, apart from finally calling OpenGL to render primitives? It looks like a model is rendered face by face, setting up everything as required for that face.

The entire code looks like being pretty much in the original state and just having had the file extensions changed from .c to .cpp.

Can that be?

Edit:

I just found the code where particles are emitted from ship thrusters if the afterburner is on. The thruster renderer explicit calls the particle emitter during each render pass, telling it how many particles to emit to which direction ... there is no encapsulation of that functionality, not even on file base. That's horrible.

In D2X-XL you simply create an emitter, tell it the desired smoke density (which translates into particles per second), and all you have to do is to update its position and direction every frame and then tell it to update itself ... it will then create new particles and shove them over to the transparency renderer which takes care of all transparent stuff.

D2X-XL's model renderer sorts all faces by properties and then renders all faces with identical properties in one batch, using OpenGL transformation, hardware lighting and vertex buffer objects. Once the VBO is loaded there never has any render data to be sent to OpenGL except for texture handles, buffer indices and lengths. I have completely abandoned the face by face lighting and rendering code quite a while ago.

Sorry for being so straight forward, but: What did you do with the FS2 source code in all the years you had it? I had expected significant optimizations using OpenGL having been done already. I have to say that my first impression from poking around in the code leaves me a bit surprised and rather disappointed.
« Last Edit: May 07, 2009, 05:12:38 pm by karx11erx »

 

Offline Rhymes

  • Galactic Mediator
  • 29
  • Fatum Iustum Stultorum
Yeah, but this isn't D2X-XL.  The engine behaves differently, and even if putting the feature in works the same way, you also have to make it WORK.  D2X-XL may have a similar goal, but Descent is an FPS, FreeSpace is a space sim.  They work differently.
If you don't have Knossos, you need it.

“There was a button," Holden said. "I pushed it."
"Jesus Christ. That really is how you go through life, isn't it?”

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Go ahead and start fixing it. I'm sure the rest of the team will be happy to have the help. I believe a total rewrite of the graphics code has been under discussion for a while, but from what I know, it's rather problematic.

Your input would doubtless be welcome, but the team here is close-knit - I'm sure they'd be happy to work with you just as long as it sounds like you'd be happy to work with them!

As for what they've been doing the whole time, you can go check out a list of features that have been added to the SCP. I think you'll agree that a tremendous amount of progress and improvement has been made.
« Last Edit: May 07, 2009, 09:40:46 pm by General Battuta »