Loading photos as particle textures

edited February 2014 in How To...

I'm working on a project that takes photos and loads them into a particle system, but I'm not sure how to do this efficiently.

I'm trying to accomplish something like this: http://www.firstborn.com/gallery/player.aspx?title=Digital Kitchen&stitle=Processing Demo&file=full_demo&width=952&height=540

Do I load each image individually? Or is there a way to load hundreds of images into particle textures and still keep the framerate up above 40?

Does anyone have any methods they recommend or insight to how I should approach this?

Answers

  • edited February 2014 Answer ✓

    You can load them individually, just don't render them individually. Render them in batches (render all quads with texture one, render all quads with texture two and so on). Or even better: Combine all textures to an texture atlas (using the U/V coordinates to render single images/(parts of the atlas)). Furthermore, avoid too many draw calls, try (display lists)/VBOs/VAOs. If you are familiar with shaders, writing a custom point shader and passing it just the XYZ/UV coordinates and your texture atlas should maximize your performance (point shader reference @ Code listing 10.2).

  • Thanks Poersch.

    So let me try to rephrase and see if I understood what you're suggesting.

    1) Load all images into a texture atlas (1 large texture) 2) use either display lists or VBOs/VAOs for positioning of quads, designating their texture within the texture atlas, and then drawing to the screen once (call a draw of the list/vbo/vao once).

    Is this correct? Does it matter how big the images are and how large that texture atlas is? Am I able to scale these images up and still keep a good quality texture?

  • Answer ✓

    Exactly! The maximum texture- and therefore atlas-size is hardware dependent, it ranges from 2048x2048, over 8192x8192 and 16384x16384 to even higher resolutions. Just look up what your hardware can handle. I think 8192x8192 is a reasonable atlas size, if you really need more space, try the maximum supportet texture size or create multiple atlasses and create particle batches.

Sign In or Register to comment.