9 ms·
Show HN: Visualize rotating objects from the 4th, 5th, nth dimensions
Ever since I remember I had a lot of curiosity regarding hyper dimensional spaces. Picturing higher dimensions, such an impossible yet exciting idea... So years ago I came across a small GIF of a tesseract. Since then it left me wondering how cubes from even higher dimensions would look like... Years passed and I became a software developer, decided to tackle the problem myself and ncube was the result.
ncube allows you to visualize rotating hypercubes of arbitrary dimensions. It works by rotating the hyperdimensional vertices and applying a chain of perspective projections to them until the 3rd dimension is reached. Everything is generated in real time just from the dimension number.
The application is fully free and open source: https://github.com/ndavd/ncube https://github.com/ndavd/ncube. There, you'll find some demos, more detailed explanation and how you can test it out yourself.
Binaries for Windows, Mac and Linux are available: https://github.com/ndavd/ncube/releases/latest https://github.com/ndavd/ncube/releases/latest
There's also a web version that runs fully on the browser: https://ncube.ndavd.com https://ncube.ndavd.com
If you like the project I'd appreciate if you could give it a star on GitHub ♥ If you have any issue or feature request please submit at https://github.com/ndavd/ncube/issues https://github.com/ndavd/ncube/issues
-- EDIT DEC13 2023: IMPORTANT NOTICE --
https://ncube.ndavd.com https://ncube.ndavd.com MIGHT BE DOWN FOR YOU.
I deeply appreciate all the attention and feedback that ncube has been having this last day.
Alas it has become too big for the free hosting that I'm currently using and has exceeded my available monthly bandwidth.
I will be fixing it soon. In the meantime I recommend using the native binaries from https://github.com/ndavd/ncube https://github.com/ndavd/ncube
UPDATE: https://ncube.ndavd.com https://ncube.ndavd.com IS BACK ONLINE and with a performance boost. Should load faster now.
-- EDIT DEC17 2023 --
If ncube is leaving your system unresponsive it should be due to a recent Chromium issue with hardware acceleration affecting at least all Chromium-based web browsers on Linux. In case you're on Brave downgrading to 1.60 fixes it.
- 0xndavd
- DarmokJalad1701 3y agoLooks cool ... it does lock up my browser for several seconds on startup though - 100% CPU usage.
- dylan604 3y agoThat seems natural, and I totally sympathize with the browser. Browsers are just barely able to handle 3D. Going past that is surely wrecking their minds in the same way it does yours (at least mine).
- 0xndavd 3y agoThat's right, it's a very promising technology, however. ncube started as a native app and making a web port was a plus, using Web Assembly.
- quickthrower2 3y agoBrowsers can absolutely ace 3D, there should be zero issues.
- 0xndavd 3y agoThank you. These web apps work better (or only) with "Hardware acceleration" on. It should make use of the GPU. If it still persists I'd recommend the native binaries, they are always going to be faster.
- iainmerrick 3y agoIt's very strangely browser-dependent -- it runs really slowly in Safari, chugs a bit on Chrome, runs very smoothly in Firefox. Maybe I don't fully understand what's going on here, but what causes it to run slowly? For a 5D cube, I would have thought you only need to transform 32 points. That surely isn't much work per frame. Are you rendering with WebGL?
- 0xndavd 3y agoncube started as a native app. The web port was achieved through Web Assembly. It's possibly that WASM is not well supported in all the browsers yet.
- 3y ago
- ajxs 3y agoVery cool. I encountered a bug running it in Firefox: If you reduce the number of dimensions down to 3, and then increase them again, the cube doesn't animate correctly.
- 0xndavd 3y agoThank you, glad you like it. And thanks for the report. Are you able to reproduce it again? I could not reproduce it. If so, could you provide more details or even better, open an issue at https://github.com/ndavd/ncube/issues https://github.com/ndavd/ncube/issues
- dylan604 3y agoIt totally crashed my FF on macOS Sonoma Edit: Here's the bug as a screen cap: https://vimeo.com/893937641/e7d12262c8 https://vimeo.com/893937641/e7d12262c8
- 0xndavd 3y agoFrom the provided recording it seems to be working properly. Keep in mind that in most hardware I wouldn't even try to go beyond the 7th/8th dimension. It becomes too intensive, way too many vertices, edges and faces to calculate. There's an on-going issue to attempt to move some logic into compute shaders.
- dylan604 3y agois it that the axis of rotation changes? the animation looks totally different after the reset. unfortunately, it has crashed my browser 3 separate occasions now, so that's putting a limit on further playing with it.
- 0xndavd 3y agoI gave an answer to that animation behavior in a comment bellow https://news.ycombinator.com/item?id=38621273 https://news.ycombinator.com/item?id=38621273 Also, please test out the native version of ncube, I provide some pre-compiled binaries for Mac, Linux and Windows. They should perform better. The web port was a nice to have, but the native versions will always perform way better.
- calini 3y agoI would love to see as many attempts at this as possible, as I am having an incredibly hard time visualizing / understanding more than 3 dimensions.
- 0xndavd 3y agoIt is an inherently hard/nearly impossible task for us, three dimensional beings. I gave a shot at attempting to give an explanation here: https://github.com/ndavd/ncube/#but-what-am-i-actually-visualizing https://github.com/ndavd/ncube/#but-what-am-i-actually-visua...
- adonovan 3y agoIt’s worth saying that visualizing 4-cubes is hard but _that’s ok_: it’s not a task our brains had any evolutionary need for, and even if we could visualize 4D, 5 would be harder still, yet it’s easy (relatively) to usefully imagine very high dimensional spaces, even infinite Hilbert spaces, when talking about ML feature space or quantum mechanics or whatever. So don’t get hung up on visualizing more than 3D. After 1D and 2D, you get the idea.
- IvyMike 3y ago"It is very hard to visualize such a dimension directly. Off and on for some fifteen years, I have tried to do so. In all this time I’ve enjoyed a grand total of perhaps fifteen minutes’ worth of direct vision into four-dimensional space." - Rudy Rucker, The Fourth Dimension https://www.rudyrucker.com/thefourthdimension/ https://www.rudyrucker.com/thefourthdimension/
- GoblinSlayer 3y agoThere's Pacman4D.
- rikroots 3y agoMy attempt at an animated tesseract from a while back: https://codepen.io/kaliedarik/pen/yLbQpKq https://codepen.io/kaliedarik/pen/yLbQpKq I'll be honest: I can't visualise anything beyond 3 dimensions, so I have no idea if my attempt even comes close to being accurate. To me the result looks like a spinning cube which also thinks it's a torus trying to eat itself. I think the cube should be trying to eat itself in (at least) 3 directions as it spins in 4d?
- quickthrower2 3y ago1. Looks at animation 2. Yeah this 5-D thing is easy to understand when you flatten to 2-D 3. Changes the rotation velocities sliders 4. Waaaaaaat! Don't understand this 5-D thing at all!
- deleted 3y ago[deleted]
- 0xndavd 3y agoGlad you're enjoying it! :)
- akomtu 3y agoIt should be possible to speed it up quite a lot if you render just edges and vertices. The latter could look like spheres with radius proportional to the distance to the camera. Also, to build intuitive understanding, I think it's necessary to give controls to zoom in, turn left or right and so on.
- 0xndavd 3y agoPossibly, will see if I can add the option to not render faces sometime in the future. Feel free to submit a feature request in the repository in the meantime. And those controls are present, zooming and rotating, click the `help` button for the current controls :)
- 1920musicman 3y ago"Brace yourself" indeed! My Intel McBook Pro froze and I had to force restart it :)
- deleted 3y ago[deleted]
- 0xndavd 3y agoI am sorry for that, the web application works better with "Hardware acceleration" turned on, so that it makes use of the GPU. The native apps should perform way better.
- rubslopes 3y agoStrangely, it runs buttery smooth in my Samsung S21.
- tjungblut 3y agoOdd, on my S22 it's just showing a black screen.
- ProllyInfamous 3y agoHope you're not affected by the infamous MBP GPU plague. I have had the internal GPU permanently disabled on mine (GPUmux), which leaves only onboard Intel GPU (garbage)... so my affected MBP also does not load the webpage. Dual Xeons with RX580 doesn't break a sweat — about 20% GPU load.
- esafak 3y agoHands up if you don't feel any closer to understanding high dimensional geometry. I could not have imagined seeing what I was going to see, and having seen it, I still don't intuitively understand why it looked the way it did. I suppose the problem is that I have no experience of anything but a 3D world. I can imagine 3D to 2D embeddings but nothing beyond that.
- 0xndavd 3y agoHopefully this helps https://github.com/ndavd/ncube/#but-what-am-i-actually-visualizing https://github.com/ndavd/ncube/#but-what-am-i-actually-visua...
- dekhn 3y ago"To deal with hyper-planes in a 14-dimensional space, visualize a 3-D space and say 'fourteen' to yourself very loudly. Everyone does it." (thanks hinton) From a quick look, it looks like the app tries to take a nD object and project it down to 3D and render that in 2D while using rotation to demonstrate... something? I work with nD arrays and the only way I can visualize them (to the extent that I can visualize anything in my head; it's tough) is either by making 2D planes and viewing those or by looking at the node connections (like in a hypercube). Even then I don't think that's conceptually anything like "comprehending" high dimensional geometry in its native state.
- 0xndavd 3y agoThank you for the feedback. I give a detailed description here https://github.com/ndavd/ncube#but-what-am-i-actually-visualizing https://github.com/ndavd/ncube#but-what-am-i-actually-visual.... This basically was inspired by the famous GIF of the tesseract. As I mentioned in the url above, it's an impossible task to visualize in its entirety something with a dimension higher than 3. But we can take a look at its shadow and see how it behaves when rotating along a certain plane. If you have some idea on how to build on it please feel free to share or even create a discussion for it on the repository. I opened discussions earlier today just for that.
- deleted 3y ago[deleted]
- deadbabe 3y agoAny chance for a VR or AR version? Might be easier if you can start with a 3 dimensional display instead of a flat screen.
- Jeff_Brown 3y agoI would need manual, interactive control of the rotation to have any hope of understanding even the 4-cube*. An automatic rotation animation is stupefying magic to me -- pretty, but I'm not learning anything. * Even ordinary 3-dimensional cubes have surprises -- such as that some cross-sections the cube are regular hexagons.
- totetsu 3y agoWe need the high dimensional user input device too.
- 0xndavd 3y agoThe sliders are a factor of the rotational velocity. By changing those, the simulation gets updated in real time, so you can manually accelerate any type of rotation. Currently there's no support for cross-sections, and I'm not sure how they could be integrated in the current flow. But feel free to submit a feature request over on the discussions page of the repository. I'll see what I can do.
- matsemann 3y agoCould one mode perhaps be no velocity, but adjusting the sliders adjust the angle 1:1? So I can drag one rotational angle back and forth and see how the ncube behaves.
- Jeff_Brown 3y agoYou bet! I submitted five :)
- arrel 3y agoReminds me of 4dtoys, which does a great job introducing you to 4d interactions one step at a time. It’s great! https://4dtoys.com/ https://4dtoys.com/
- mdswanson 3y ago4dtoys is great.
- deleted 3y ago[deleted]
- the__alchemist 3y agoSee also: https://deepershadows.com/ https://deepershadows.com/ (and as arrel pointed out, 4D toys. There was a patch released recently that allows it to display projections, vice slices which is what the game originally did.)
- bagels 3y agoThis crashed my graphics card, amazing.
- dsp_person 3y agoSame, completely locked up kde plasma and had to do a hard reset. [drm:amdgpu_job_timedout [amdgpu]] ERROR ring gfx_0.0.0 timeout, but soft recovered [drm:amdgpu_job_timedout [amdgpu]] ERROR ring gfx_0.0.0 timeout, signaled seq=344186197, emitted seq=344186200 [drm:amdgpu_job_timedout [amdgpu]] ERROR Process information: process Vivaldi-Gpu pid 1111641 thread vivaldi-bi:cs0 pid 1111675 GpuWatchdog[1262135]: segfault at 0 ip 00007f20dfcfbbc6 sp 00007f20d4bc14f0 error 6 in libcef.so[7f20db858000+7770000] likely on CPU 6 (core 6, socket 0)
- nmaleki 3y agoGreat work! I was just about to build something very similar in Python using a 10 dimensional projective geometric algebra described here https://youtu.be/VYZHdEkLgC0?si=admkfiQwxIjHBa3Y?&t=90 https://youtu.be/VYZHdEkLgC0?si=admkfiQwxIjHBa3Y?&t=90
- admsmz 3y agoNice, there is a guy here live coding a tesseract on a string in javascript using geometric algebra. The code is general enough that you just have to adjust the dimension n=2,3 or 4. The rest of the code is identical. https://youtu.be/5R2sv9GCwz0?t=685 https://youtu.be/5R2sv9GCwz0?t=685
- 0xndavd 3y agoInteresting stuff!
- christiangenco 3y agoI really wanna see something like this in VR. I’ve got the sense to un-flatten 3D objects shown on a 2D screen and I have an inkling that if you showed me a 4D object in simulated 3D space I just might be able to understand it.
- david_allison 3y agohttps://wenbolan.com/4dobject.html https://wenbolan.com/4dobject.html
- teemur 3y agoI have been working on a project that puts you moving around and in 4d objects in VR: https://news.ycombinator.com/item?id=37100760 https://news.ycombinator.com/item?id=37100760 It's really crude at this point, but I am "close" (who knows, days, weeks or months, those last few issues may contain awesome rabbit holes...) to be able to publish next version that would have - moving and rotations using vr controllers instead of keyboard which is a bit of pain in the ass - double rotations - javascript programmable 4d objects (by player, that is.) letting you to create your own dynamic 4d world where to move in.
- david_allison 3y agoI made a demo similar to this about a decade ago If you allow a user to bind a key to a rotation in each dimension, it makes the structure slightly more intuitive
- david_allison 3y agoFollowing on: hypercubes are an intuitive & useful representation: Each vertex of an n-dimensional hypercube represents one of the possible binary numbers of length n, each edge represents a bit flip, and all edges in the same direction represent the same bit flip. I worked on an image which displays this relationship.[0] Focus on the labeled vertices and see how the edges relate to changes in the binary representation [0] https://commons.wikimedia.org/wiki/File:Snake_in_the_box.svg https://commons.wikimedia.org/wiki/File:Snake_in_the_box.svg
- 0xndavd 3y agoThanks for the suggestion. Feel free to submit a feature request at https://github.com/ndavd/ncube/discussions/categories/ideas https://github.com/ndavd/ncube/discussions/categories/ideas
- jacquesm 3y agoAbbott's Flatland is a nice little book that attempts to do the same. And then there is AK Dewdney's Planiverse. Both are well worth reading if you haven't seen them before, the Planiverse is more modern and probably more engaging but Flatland is quite interesting as well.
- deleted 3y ago[deleted]
- 0xndavd 3y agoFlatland was what made me fall in love with the topic.
- jacquesm 3y agoNeat :) I still have the vision of the sphere passing through flatland and it made me visualize a hypersphere moving through 3D space as a point that expands into a sphere and then disappears again into a point. Very powerful little book. Thank you for making this!
- 0xndavd 3y agoVery underrated book indeed. I still want to get a physical copy someday, it's truly influential. Thank you for the words, I'm glad you're enjoying it.
- billfruit 3y agoIs there something that can visualise rotations in 3 dimensions?
- 0xndavd 3y agoThe real world.
- joshsyn 3y ago[dead]
- holoduke 3y agoCrash snap page on my samsung s21
- pugworthy 3y agoI feel rocking-chair-like saying this, but I remember reading about hypercubes as a kid in the 60's and just having this wide eyed "Woah" feel. Life was good then in that way. Requesting a copy of Flatland from the state library too and feeling the same way.
- 0xndavd 3y agoFlatland is an amazing book.
- shantanujoshi 3y agonice cube bro
- 0xndavd 3y agoThank you!
- LoganDark 3y agoBut can you rotate them in your head?
- 0xndavd 3y agoNo. Only 3D ones, and barely.
- jsomedon 3y agoMy brain hurts so good when I watch this visualization. I can't explain this feeling, so weird.
- usrbinbash 3y agoThe feeling these shapes cause I like to call "unresolveable unfamiliarity". Normally, when a being experiences unfamiliarity, it can resolve it, by gaining additional experiences, knowledge, or simply getting accustomed to circumstances. Even if it never does so, it feels that it can. But with these interactions, the unfamiliarity is caused by something that a 3D being is physically incapable of becoming familiar with. It, quite literally, cannot wrap it's head around what's going on. Thanks to our intellect, we can mathematically explain, even simulate what's going on, but we cannot get accustomed to it. Bear in mind that this is only my opinion, coming from someone who knows next to nothing about psychology though :-)
- hackernewds 3y agoit's quirky to know that this is familiar to our brains perhaps but can only be accessed outside of the facilities of our 5 senses. I like to imagine that is our experience on LSD and psilocybin with our brains in different focus
- 0xndavd 3y agoThat's a very interesting take.
- 0xndavd 3y agoI experienced the same as I was developing this application. :)
- robertsdionne 3y agoRelated, but still 3D, these are non-euclidean 3d geometries: https://3-dimensional.space/ https://3-dimensional.space/ I like the S3 geometry, which is essentially floating around on the 3d-surface of a 4d ball, also described here: https://www.mathinees-lacaniennes.net/images/stories/articles/dante.pdf https://www.mathinees-lacaniennes.net/images/stories/article...
- deleted 3y ago[deleted]
- 0xndavd 3y agoThank you. I'll check them out.
- Traubenfuchs 3y agoAre hypercubes really visualisations of objects from higher dimensions? Wouldn't it make more sense enrich clouds of 3D points with new attributes that encode the value in the higher dimensions? e.g. 3 spatial dimensions, with the fourth dimension being color. A fifth dimension could then turn the dots into numbers. Then you have the information from 4 or 5 dimensions encoded into 3D space in a way humans can still understand to some degree.
- nbe 3y agoSomeone interested by this subject could also enjoy watching the french film "Dimensions... une promenade mathématique" on spatial geometry: https://www.youtube.com/watch?v=6cpTEPT5i0A&list=PL3C690048E1531DC7 https://www.youtube.com/watch?v=6cpTEPT5i0A&list=PL3C690048E... (note: this is the first video of a playlist) https://www.dimensions-math.org/Dim_E.htm https://www.dimensions-math.org/Dim_E.htm https://en.wikipedia.org/wiki/Dimensions_(animation) https://en.wikipedia.org/wiki/Dimensions_(animation)
- hackernewds 3y agomind blowing thank you for sharing these
- 0xndavd 3y agoThank you for sharing. I'll check it out.
- zgs 3y agoThe lovely series of mathematical videos "Dimensions" is relevant: https://www.dimensions-math.org/Dim_E.htm https://www.dimensions-math.org/Dim_E.htm
- 0xndavd 3y agoThank you. I will check it out.
- dalore 3y agoIt looks just like the quantum cube thing in the Foundation tv show
- 0xndavd 3y agoNice. Haven't watched that one, but now I'm tempted.
- hackernewds 3y agoI get page that simply says "Deployment not found" on mobile-web.
- 0xndavd 3y agoPlease check the description of the post I just edited. TL'DR: Woke up today with the free hosting plan exceeded haha. Currently working on a new hosting solution. In the meantime check the native releases available at https://github.com/ndavd/ncube/ https://github.com/ndavd/ncube/
- quickthrower2 3y agoTry Github pages?
- 0xndavd 3y agoI will check it out. Thanks.
- 0xndavd 3y agoIt's back online!
- OJFord 3y agoRegarding the readme, I think it's clearer if you point out that it actually doesn't even stop at a '3 dimensional perspective projection of' - it's 2 dimensional with the third suggested by perspective drawing and the rotation. Then it goes on: > Well, imagine you're a 2D being, you live in a flat universe, in a plane, you see in 1D (a line), then you try to visualize a 3D object, so your 3D friends intersect a cube into your line of sight, but you only see an infinitesimal slice of it, you can never see it fully. Well, we kind of are, in looking at such demos we're 'living' in a flat computer-screen universe. To me at least it's easier to grasp as 'consider how 3D things from real life need to be represented in 2D on a computer screen' than it is to 'imagine you and everything in your life and your whole experience of the universe is 2D'! I can hardly conceptualise that at all!
- 0xndavd 3y agoThat's true. Was a bit reluctant of going there, afraid it might made the topic more confusing to some. But I think I will include it, yes. Thanks. Regarding being a 2D being I must disagree :), even though we are looking at such 2D demos we have 2D vision and are able to comprehend that "2D universe" fully, therefore we're still 3D creatures.
- jimmySixDOF 3y agoThere is also the concept of Visual Reorientation Illusions (Necker Cubes being the most familiar) which give some idea of the dimensional boundary translations etc. 1<>2<>3 and some 3<>4 There is a Facebook group and this account on X is collecting VRIs https://twitter.com/VRIs_Hugh https://twitter.com/VRIs_Hugh
- sdenton4 3y ago"I can hardly conceptualise that at all!" What, never read Flatland? Truly a classic!
- 0xndavd 3y agoFlatland was the true inspiration!
- Aerbil313 3y agoYears ago I bought an app on Steam (maybe it’s still there) named “4D toys” just to get a grasp of higher dimensional objects. I played with it for a few hours, moving and rotating objects in different dimensions. I can say I understand higher dimensions now, it’s akin to learning linked list, hashmap and tries for the first time.
- 0xndavd 3y agoIt's a great feeling isn't it?
- e1ghtSpace 3y agois it? https://www.youtube.com/watch?v=XT63TPTtMKE https://www.youtube.com/watch?v=XT63TPTtMKE
- e1ghtSpace 3y agohttps://www.youtube.com/shorts/aIHriC6n1CU https://www.youtube.com/shorts/aIHriC6n1CU
- egberts1 3y agoViewport to the graphic cube got crowded out by the menus of sliders and switches. Saw nothing. Latest Firefox, Apple latest iPhone/latest iOS.
- 0xndavd 3y agoYou should be able to collapse it by clicking on "settings". In any case this software wasn't made with mobile in mind, for a more pleasant experience I'd recommend checking it out on a computer.