Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: how can to realize fire effect with opengl

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Tianjin ,China
    Posts
    12

    how can to realize fire effect with opengl

    I want to use procedural texture ?

  2. #2
    Intern Contributor
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    97

    Re: how can to realize fire effect with opengl

    In a fragment program or run on the cpu? Both are the same in essence, but different in applying it.

    To do it on the cpu, have a base fire texture kept in memory, and a 2d array of random values. Each frame (or every couple frames), loop through your texture, creating a new texture in memory, but offsetting the pixel data by the values in the 2d array (mentioned earlier), which you should scroll through.

    To do it on the gpu, have a base fire texture on the card, and a texture full of random values (our 2d random value array). Do a dependant texture read into the random value texture, and use the values from that to offset the UV coords of the fire-texture, do a texture read from there, and output that to the frame buffer.

    Both can give a nice flickering fire effect, when done right. Hope that helps

  3. #3
    Member Regular Contributor
    Join Date
    Feb 2002
    Location
    Hamburg, Germany
    Posts
    413

    Re: how can to realize fire effect with opengl

    the nvidia OpenGL SDK provides good demos(+sources) for this effect

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    748

    Re: how can to realize fire effect with opengl


  5. #5
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Tianjin ,China
    Posts
    12

    Re: how can to realize fire effect with opengl

    I want to create fire effects based on procedural texture ,or say Perlin `s noise .
    and u can give some suggest .
    thanks .

    Originally posted by DopeFish:
    In a fragment program or run on the cpu? Both are the same in essence, but different in applying it.

    To do it on the cpu, have a base fire texture kept in memory, and a 2d array of random values. Each frame (or every couple frames), loop through your texture, creating a new texture in memory, but offsetting the pixel data by the values in the 2d array (mentioned earlier), which you should scroll through.

    To do it on the gpu, have a base fire texture on the card, and a texture full of random values (our 2d random value array). Do a dependant texture read into the random value texture, and use the values from that to offset the UV coords of the fire-texture, do a texture read from there, and output that to the frame buffer.

    Both can give a nice flickering fire effect, when done right. Hope that helps

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,411

    Re: how can to realize fire effect with opengl

    If all you're doing is scrolling the texture, you're better off doing that with the texture matrix, than trying to scroll the bits in memory.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  7. #7
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    211

    Re: how can to realize fire effect with opengl

    another topic would be "real" fire, made out of polygons; does anyone have a solution for this ?
    Or is there a modelling-plugin outside there, which can create procedural fires ? this would be an interesting peace of software, i think.
    DJSnow

  8. #8
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    442

    Re: how can to realize fire effect with opengl

    Its quite easy to generate procedural fire in a program like 3D Studio Max ( Fire effect ). I guess you could generate a fire movie and billboard it in game. I'm not too sure about actually procedurally generating the effect in real-time. I'm not sure what you would gain from doing this - its quite an intensive procedure anyway ( max takes ages to do fire effects ). Would be an interesting demo to hack I guess.

  9. #9
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    211

    Re: how can to realize fire effect with opengl

    @robbo:

    >>Would be an interesting demo to hack I
    >>guess.

    yes; that's the reason why i want to do it ! (or let me say "why i would do it, if anyone could tell me a program that generates geometric flame meshes)
    DJSnow

  10. #10
    Member Regular Contributor
    Join Date
    Feb 2002
    Location
    Hamburg, Germany
    Posts
    413

    Re: how can to realize fire effect with opengl

    Originally posted by DJSnow:
    another topic would be "real" fire, made out of polygons; does anyone have a solution for this ?
    Or is there a modelling-plugin outside there, which can create procedural fires ? this would be an interesting peace of software, i think.
    what about volumetric rendering ? (remeber: "volumetric rendering" does mean much more than some fog-on-the-ground-and-cloud-effects.)

    i don't know where to get it but at the last siggraph, there was an excelent paper about this topic:

    "Physically Based Modeling and Animation of Fire" written by Duc Quang Nguyen,Ronald Fedkiw,Henrik Wann Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •