leios / simuleios

Simulations for LeiosOS
https://www.youtube.com/user/LeiosOS
MIT License
198 stars 45 forks source link

Blender version #31

Open walus90 opened 1 year ago

walus90 commented 1 year ago

Hi. I wanted to run blender script fourth_dimension.py but I'm getting error :KeyError: 'bpy_prop_collection[key]: key "Lamp" not found'. After changing name from "Lamp" to "Light" I'm getting another error. My guess is that's because I have a newer Blender version. Can you provide version you used? Even better a requirements.txt file with all the libraries would be awesome. Thanks in advance!

silverwebb925 commented 1 year ago

@leios I would also love to use your code as a jump-off point to design a 5-cell. I know some py but am brand new to Blender, so any help getting this code running again would be amazing. I may reach out on Discord if we don’t hear back from you soon. Your content and work is great, and I’m excited to share my own projections and game development with you once it’s underway (and credit you for the accessible intro to 4D projections, of course). 😁 Thank you, Dr. Schloss!

leios commented 1 year ago

Sorry for the delay in responding here. To be honest, it might take some work to get the old blender script up and running. A lot of things have changed from the bpy version I was using back then and I don't necessarily recommend using that script. I remember trying to get it to work 2 years ago and there was an issue with the ffmpeg options at the end of the script that made the output really grainy. I don't know if I ever found a fix for that or not.

That said, it's pretty easy to create a similar visualization in any graphing engine. Just plot the points in 4D and then use any projection matrix to bring it back down to 3D for visualization. Recently, I've been using gnuplot and it works well for just plotting the 3D output. You can then create a bunch of different frames and bind them all to a final video via ffmpeg.

Again, any 3x4 matrix will do (because you have to multiply by a 4x1 vector).

silverwebb925 commented 1 year ago

@leios, thank you! It’s good to know this script may be fully defunct. I will probably see if I can revamp it from the ground up. I appreciate you mentioning the basic matrices required… that part of the YouTube video was actually really funny to me: “How do we do this? OBVIOUSLY we’ll use a 4x3 matrix multiplied by a 4x1 vector.” 😂 To your credit, it WAS obvious… but only after you said it (since I’m not in the habit of thinking in vector math). 🤣

Going back to the idea of revamping this… I tend to work directly from source API documentation over tutorials. Wondering if you have any suggestions for good references/resources OTHER than the docs.blender.org?

Thanks again for your attention on this old work! Looking forward to engaging with your new work as well when I have time. You’ve got some cool stuff going on. 😁

leios commented 1 year ago

Are you still hoping to use blender python for this or would you prefer to use some other software? I could whip up an example in julia in like an hour (might even do it on my livestream or something if the video would help)

When I was using bpy, I would always have blender up and tab through the python shell, which has better auto-complete features so I could figure out what commands to actually use. It was honestly a mess and I don't know if there is a "good" tutorial out there now.

silverwebb925 commented 1 year ago

I can’t speak for walus90, but I’m specifically interested in Blender at the moment… though if you want to play with a 3D projection of a hypertetrahedron and/or exploring meaningful ways to collapse a 3D projection into exploded 2D graphs I’ll avidly follow along in any program! 😃 I’m actually pursuing a digital game concept where 5 magical realms are aligned in hypertetrahedral symmetry… my goal is to root the game mechanics themselves into 4D vector math without requiring players to actually understand the math to enjoy the complexity it can provide as a magical system (but also inviting folks into a spacetime where they can explore these concepts with some direct in-game applications). To this end I’m looking at learning Blender so I’m one step closer to creating the game animations themselves which will illustrate the interaction and (literal) overlap of these magical realms as they combine to create the in-game reality. Currently I’m working with manual vector illustrations of a Schlegel diagram as I work out the internal cohesiveness of the universe and it’s pantheon of magical gods. I can keep it straight in my head (mostly) but would like to actually work with a 3D Schlegel diagram and associated graphs as I determine how the narrative motivations of the gods aligns with their projection into the 4D magical realms from even higher dimensions. It’s… a lot. 🤣 If you’re curious about the overall concept I’d be happy to send you my WIP illustrations privately (via email?). Please let me know if you decide to play around with hyper-tetrahedron projection or graphs! ☺️

leios commented 1 year ago

Well, in this case I don't know if Blender is the right software either. It's great for animations, but not (necessarily) for games. Usually people use blender to create the models that are later imported into game engines.

I might suggest using Godot or Unity instead? Godot is great, imo and Unity is kinda a standard for these types of things.

No matter what, the projection mappings are going to have to happen in code and not in any visualization program and it's essentially the same code no matter what engine you end up using.

silverwebb925 commented 1 year ago

I clearly got ahead of myself, excited at the prospect of visualizing something without considering the larger needs of this project… I’m both humbled and thankful to have such a large hole poked in my approach so early. Thank you for your sharing your insight, and I’m very glad you pointed me at Godot. It looks like it will suit my needs admirably as a game engine and as an open source project it is very much in line with my values. I’m still excited to dive into 4D projection mappings, but now I’m thinking perhaps I need to firm up some of my practical plans about how I might implement my ideas and work backward from there. 🤔

If you can’t tell, designing and building a game is new territory for me, though it is adjacent to my profession and a natural extension of my personal passions. 😅

Thank you again, Dr. Schloss. 🙏 Your feedback has saved me significant (and unnecessary) toil.

leios commented 1 year ago

I created a partially fixed version of the 4D script in #32, but don't recomment using it. I only really checked the visualize_fourth_dimension function, which is the one that does the double rotation.

To be honest, that particular visual can be done in any plotting library just by doing a matrix - vector multiply of Av where A is a 3x4 projection matrix and v is your point in space. If you want to do rotation, then you have another A that does the rotation before projection. For connecting the dots, just draw a line between points as you see fit.

I'm leaving this open, because I just don't have time to finish working on the script right now.