ANYWAYS, it’s structure is modeled off my GOL simulation ping-pong setup that was really really sloppy (but at least it worked {with a memory leak though im pretty sure}) which can be seen here if you have not seen it yet: https://www.babylonjs-playground.com/#I30SDL#18
What I am trying to do is get the top scene actually passing the updated RTT’s to the next pass in line. I’m thinking maybe the step I am missing is generating the PostProccess on each step? But before I did that I wanted to check if anyone has any input on the topic.
I know these facts, the rtts are being updated correctly once at least and the initial texture buffer is also being set correctly.
What I dont know, is why its not flashing red and black now. Ideally we should even be able to chain the first step in the process on itself. I see that in the initial run its flashing once… so I gotta be close.
Thanks all, it was lots of fun!
Ok let me see if I can explain this better, cause I have a sneaking suspicion its really close.
so I have the SimulationSystem object which the idea behind is that you can create a rtt and have a shader process over it then pass it out to the next rtt on the chain or where ever they need to go.
In this version I have the console logging out when the links are being set which when I read over it it seems correct:
(2) VM79:233 Set Initial Buffer
…
VM79:236 Setting link:0 - On Step:0
VM79:236 Setting link:0 - On Step:1
VM79:236 Setting link:0 - On Step:0
VM79:236 Setting link:0 - On Step:1
…
On line 142-173 is the area that I am trying to get really working… If it was working It would be flashing red and black.
The idea with each step is that a rtt will get updated by the post process then stored in that state. The the rest of the steps have access to the last update that was stored on a steps rtt.
Basically trying to be able to chain the rtt’s output together then display it.
Here is a example where if I get it working right it is just one step passing its own information to itself https://www.babylonjs-playground.com/#ZR575I#9
Where if it was doing what I was hoping would be a black cube that gets 0.1 added to its color every step then when its gets over 1.0 it snaps back to 0.0.
Would I need to clone the rtt to pass it back to itself on a postProccess pass?
I ended up kinda starting over, but at least now I get this error:
[.WebGL-000001BB54D33040]GL ERROR :GL_INVALID_OPERATION : glDrawElements: Source and destination textures of the draw are the same.
Which I though could be fixed by changing line 255 from
effect.setTexture(this.linkNames[i], this.parent.compiled[this.links[i]].rtt)
to
…rtt.clone());
though it got past the error it did not seem to get things working… I bet once Ive had a good nights sleep and really thought about this ill get it. but if anyone sees anything that just sticks out as to why its not working please chime in. any input at this point would be awesome.
UPDATE Ive been able to proof out that the rtt’s are being updated once or at least the shader is affecting them like one pass has happened. which is making me lean tword they are not saving they state back or updating it I guess?
Not really seeing why the old GOL version works and this one does not…
Basically I am trying to have a rtt get a PostProccess applied to it, then have the results get bound to
another PostProccess which then pass the results to the first PostProcess
I think everything is really close, just that the rtt’s are not updating from the shaders like they should.
I was finally able to figure out a chainable simulation material… the whole time I had it right, I just did not finish up the idea but also did not realize how close I really was.
There might be a better way to do this, but for now this will open up the ability to do all the GPU simulations my heart desires. < woot cake day!
Anyways this setup with an 8k resolution is like 200 million concurrent calculations running at 60 fps no problem.
More then just that, I created a system for doing any kind of GPU simulation. The GOL was just a Hello World. Now when I do my procedural content there will be the ability to do simulation passes over my textures as well. So flowing water on a heightmap becomes a possibility and other physic systems now.