Stage3d vertex info from GPU to flash

Software: Other

MacShrike, Newbie
Posted: 09 September 2014 07:41 PM   Total Posts: 12

Ls,

Im trying to use/abuse the GPU for some heavy calculations.
I can create a vertex shader to manipulate the vertices of a mesh containing the xyz’s that I need
But I dont know how to read back the changes made by the vertex program to the vertex coordinates.
So Im not making translations in flash and feeding them to stage3d, but i want to do it the other way around.

I thought about combining it with a fragment shader to put the xyz vertices coords as rgb pixels in a texture.
But then, how to read the texture in flash?
I could perhaps do a stage3d createbitmap, but I hear thats very slow.
Could I access the backbuffer directly?
I only need about 100 pixels for info storage so a 10x10 stage/texture would suffice.

Thx for reading this far.

Regards,

M

   

Avatar
theMightyAtom, Sr. Member
Posted: 10 September 2014 06:16 AM   Total Posts: 669   [ # 1 ]

Interesting problem smile
As far as I’m aware, you can’t access data sent to GPU.
The way I would do it would be to have an AS3 version of the same algorithm, so I could read the data from that after a certain number of iterations.

I experimented with image based xyz data some years ago. It worked really well, and flash could easily read the data, with getPixel in realtime.
http://videometry.blogspot.dk/2011/09/introducing-atomizer.html
http://videometry.blogspot.dk/2011/09/playing-havok-with-flash-11.html

If you could describe the app, maybe there are other possible approaches.

Cheers!

   

MacShrike, Newbie
Posted: 10 September 2014 11:23 AM   Total Posts: 12   [ # 2 ]

You sir, are a god!
That curtain thing is very impressive indeed.

Thank you for your time and skills,

This might just work.
Im getting all kinds of replies saying I should leave the poor GPU alone to run free (cyber environmentalists yuk! =))

I have this flock (its actually a space armada) that I want to navigate around stuff and each other, as flocks tend to do.
With 50 boids, the cpu starts buckling, and who wouldnt.

So it thought:
Make a mesh where every vertice is a flock member.
Write some agal to morph the mesh to give it flock behaviour (distance to related vertices and the center of the mesh and some other target( like the main player ship) in 3d space.

Then just readback the oc registers (wich i cant).
So converting them to a small bitmap with rgb for xyz seems the only way to go.
But the drawbitmap is said to lock up the GPU/CPU and thus cause performance issues.
Mind you its for mobile devices.
I would have to be able to examine indidual pixels back in flash, preferably I would read raw bytcode from the texture/backbuffer directly if thats quicker.
I dont even know if thats possible.
Im not that good of an AS/agal programmer yet .

Highest regards,

Mac

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X