Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Jan Dohl, posted on November 20, 2000

Image Description, by Jan Dohl

here's my entry for the Screenshot of the day. It shows the showing-part of my experimental particle system at work. The showed effect is a fire effect with distraction to the lower right corner and some flight-range overgrowth so that it looks little more chaotic ;).

Some words about the program itself: It currently consists of 2 parts. The creator and the shower. I divided this cause the creator uses MFC and I guess performance would be much lower if I had implemented the shower also into that. The particle system has following features:
  • unlimited amount of particles (ok, limited by performance ;)
  • 100 color-steps per particle (you won't need more, believe me)
  • Horizontal and vertical distraction
  • Flight-range overgrowth
  • Up to 10 gravity points with pos/neg gravity (easily extendable, but it's unlikely that you'll need all 10 and more)
  • The rendering is an additive effect that makes everything a little more interesting because some cool effects were caused that weren't originally planned (But it's cool to have them ;). Well, in the shower module you can move the particle spawning point around and so cause fire-trails a.s.o. The only serious use I can now think of is testing particle effects before implementing them. Apart from that it's a nice toy and fine to look at *hopefully*.

    And that's it. If you know an effect that I could implement, don't hesitate to post it here or to drop me a mail. BTW: All other mails like questions, suggestions, flames a.s.o. are also welcome. Send 'em to:

    Ok, hopefully my English wasn't too bad at all ;).

          --- Polygon ---

    Image of the Day Gallery


    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
    John van der Burg

    November 20, 2000, 02:46 PM

    Nice! :)
    Keep on the good work.


    November 20, 2000, 03:15 PM

    Very Cool! And your English was better then my next-door neighbors (I'm American).

    Any chance you would post the source?


    November 20, 2000, 03:29 PM

    "the creator uses MFC"

    Sweet! I always thought He used divine holiness :)

    The shot looks nice. You might want to turn up the resolution though (make the particles smaller, and more of them)


    November 20, 2000, 03:35 PM

    Hmmm.... i did once a particle system with separated parts to one company... it was modifier driven (everything was a modifier) including the particle decaying and the color, shape (was API independent, the shape was just a callback) gravity, collision etc. and one demo looked like this shot, but uglier, this looks pretty nice... maybe you can apply some motion blur to the particles, it looks nice in any particle system... btw, how's the fps? is it OGL?
    why MFC?

    Dion Picco

    November 20, 2000, 03:56 PM

    When using additive blending, are you sorting from back to front in order for the adds to work within the confines of a z-buffer? Otherwise the addition blending doesn't work right?


    November 20, 2000, 04:22 PM

    Turn off the z-buffer writes, and turn on z-buffer tests.
    If you are using OpenGL this should to the trick:

    glEnable( GL_DEPTH_TEST );
    glDepthMask( GL_FALSE );

    // draw the particles

    // resture the state
    glDepthMask( GL_TRUE );

    I remember once sorting all the faces because I didnt know anything about the depthmask stuff. DirectX/3D should have the same thing.


    .ps. that case-sensitive tag sucks ;)


    November 20, 2000, 04:35 PM

    Great work

    Rui Martins

    November 20, 2000, 04:45 PM

    >Turn off the z-buffer writes, and turn on z-buffer tests.

    I dont' get it ! how does that make for a correct back to front blending ?

    What you actually do is:

    if (Particle_Z nearer then Frame_Buffer_Z)
    Do Nothing

    Now this will only work, if you provide the particles in the correct back to front order.

    In the event that you start with the exact oposite order (FRONT to BACK), your blending will be completly trashed.

    But it should provide a funny / pseudo random blending, as soon as the particles move arround.

    >I remember once sorting all the faces because I didnt know anything about
    > the depthmask stuff. DirectX/3D should have the same thing.

    You should check your knowledge about correct blending too, no pun intended.

    Until now, no one has invented another correct way, besides BACK to FRONT order, for transparent objects/polys/particles/whatever..

    See ya

    zed zeek

    November 20, 2000, 05:05 PM

    nice one
    but how does it look with a green background instead of black?


    November 20, 2000, 05:51 PM

    But if you're doing additive blending it doesn't matter what the draw-order is... I mean, adding 2+5 will give you the same result as 5+2.

    Chris Killpack

    November 20, 2000, 05:55 PM

    memon is correct. You need to turn off at least z-writes otherwise the rendering looks horrible. If you turn of z-test then your particles will not buffer correctly against other geometry in the scene (a landscape, or wall for example)

    In addition the particle system uses additive alpha blending which is sort-independant.

    A + B = B + A

    This is the main reason that people use additive alpha for particle systems - 1000's of particles can be thrown around without a need to sort them.

    Most other forms of alpha blending require back-to-front sorting because they are draw order dependant.



    Alex Taylor

    November 20, 2000, 07:57 PM

    Irony is accepting e-mail "flames" for this image. Oh that's a terrible joke.


    November 21, 2000, 12:35 AM

    Nice pic!
    I really like particle systems you can do so many things with them

    By the way I wonder why so many video cards don't support some real life blending modes like the GeForce does. For exemple
    glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR);

    produces a more realistic effect especially when it comes to draw some water. Maybe for a particle system this mode isn't useful though...

    anyway, keep up the good work!


    November 21, 2000, 04:50 AM

    Nice work!
    Particles are great if used with creativity.
    what about a downloadable demo? :)



    November 21, 2000, 05:09 AM

    hehe,... lol!


    November 21, 2000, 01:02 PM

    Little late to answer questions, but I wasn't @ home when it was IOTD... Anyway:

    Vorteks: Perhaps I make a code of the day entry with the source-code. Hopefully they post it ;).

    Betelgeuse: Hi-Res is planned...

    Chiguire: It's plain DirectDraw and runs with 1500 particles @ 25 FPS on a PII 266 with 4MB ATI-card (hey, such a config is fine 4 optimizations ;)

    Dion Picco: I don't use any sorting because it makes no difference in which order the particles are drawn.

    Ahyes, when the program is finished, I'll post it 4 downloading and testing.

    This thread contains 16 messages.
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.