[Numpy-discussion] Another Array

Ian Mallett geometrian@gmail....
Thu Apr 9 23:18:15 CDT 2009


Hello,

With the help of this list, over the past two days, I have implemented a GPU
particle system (picture here:
http://img7.imageshack.us/img7/7589/image1olu.png).  Every particle is
updated entirely on the GPU, with texture data (arrays) being updated
iteratively between two framebuffer objects.  Here, 65,536 particles are
drawn at ~50 fps.

Currently, jitter is introduced into the system by means of a "random
texture", which should store random unit 3D vectors encoded into the RGB
channels (vectors point in all directions, positive and negative, so the
vecotr is actually 0.5 long and added to 0.5).  The random texture is
constructed using Python's random number generation, which is noticeably
slower.  I also didn't find an efficient way of creating "random" vectors.
All this contributes to the pattern artifact at the bottom of the
screenshot.  I'd like to use NumPy.

The array should be constructed as n*n*3, with every vec3 being a normalized
random vector with each component in the range [-1.0,1.0].  I could use
numpy.random.random(), but this would not give the appropriate vectors.
Every 3D vector should have the same probability of being chosen.  I don't
know how to do that in NumPy--that's where I need help.

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090409/ca0ecf73/attachment.html 


More information about the Numpy-discussion mailing list