4D objects in Blender!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] tro there was a 4D object the other ones are 3D fractals and they're all from the fractal machine asset pack I spent more than six weeks making a Powerhouse for generating fractals inside of blender as easy and Powerful as possible drag and drop this is literally something that has never before been done in blender so if you want to create scenes that no other blender artist can this is an absolute must for you check it out in the description on gumroad or blender Market we will create one of those freckles today the four-dimensional Julia so what is it actually turn on Julia is the four-dimensional version of the world's most popular fractal theme and abroad and they don't look similar at all but watch that if I enter these numbers instead of the C here and do the same thing here and then I cut this fractal in half you can see what I'm talking about the shape is connected through the fourth dimension and to see this we have to select the 3D slice we cannot see the whole object at the same time so how do we make this beautiful shape in blender well the ordinary mandelbrot formula is like that Z squared plus C the big idea is square something and then add something to it the classical manobrot Works in two Dimensions the Z and C are complex numbers in the form of X Plus y i i being a number that multiplied with itself gives minus one so if we substitute the Z and C we get the formula like that now let's replace those 2D numbers straight to its four dimensional complex numbers three quaternions it's an Irish thing by the way created by William Hamilton in 1843 the man got the idea so quickly that believe it or not you wrote the quaternal multiplication rule under an Irish Bridge so now our formula looks like that that's pretty wild but it's basically the same thing Square something and then add something to it so we need two systems in blender one two square quaternions which means multiplying with itself and the second to add quaternions adding quaternions is pretty simple we just add them together multiplying and squaring however isn't and it looks like that now that seems pretty hard so for help we go to Keenan Crane's 2005 paper called Ray tracing quaternion dual assets on the GPU and on page 9 we see a nice piece of code called quadsk which means quaternion Square Keenan has done the job so for adding we have normal math nodes and for squaring we have kosk so now we need to put this in the blender so here you see this is the 4D July fractal and this is all of the code that we actually need to put this Factor together I mean it's very easy right here we have this adding we'll just add using Vector math and normal math and here we have this quaternion Square node Group which by itself isn't very huge either so let's start creating this fractal and let's add a geometry nodes system let's add the news of the geometry nodes and let's call this Julia so in this new geometry node system let's first add the quads the thing that we need to square this Z here which should be quaternions so the code tells us that we need a four component number which is actually pretty easy I mean we can just use vectors for that a vector has a three components right and the fourth one can be added pretty easily just by using a value node so I'm going to put this one here and I'm going to call this one a w because we have X Y and Z and then we have W which is the fourth dimension of our fractal the code tells us that the new X component will be x times x minus dot product of y z w y z w so first we need to multiply the X with itself so for that what we need is to get access to the X so I'm gonna drag from this Vector here and I'm gonna put the X into math nodes and then I'm going to multiply the X with itself and this is the Q x times Q X part you might be asking like what is the Q telling us here the Q is just the name of the incoming Vector so if you would for example Ctrl J this and rename this the vector Q then this is our four component Vector so we have multiplied the X component of the vector Q with itself now we need to subtract the dot product of y z and v w sorry so for that we need a vector math node set it to dot product and we need to dot product the y z and W so we first have to somehow put this Vector together right because currently we have like the node output for X Y and Z and we have one for w but we don't have one for y z and W so we just uh we're gonna make this one ourselves by dragging Y into here then Z into here and then W into here so this one is our y z and W and I'm just gonna you know box this just to be clear here I'm going to track these things around here and we now need to dot product this by itself with itself so I'm just gonna do like that these are notes I think things are under control yet for quaternions we need to subtract this from this multiplied X so we need another math node duplicating with shift d and subtracting from this fat and this will be our new X control J I'm going to call this new X we have only one more line of code which is the y z and W component which will be 2 times x times y z and W so I mean what could be easier we're just gonna add method two times of a multiplication here and we have to multiply the X component with two and then we have to multiply this with the y z and W so I'm going to add a vector math node and I'm going to multiply the y z and W with this thing here this 2 times x and this will be our this will be our y z and W so I'm gonna control J this and call this yzw indeed actually the new YZ and w so this is finished this is actually exactly how easy it is to multiply quaternions but we need to Output this into a new Vector because currently you know we have x y z and W and here we have like XYZ coming in from one socket and here we have some like messed up sockets we need to combine those into something more nice for more nicer so let's first combine this whole thing by Ctrl G and let's connect this group input here and let's call This One X Y and Z and then this W here let's connect here and let's call this one the W right and I'm going to delete those things here I don't need those anymore these were just placeholders and for the output what we need is you know we could output the X and the like wz or whatever but the problem is if you for example like need to do something else with those vectors that need x y z then we have to like start doing some math noodling there and this isn't very good so I'm going to disconnect those and instead I'm going to output those x y z together and W separate for that we need to combine XYZ node I'm going to put this here and X is going to go here and then we're going to need to separate x y z separate this into pieces the first one is the Y component so I'm gonna put this one here the next one is the Z component I'm going to put this on here and the last one is the W component so let's connect those into the group um outputs like that and like that the first one is X Y and Z and the last one is the W so now this thing is ready I'm going to call this quaternion square and this is our node setup that we need to approach this part of the formula so let's put this formula together so what do we need here we need Z squared plus C right so the thing we are going to square is the position because we need to basically calculate the fractal for every position in the world space and only in this way we can actually see if there is the fractal or there is no fractal in this location so with X position and we Square this and we also need a fourth dimension component which will be a value nodes and we're going to put here so this will be like telling us which 3D slice of the for the object we are going to visualize I'm going to put this one to zero right now I'm gonna call this one w and Z squared has happened we need to add the C for that we need to use Vector methods add something to the X Y and Z and let's also add something to the W so for that we just need a normal math node and I'm going to connect W here and what we add to them well a certain thing I'm just gonna you know connect those currently here with the reroute like that so that I know that something is going to be connected to those and now we are just going to well group this thing together so the position and the W I'm going to keep out from here and I'm gonna drag right click overdose shift right click and select all of those and Ctrl G so now these are inside of a group and I'm gonna reorder those inputs and I'm gonna add some outputs to I'm gonna add this output which is our X Y and Z and something has been added to it because the Z squared plus C is iteratively and iteratively calculated right and then we are gonna put this W here as an output and this w and the one thing we are still missing are the C inputs so this must be a complex number it is the same on every iteration so I'm gonna add connection here and this one is our um this one is our C complex number and this one here will be our CW so the fourth component of our four-dimensional complex number this is now working and we could iterate this right so I'm gonna add like one and two and three here and if we connect those I mean this thing is working but the problem is if I have like a c here I have to like every time I have to type this thing in so instead I think it would be more wise or wiser or more intelligent to actually like create a little pass through that when the C is coming into this node group I'm just going to drag this out and the CW also so it's going to be the same value all the time and now I can just lazy connect those with alt right click drag like that and this is working nicely so how do we see the Julia we need to visualize this inside of a volume Cube so let's take a volume YouTube what we need to do is to take this output here and calculate its length so Vector math put this here and we set this to length and we put this as the density and you see well there is something inside here but what is it and cannot visualize that you do can so for that we need a volume to mesh I'm going to add the volume to mesh node here if you press alt Z you can actually oh this is your first experience when you press alt C you you should see an x-ray output here and we just have to inverse the thing so for that we can just do the color ramp let's take a color ramp and put this here and do like that and like that this is our output and I mean it's not like a Julia of course it isn't but if you change those numbers here you see it starts to turn into a Julia and that's that's really cool so let's just add now some more iterations here I think around like eight should be working nicely so I'm going to laser connect those as well like that six iterations and maybe I'm just gonna add you know nine iterations like that and then I'm going to take this X Y and Z output here and put this to the length now you see we have some mess here and that's because we have too many iterations the you know resolution of those voxels isn't enough to display the fractal to us so I'm going to add more resolution here by putting like 250 6 here and switch this volume dimesh also the amount and put the exact same number here now let's start to optimize this because I mean it gets slow so we can see here timings 100 milliseconds it's not wise you know so at your resolution let's change all the resolutions at the same time by putting um disconnecting this and dragging them here and also here and now we can preview the fractal well the first problem is that you know these things here are cut like an arbitrary line and that's because the bounds that you see here the bounds are controlling like until which area of the world a differential is calculated I know already by heart that the right number is 1.5 around 1.5 and also around 1.5 here and now when you put like a higher resolution here like 500 you see it all right it takes like four something seconds but however if you come compare this to the time that the fractal machine fractal took at the exact same resolution you see that the fractal machine has taken around 500 milliseconds which is around like 8 or 10 times faster so what is the reason behind that well we haven't optimized our fractal first put this to the interactive rate like 100 axles and then we're going to see where this fractal is symmetrical it can be mirrored around the x-axis as you see it's like the same thing so I'm gonna remove the X side from it entirely now it also can be mirrored up and down on the z-axis so that's the same thing I'm gonna just remove this area of this fractal what do we have here we have the range on the bounds from 1.5 on the X then 3 on the y-axis and 1.5 on the z-axis so this means now we have two times less range on the x and z axis which means we also can have 2 times less voxels so I'm just going to put here multiply and I'm going to multiply the X and the Z with 0.5 so now we have less voxels and of course less resolution and you're asking like what is the point of all of that this is just a like a piece of this fractal it's not the entire fractal yes indeed but we can do so that we are going to add a joint geometry node and just mirror so I'm going to take a transform route put this on here drag here and other things like that shift rightly drag over this by the way and first I'm going to you know rotate this on the z-axis like that 180 degrees and we have the other side of the fractal and then I'm going to add another joint geometry uh like a transform you know put this one here and I'm going to just scale this on the Z axis like that and we have the entire fractal back except it's like 10 times faster so if I put here like for example 500 you see it takes only how much time 500 milliseconds and it's much more detailed than it was before we can also add a shade uh smooth set shade smooth here so now it looks a bit more smooth and this is the fractal however if you compare this to the fractal in the fractal machine and we can do this in just a minute the one from the fractal pack has colors now how are these colors create these are created using a Shader bump map which is basically the entire fractal remade inside of Shader nodes and add some really nice detail on top of the fractal for example the same thing with mandelbulb gives some really nice colors so I'm going to just take Mana Blue from here and you see right the resolution might not be you know very high it's it's a pretty much real-time fractal but the colors add so so much this fractal and when we add some more resolution to it then you know this fretto is going to be a real Masterpiece you know so how do we use at least something like that for our current uh dual refractive what we need to do is to use ambient occlusion first we need to add a material to this fractal and we can do this by going to Geometry notes and in the end of our Note 3 we're gonna add a set material node and into this node we're going to add a material for example called Julia you can add here material and you can then add this here and in the Shader editor them we're going to select the view of the material we can add an ambient conclusion note which is kind of like a you know Poor Man's way to color a fractal so we can go here and add a color ramp like that uh like a constant Shader and you see you know the edges here are a bit smooth so I'm gonna increase the samples to around like 64. so now they're much more sharp and I can add some nice color maps on top of my fractal and it's not necessarily worse than the iteration based color in some cases this might be some things that you prefer and you can also combine those with for example a fractal Shader If I subtract the fractal Shader from the other one then you see I get some more details and also like the benefits of having declusion so I mean it's it's a room for experimentation so this was the four dimensional Julia if you're interested in the project file of this one you can get this from either the pack or on patreon from the lowest tier the other fractals you know are waiting for you in the Practical machine on gumroad or blender market so see you there and have a nice time thank you foreign
Info
Channel: Bad Normals
Views: 719,776
Rating: undefined out of 5
Keywords:
Id: N9Tnmbnl9Yw
Channel Id: undefined
Length: 18min 22sec (1102 seconds)
Published: Fri Oct 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.