Get the ping a` ponging

https://www.babylonjs-playground.com/#ZR575I#1
So I am trying to come up with a dynamic chainable simulation system… yeah I know that’s a mouthful.

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.

2 Likes

@Deltakosh, so do I need to do the PostProcess during each step?

I tried doing that here:
https://www.babylonjs-playground.com/#ZR575I#2

but I still cant seem to get things continually looping like I was hoping.

welll… this is my last post before I am a married man! woop woop. Peace out all, wont be around for a few days. Catch y’all on the flipside.

3 Likes

Hey not sure to get the question. Can you simplify the PG or point me where you have an issue?

And btw: CONGRATS DUDE!!!

WOAH! congrats man

Congrats!!! That’s awesome!

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.

https://www.babylonjs-playground.com/#ZR575I#3

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

So it shows me that I am at least trying to bind the rtt to the correct uniform samplers on each “step”
If we look at this one:
https://www.babylonjs-playground.com/#ZR575I#4

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?

Maybe Ill just kinda start over on this idea cause I was able to quickly make the old setup do it…
https://www.babylonjs-playground.com/#I30SDL#31

Im super close with:
https://www.babylonjs-playground.com/#ZR575I#19

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… :woozy_face: 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…

Can you isolate the problem? I mean on a simpler pg?

It might be hard to isolate it.

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 just gotta figure out why this example works:
https://www.babylonjs-playground.com/#I30SDL#18

What should I do with https://www.babylonjs-playground.com/#ZR575I#19 to make the bug visible?

Give me some time today after I get some work done, Ill redo the PG with a bunch of incremental comments and see if I cant work this out.

1 Like