My Games

Sunday, April 30, 2023

Maximum Recursion Depth... in 3D!!! (Proof of Concept)

While I did not design the algorithm, I've been playing around with the StereoscoPy open source codebase to create anaglyph 3D images. I've talked about my interest in anaglyph 3D before with my Positive and Negative Planes Concept so it was fun to do this. I actually bought red and cyan glasses to try this out (you can find them pretty cheap online).

The results are by no means perfect, but short of designing it from scratch with anaglyph 3D in mind, the fact that it works at all and I can more or less automate it is pretty cool.


How does Anaglyph 3D Work?
Anaglyph 3D takes two images offset from each other, like imagine a photo of a scene, and a subsequent photo taken from a foot to the left, or something like that. It then aligns and merges the images, and color codes them, most frequently with red and cyan. Then, when wearing red and cyan lenses, the respective colors are filtered from one eye or the other, such that your eyes receive competing information that makes it appear 3D.

Tbf since I did not code the algorithm myself, this is a bit of a weak sauce explanation, this is among the reasons why I prefer to do things from scratch like with my Genetic Algorithm that Learns the Konami Code, but for now this is fine.

Anyway, after installing that StereoscoPy module, and after experimenting with several different parameters, I used the following command to generate an anaglyph 3D version of the MRD Cover:
  StereoscoPy -A -S 20 0 -a ./MRD_Cover.jpg ./MRD_Cover.jpg
    ./MRD_Anaglyph.jpg
Rather than using two images, I just used the one cover, but offset it to the left (-S 10), and used their auto-alignment algorithm (-A).

In addition to installing this module with the auto-align optional dependencies, I did also have to install some linux packages for this to work, and only was able to figure that out by tracing some errors and googling around, so it's not as user-friendly as it could be. Perhaps I could submit a PR to make it more user friendly, in lieu of writing it from scratch...


Maximum Recursion Depth in 3D!!!
Reminder that this requires red and cyan glasses.

Anaglyph 3D conversion





JPG of original cover


6 comments:

  1. Dammit, where are the 3-D specs when you need 'em! Supercool that you did this!

    ReplyDelete
  2. Never know what we're gonna get at W&WW from post to post - extremely potent blogging style, contra algorithm-friendly consistency.

    ReplyDelete
    Replies
    1. Ya it's ironic that I'm probably one of the least algorithmically traceable or SEO friendly blogs despite being probably one of the least bothered by the idea of that haha. My brain and writing is intuitively anti-patterned. Oh dang this is actually a really cool idea! It's like those anti-psycker warp people from WH40K but for cracking cybernetic systems! Damn imma have to think more about this...

      Delete
  3. I must now go and steal from my local theater, or perhaps I can salvage some red and cyan spectacles from the abandoned theater downtown... Surely nothing horrible will happen to me...

    ReplyDelete
    Replies
    1. Ya they're pretty old school so I wasn't sure how accessible they'd be but you can actually find them pretty easily online. But if you can find some old theater ones that should work too haha.

      Delete