I am working on a billboarded particle system that has about 10000 particles with different textures. In the past I have created billboarded quads and had one texture with all of the desired images inside. Then I shifted the tex coords appropriately to get a different part of the texture.
I would like to use Point sprites, but can’t find any information about changing the texture coordinates, other than which corner is 0,0.
Sorting the points based on their texture and then binding the texture is too slow. Any thoughts about drawing point sprites with different textures?
Also, I am on iOS, so no shaders.
Thanks in advance.
Have you figured this out yet? I’m looking to do something similar for social media image visualizer. Haven’t quite figured out how to modify the billboard example to display many different images as apposed to the single repeated image.
I couldn’t find a way to change the texture positions with point sprites. So I ended up using a mesh, with a quad for each particle and shifting those texture coords. It was fairly fast because I only had to bind one texture that contained rows and columns of images. I might have been able to pass in the points to the shader with data containing their tex coords, but this worked for my purposes.
I don’t think it’s possible to change the texture coords on point sprites. Please let me know if you figure out a way.
Do you have any good references or examples that helped you with your work?
What about moving the camera around, how did you handle keeping the texture faces facing the camera?
There is a pretty good write up by Vanderlin on the forum. It includes links about how to orient the billboards to face the camera.
I’m following that thread, I tried to get his version 3 that he shared on the forum, but it’s no longer available. Going back and reading up the GL tutorial on the OpenFrameworks site to help decipher the information discussed.
I thought he originally did what you’re doing using a point and a quad, but changed it up so he wouldn’t have to store 4x the number of points by using point sprites, I must have misread that.
I think he eventually uses point sprites to reduce the number of vertices. But I was unable to figure out if it is possible to shift the texture coords while using point sprites. If you want to use quads, you can use the camera right and up vector to rotate them accordingly.
Thanks again Nick,
Do you have any recommendations for examples to learn Quads and using them?
You could try taking a look at ofMesh::plane. It might be a little more than you need, but you could use that to create your quads. Keep in mind that the function sets non-arb textures by default. Meaning that the texture coords are 0-1 and not 0 -> imageWidth. So be sure to call ofDisableArbTex() before loading any textures if you want to use 0 -> 1
I’ve found an example of particle systems using Textured Quad Arrays (opengl?), it’s quite old, would you recommend building one out of ofmesh::planes instead?