Generating Fractals with a double Feedback Loop

Hello guys !

Have you ever filmed a screen with a camera linked to it, and played with a funny feedback loop trailed ? Ok so I came across this CRAZY VIDEO of a guy who has pushed this principle to another level !

At first I struggled to understand the complexity of the setup, but at the end, it’s pretty simple :

  1. First, there are two infinite loops of a camera in front if each screen. The camera can be rotated and shifted to control the “trail” effect of the infinite loop. By default this setup would remain black since these loops are independant, and not fed.
  2. Then, a smartphone generates an input (image or whatever) and feeds the bottom screen of loop one. The semi transparent glass helps to “incorporate” this data into loop one :
  3. Now, the output of loop one is fed into loop two, using the second bottom screen, and the second semi transparent glass :
  4. Eventually, the input from the smartphone can be replaced by the output of the loop two, which sets the whole setup into “autonomous mode” where all persistent data is in the loops :

Now I think you all know where this topic is going… :grin:

Yes, it happened ! :joy: BabylonJS of course ! :heart:


Here you go :

Screencast from 28-03-2025 12:45:17

At first I tried to do this using some RenderTargets, but I struggled to generate some infinite loops. Data was not persistent from a frame to another.

So I did it with no Render Target, directly by “feeding” the engine.readPixels() into a buffer, and setting up the Dynamic Textures for the next render, and now it works fine !

Here is the setup :

  • Main camera renders the scene to the bottom of the viewport
  • Camera 0 renders a plane 0 to top left, and its render it put back to its texture → Loop
  • Camera 1 renders a plane 1 to top right, and its render it put back to its textyre → Loop

Then :

  • On top of each plane, a second plane with alpha (to simulate double screen with glass) which can feed this loop with another input
  • plane 0 has a second alpha plane 00 on top
  • plane 1 has a second alpha plane 11 on top
  • The bottom part of the render (scene) is fed to plane 00
  • The plane 0 if fed to plane 11

Result is exactly the same setup than the original one !
Have fun :

  • (First) Click on top left to randomize camera pos and rotation (and find a nice pattern)
  • (Then) Click on top right to randomize camera pos and rotation (and fine another pattern)

NB: If you uncomment line 141 (W.I.P.) it’s a test to do the final connection of screens together after 5 seconds. Watch out you can quickly loose all data and go full black, you would need to start the PG again ^^

4 Likes