I Am Trying To Make A Falling Sands Type Game I Can Get Everything Working But The Problem I Get Really Poor Performance With A Decent PC.

And The Reason I Put The Title To That Is Because I Saw This Post: scirra.com/forum/falling-sand-on-gpu-through-pixel-shader_t78983And I'm Trying To Figure Out How To Do Something Similar To This And Expand On It. And I'm Willing To Learn A lot if Needed To Put This to Use.

To use a shader to do it you'll need two things:1. A effect to do it2. To store the result of the effect into a texture so it can be used for the next frame.

I'll start with 2 since that's somewhat simpler. You'll need the paster object to do this. Ideally you could have the effect on the paster object and paste it to itself every frame, but you can't paste an object onto itself. So instead you'll need two pasters with the effect and you'll need to alternate the object you're pasting from and pasting to. So basically the first time do this:

Paster1: disable effectPaster2: enable effectPaster1: paste paster2

Second time do this:

Paster1: enable effectPaster2: disable effectPaster2: paste paster1

And repeat from the start.

As far as the effect there isn't really a good reference. My thought is you could do it with two effects. One to move the sand down. It's logic would look like this:

If pixel=white and pixel below is blackThen set result to blackIf pixel=black and pixel below is whiteThen set result to white

I'm Sorry But I'm Completely Lost. How Would I Execute Any Of This? I Know You Said Webgl Does not Work On Your computer But is there anyway you could give me an example? And For The Effect Is This Canvas Plugin Or? Sorry Inadvance I'm A Noob.

Edit: I Have Done Some More Digging And I Have Found This Made By You A While Back:

Quazi's method would work just as fast in C2 except there is no way in C2 to save the result of an effect to use on the next frame.

Other than that the logic to move the pixels is simple.* if the area is free below a pixel is free move it down.* if the area is not free try to move down left or down right if those areas are free.

Here is a demonstration using my canvas plugin. As you can see it is very slow. For this sort of thing you'll want a method a lot faster, but for that you'll have to delve into some javascript.dl.dropboxusercontent.com/u/5426011/examples17/sand.capx

I can't attempt to make an example for a day or so. You won't need the canvas plugin, you'll need the "paster" plugin. It's much like the canvas plugin but it can utilize webgl. Notice web browsers used to let my machine use webgl.

The example is the physics. The particles move down and shift left and right to settle in heaps instead of tall pixel piles. That is roughly what the particles example you referenced does, except it has more spread.

@R0J0hound For Some Reason It Does Not Do That In Mine. I Have The Paster Plugin And I Put The 2 Effects In The Construct 2 Effects Folder. Is there anything else I had to do? All Mine Does Is Just Float No Physics What So ever. I Don't Know Why I Did Not Edit Anything.

Last edited by Thelegendvinny on Tue Jul 05, 2016 10:04 pm, edited 1 time in total.