 Okay. Welcome to the talk. If you're coming in, please close the door behind you. Please give a warm applause to Magnus. He's going to talk about high-dimensional 4D geometry and fractals, which are used in electric sheep and for other exciting pictures. All right. Hello, everyone. So, as you might have seen in the abstract, this talk will be split into three distinct sections. The thing about the topic is that it's extremely wide. I could probably fill a lecture for the whole week, but we're not going to do that. So, I am going to assume you roughly know how to do perspective protectors in 3D. If you don't, you might as well believe me. That will be good, too. So, for the 4D part, I'm going to throw some formulas in there and how to do that. Then I'm going to talk about some iterated function systems and how they generally work. In particular, after that, I'm going to talk about fractal flames, which are a special kind of iterated function system. So, the twist we're going to do here is that for the iterated function system and for fractal flames, we're going to talk about how to do those in 4D. Now, when I say 4D and higher-dimensional, I mean R to the power of 4 and higher. So, it's not about higher-dimensional stuff as you would have it in overfields of maths. It's more condensed into something specific. All right. And there's going to be some intermission slides where I showcase some demo program. I got, like, with Cheezus URL possible. So, you can follow that along in your browser if you feel like it. And let's get started. So, when I said, when I have 3 parts, I am going to tell you what I'm skipping. So, this is a cube. We've all seen a cube. So, the stuff I'm skipping, because we don't have enough time, is how to do vector and matrix products, which is the basis for most of the linear algebra stuff you've heard of. I'm going to skip across product in 3D. I'm going to assume you roughly know what homogenous coordinates are. If you don't, it's basically at another coordinate and you have a scale. I'm going to assume you trust me on rotations. You basically, in 3D, you need a free cross-free matrix to have a rotation. There's going to, the reason for being homogenous coordinates are that we want to have some affine transformations, which is basically the same, but we can also, like, translate stuff. There's look at transformations in OpenGL. So, also skipping those, but we're going to extend them later. And there's something called the perspective transform, which is, yeah, which is basically what we saw on the slide before, which it reduces the number of dimensions. So, in the 3D case, you get a 2D picture, which you can't plot on your screen. And, well, yeah, so the perspective transform is something you do so you can later do protections. There's going to be a lot of slides like this. So, for example, since I'm going to skip over it, but I'm going to point out an indentation like vectors in our stuff are going to be bold. Vertical bars around a matrix mean that we're going to do determinant. And, when we have rotation matrices, we can just extend them to be, so you can multiply them with affine transformation matrices. So, you just add another row, and you add another column, all zeros except for the cell. So, it's going to be interchangeable. So, just a heads up. And, this is a matrix we're also skipping. I'm just throwing that here because it looks kind of intimidating. It's documented in your OpenGL manual. So, yeah, just throwing it out there. Okay, and my clicker's not working. Anyway, so now part one. You guys are going to believe me that we can do perspective protections in 3D, probably because we've been playing Call of Duty or something at some point. So, we can't do that in 4D, and this, for example, would be a test rack or a hypercube. So, in order to render this, we need to do some maths to take our 4D object, in this case a test rack, and reduce it to a 3D object, which we can then turn into a 2D object. And, if we want to do it in 5D, it's going to be the same thing. So, again, what do we need for that? It's basically the same list. Shit. And, it gets worse because we don't actually have a cross product in 4D. Damn it. Well, we don't need a cross product. We just need normals, and so I'm just going to do a difference, which is a lot shorter. Okay, so, we want to do normals. I was just showing in the slide for the cross product, and it's pretty much the same thing, but, like, in 3D, we had a cross product, and we take two vectors, and we get an orthogonal vector to that. So, this is the property we need to do our productions. Now, in 4D, we can't have two vectors and multiply them in some way to get something orthogonal because then we get a plane because we didn't fix three of the vectors. So, we have one left over. But, we can't take three vectors and do the determinant with this matrix here, and that'll do it. So, this gives us one of two vectors, just like the normal cross product. So, we just solved the normal slash cross product problem. So, yeah. And, of course, we need a number base vector because usually we just need three of them. So, I call this term because we all like quantum physics. Anyway, we can also do this in higher dimensions. It basically looks the same, except we, so, what we do is, if we have anything in N, we need one less than that, and then we can fix all the other coordinates, and then we get a vector back. That's going to be a forward look to that, which is part of the formulas we need later. I'm not going to go into the whole formulas. Most of the time, you can just read out them later. I'm just going to throw the version out that I used for this stuff. So, another thing we need is a look at transformation. So, in 3D, you have a point you're looking at, and you have your camera. So, you need to turn around and face that point. Fortunately, we don't actually need trigonometric functions because we can just build a rotation matrix by filling in the last column of a matrix with what we're looking at minus where we're from. And then we need some orientation vectors. In 4D, we need two orientation vectors. If you're looking at your OpenGL manual, you have a function that does that for you. You give it three vectors. You give it where you're looking at, where you're looking from, and which side is open. Sorry, because you could rotate the camera like this. So, in 4D, you need to fix another vector for that. So, we have two from open back, and we fill from right to left. We calculated the last column, and we do our normal or cross-product of those vectors, and then we go to the left, and we slide out one of the vectors, and then we keep doing that. And the last one, we have another normal for everything. Now, you can actually find this in some publications online, but you can't find this, which is what we do when we want to do it in 5D and stuff. It still looks the same, but it's ugly. But, basically, we still have two less in the number of dimensions, and then we slide the calculated columns in from the right and calculate towards the left. Right. So, we also want to do a prospective transformation, which is what, basically, basically, you have a camera like this instead of like this, so it goes like to the sides, so that's part of the prospective thing. Fortunately, since OpenGL is actually taking care of all the cut-offs and everything, and we really just want a 3D object, we can skip a lot of stuff, and the matrix doesn't look as nearly as ugly as a 3D case. So, we can use a symbol matrix like this. What we want to do is we only have our eye angle, which is like how wide our eye can look, and everything but the last two dimensions, I mean, the last one dimension, and this is the homogenous part, they're fixed with the eye angle. So, the last coordinate in our 4D, 5D, whatever is always kind of like a death. So, yeah. So, basically, that works. The 5D case is pretty much trivial. We just have the last two fixed, and whatever we have is corrected with the eye angle formula we had in the 3D case. So, that takes care of that. And then we need some kind of view matrix, which is basically like we take all of this stuff, put it all together, and then we're happy because we only have one matrix that we have to multiply with for our vector. And it's not that bad. It's just a couple matrix multiplications. This is actually a 4x4 matrix, and this is a 5x5, and this is a 5x5. But that's not too bad, because we can just, so we implicitly expand this 1 to 5x5 with, as I previously explained. So, not too bad. And the 5D case is pretty much the same, so we don't really have to worry about this. So, I mean, 5D and higher. So, what do we do once we did our vector matrix multiplication? So, we still need to actually convert. So, we gave it a homogenous 4D coordinate and our matrix, and we multiply those, and then we get still a 5D coordinate back. And at this point, we need to take the homogenous part out, and we also need to do a perspective division. So, this is the same function in both cases. So, we just apply that twice, and then we get a 3D vector back. And that's basically it. So, now we have a 3D vector. We do the 3D thing again. We have cameras for every dimension, and we're going. So, yeah. And now to show how that is done, or at least what it looks like. So, this is the happy cube from earlier. And we can rotate this in 3D. Nothing too fancy. It's a little program I wrote a while back. And we can do it in 4D. So, it turns inside out. Yay! It turns inside out. If we did this with a 3D thing in 4D, we would basically turn the whole thing inside out, because we do a 4D rotation on a 3D object. And we can also do this in 5D. And it gets kind of confusing after 5D. So, we stop at 4. Sainer. All right. Okay. Now, I promised some iterated function systems. We're going to have to skip over a couple of these things, so it's not too bad. So, an iterated function system, the basic idea is that you have like two, three, four functions, and you have a set of starting vectors. So, you multiply all of these with all of them, and then you do that recursively, and there's a function like this, and you sum it all up. And this is actually from a fractal flame paper. I don't quite agree with that, because we don't really do that at infinitum when we display it, because then we wouldn't see anything, because it wouldn't ever stop, so that, yeah. But that's what the fractal flame paper had. So, we can basically choose any kind of function we want for this. A simple one is our affine transformations, which are basically, we can take our point, we can translate it, and we can rotate it. So, normally, you do a chaos game to render these things, which is explained later, but I'm not going to do that, because we can't, it doesn't work in 4D or 3D, because you need too many points. So, what we can do is we take a sufficiently divided primitive, and then apply all of these functions recursively, and then we get pretty pictures. So, for example, if we try to do a Sierpinski gasket, we have this square, and then we can. We have three functions, and they work like this. They realign it and then make it smaller, which we can all do with affine transformations. We do that a couple of times recursively, and we get an ever nicer and ever sharper picture. So, does this work in 3D enough? Sure. We can't do that. There's no problem here. I'm going to stick with a 3D one. These are randomly generated just with a seed, so nothing too fancy here. We can rotate this. It kind of looks pretty. We can do this in 4D and turn it inside out. So, it can turn it inside out, as you see here, sort of. Well, I already function systems in 2D, but they use a special kind of function called a variation, which is defined in that Fractal Flame Paper by Scott Braves, which is referenced in the end, so you can read it, because it's cool. And the variations kind of work like this. You have your affine transformation, and you also apply a set of variation functions, which are defined in appendix. There's 49 canonical ones. They kind of look like this. So, for example, we can have a function that does nothing. We can have a function that applies signs to all of the coordinates. And also, like a normal spherical transform, all sorts of kind of funky things. There's a couple of weird constants, and they thought about some cool stuff there. So, what you do is you take a number of these variations, and then you blend them together by assigning weights for each of the variations you want, and adding it all together. So, you can have like half of a spherical one, quarter of a linear one, and another quarter of a cosine one. You can also make it more than one, but then it kind of looks weird. So, then you can also, then they also added post-transforms with this, which is you take another one of these, and do it again. And a final one. Yeah, they really like their transforms. They do it everywhere, which is kind of cool. So, when I said the things about the Kers game earlier, so, if you only do the Kers game, as normally described, you get a black and white picture, some pixels ahead, some aren't. That's not really pretty. You can improve that by counting the number of times you hit a particular pixel, and you have a grayscale image, which is better. It's a lot better if you take the logarithm to do that, because you have lots of spots that get hit a lot of times. You have lots of randomness in there. So, you want to smooth out some of these smaller things, some small differences, but you still want to show like some of the bigger ones, so the logarithm scale kind of works for them. And if you apply a column map, the way they do that is like every function you have, because you still have more than one function. Every function gets an index on a column map, and you mix them all together, and then you get much prettier pictures, and then you add some vibrancy algorithm. It's always good. Now, as I said, this algorithm is strictly in 2D, so it looks 3D, but it's not. So, can we do that in 3D? Well, we can't do it with a Kers game, because we don't have enough memory for that. But we can do it. We can do it with a discrete version. So, yeah, I spent some fun time on this program. So, something doesn't crash. Okay. So, we need one more position. We want this to be bigger. This already kind of looks cool. It's already in 4D. So, let's stick with a 3D case for now. You still get the effect of it turning inside out and everything. So, this is kind of a random one, just the first best seed I had. You notice that it's 2D, because I just took a plane and subdivided it a lot of times. And when you run the transforms, you can sort of extend some of them, like you've seen the cosine one, and you can just add a number cosine. You've seen the spherical one. You have a formula for spheres and error dimensions. So, all this well. And we can do that. We can do it in 4D also, which means our stuff can turn inside out. But the cool part of the effect of flame diagram is actually the way the colors work, which turns out is really easy to implement in a pixel shader if you're willing to do a logarithm in a pixel shader. It sounds worse than it is. It actually works pretty well in real time. So, this is rendered in real time. It's not the prettiest set ever, but there's some room for improvement here. So, and it's kind of nice to see that it's still pretty damn smooth. So, I can do some random colors. Okay, let's take this one. So, like the yellow and the purple and blue, which is sort of visible. They're all different functions, and they get mixed together in the pixel shader, which works surprisingly well. And we can do all sorts of pretty one. And three years on is actually pretty nice, because it highlights some of the properties. Yeah, this one is pretty good. So, depending on from where we look, our pixel shader with the original algorithm has this kind of property of amplifying geometry, which is pretty cool. And we can, again, do this in any kind of dimension we want. So, we have this cool thing, and we can make it turn inside out. Whoa, sorter. Right. So, you get this nebula, and by doing a 40 inside out thing, you can make some pretty amazing pictures if you find where I kind of see in everything. So, this thing, this piece of code, is all open source. It's all available on GitHub. You can play with it. It runs in your browser. Although, unfortunately, it turns out that WebGL doesn't support, doesn't seem to support floating point textures. We just need to count ones up, but, unfortunately, the errors are clamped, so it doesn't really work. It's kind of sad. We can, but it still works in principle, and you can play with most of the other things. So, yeah. That's a program. If you're interested, there's a block series explaining most of the formulas in more detail, because pretty much just wouldn't cut it. This is my Twitter, if you're interested. Here's the original paper about the fractal flame algorithm, which is a really amazing read, and I put a lot of cool stuff in there, so I always give it a read. And, as I said, some of my tomatoes are from French. We've all seen the LSD one. And that's the end of that one, so if anyone has any questions. Okay. Thank you, Magnum, for this really interesting talk. I really, really like fractals. I'm sure everybody here does as well. Before we start with questions, if you absolutely have to leave, please be quiet. That involves no talking. If you can, please just stay until the end of questions. So, are there any questions from the internet, Signal Angel? Can you wave at me if you have any questions? Is there a question? Yes? Okay, ask away. Audio Angel, or so, could you please turn on the Signal Angel's microphone? Maybe start, let's start with a question from microphone number three, until the Signal Angel set up. Okay, hi. Thank you for your interesting talk. I was wondering in the projection transformation that you explained, you assume that the last dimension, it's one, so it's going to be depth, and then you assume that the rest are going to collapse. My question is, what happens if you don't assume that, or if there is anything that changes? Because in the projection, you're kind of assuming how the projection is done to 3D, right? If I understood correctly. That is true. I haven't actually explored what happens if we do a different kind of 3D transform in this case. I mean, that's perceptual, it could be different. It could be. I've just tried to take the perspective projection as using OpenDL and extended to 14, 15 higher. So, I haven't explored if it gets different, but it would definitely be amazing to try that out. So, I totally agree. Okay, Signal Angel, do you have a microphone? Yes, I have. Okay, please ask away. Standard user from ISC asks, are these visualization applicable to the 3D virtual reality experience, and would that give us the ability to better understand 4 and 5D fractals and projections? I'm sure that if we have something, a virtual reality headset that can do things in 3D right in front of us, that would completely improve the experience, and it would definitely help us explore the higher dimensions better. So, I haven't again tried it, but if someone would like to try that with VR Dear, I'll do it first to test it. Okay, let's go back to microphone number three, please. Yeah, just a quick question. I noticed that even for the multi-dimensional cases, you used apparently 2D primitives as the primitives, wouldn't it be possible to use the high-dimensional primitives? It would definitely be possible. So, as you said, what I did was I still used strives, and I kind of cheated by basically making them see through, as in, because if you're looking at a 3D object with 4D eye, you can see all of the sides simultaneously. So, it would definitely be possible to take higher-dimensional primitives. It's just that it's a lot easier to reason about if you have something like a 2D primitive, and you're trying to wrap your head around it. Are there any more questions from the Internet Signal Angel? Yes, there is. Okay, ask away. Twilly Sparkle from IRC asks, do you think a game in 4D Plus would be possible, and do you think it would be playable? So, there actually are games in 4D and higher. I remember at least a game called 4D Maze, and there's a couple of the adaptations of the Rubik's Cube to at least 4D, 5D, and I think I've seen 70. With Rubik's Cube, in particular, I have to admit that I can't solve a 3D one, so I would be amazed to see anyone solve a 4D one, but it's possible, and it can be done. So, actually, when I was thinking about doing this stuff, the transformations kind of look really cool, and it would be kind of cool to use it as a transformation effect, like you have your scene and you have a number scene, and then you can do a 4D swap over that, which I think would be really cool. But I'm not sure, like, I would love to see more games like this, and there are some. Okay, are there more internet questions? Not so far. Okay, one more from microphone number three. Thank you for your talk. I have one question regarding using it not just with factors like you did, but just inserting 4D or ND data sets from real data, and does it work and how it would maybe look like, and what trick you used to get the transparency effect for this data set? So, I mean, in the demo, I basically just used a transparent 2D surface, that part was easy, but I could see this used in a higher dimension to visualize data sets. So, I mean, when you're looking at a lot of stuff where you analyze stuff into different categories, you always end up with more than three, so if you would like to draw a graph, it would probably be very easy to make a planar one in higher dimensions. But I've not seen this done yet. I would love to see this done. But unfortunately, it is kind of hard to wrap your head around the 4D rotation part. So, I'm not sure if, because the graph used to make stuff easier to see. So, I'm not sure if it will make it easier to see if you're not trying to see 4D, but it will probably be cool. Okay, we have time up for about one or two more questions. Let's try microphone number two for a change, please. Thank you for the talk. I have some sort of more theoretical question. I was wondering, you told us that there are 47 types of variations and I never heard of variations. So, what actually, do they have some sort of properties? It's kind of a very small class. So, they're just basically defined at the end of that particular paper with the HTTP URL here. So, there's particular paper. So, they're specifically defined. The only common property they really have is that they're sort of aesthetically pleasing on their own and that they're all 2D. So, you can extend some of them, you can extend others. But they're specifically defined in the panics of that paper. Okay, thank you very much. Okay, one last question. Not a question, just a quick info on the 4D games question. So, there is a game that made the runs on the internet this year called, and I have no clue where the word comes from so I can't pronounce it. You can look it up. And what you can do in that game is like you have a 3D environment. You look at it in the 3D sense and then like you get to a wall and in your dimension that you're currently in, you can't walk around the wall and then you can shift to the fourth dimension or into another version of your 3D world along the fourth axis and then you can go around the wall. And in gameplay terms, it's really just that you shift to another dimension. I mean, a lot of games do that. But the funny thing is that that game actually implements it with the correct math. So, it looks really, really fancy. I remember seeing that. I haven't tried it. I wanted to try it. So, I mean, it makes sense that it works because when you do the 4D production, you really end up with a 3D world. So, it totally makes sense that you could use this to turn parts of the world around. So, I've seen it. It looked very cool. But I haven't tried it. But probably will. Let's thank the speaker again, please.