2D texture to GPU particles help

Hallo
I am seeking help to write a shader to be used in the GPU particles library.

The shader will take a texture as input and do a lookup for each pixel of the texture.

The data evaluated for each pixel will be:

  • x coordinates pixel wise

  • y coordinates pixel wise

  • value of the pixel’ s color

The shader will output a texture to be applied to the ConstantGPUtransform shader found in the GPU particles library

The construct of the output texture will follow this order:

The logic of the shader will be:

  • input texture pixel amount == particles count

  • x coordinates pixel wise --> x coordinates of particle >
    > scaling may apply

  • y coordinates pixel wise --> y coordinates of particle >

  • value of the pixel’ s color --> z coordinates of particle > scaling may apply

  • if value of the pixel’ s color == 0 then particle’ s size == 0 > threshold may apply (or alpha == 0 or anything that will make the particle invisible)

tx
Simone

EDIT: patch attached

TextureTo3D.zip (21.6 kB)

i like your idea of input texture pixel amount == particle count!

but as far as i get it you want to assign one color channel of a pixel to 3 parameters (r = x pos = y scale = roll). how do you want to keep this independent from each other?

and beside i vaguely remember that a texture resolution of xxxxx width an 1 heigth is unefficient for the hardware. but dont know if it matters.

I am using the GPU transform of the GPU library, that s the sequence of the transormation as used in that particular shader. I could probably just send my texture to the final shader and rewrite the final shader so that it does the transformation directly but I am learning (slowly) so I am better off modifying an example.

The height is 3 … ?

tx
S.