Create Procedural Fractals Fast (Blender Tutorial)
HTML-код
- Опубликовано: 20 ноя 2019
- Click on my link below and get two FREE months of Skillshare Premium:
skl.sh/cgmatter
SUPPORT THESE TUTORIALS / cg_matter
MY WEBSITE www.cgmatter.com
In this fast blender tutorial I show you how to make procedural fractals using open shading language and a few material nodes.
This video was sponsored by Skillshare. Кино
Hope you liked the tutorial (this one took an unusually long time to edit)! If you are at all interested in trying out Skillshare Premium (and want to redeem 2 FREE months) check out my link: skl.sh/cgmatter
Have a great week :)
Imho you are starting to cross the point of being entertaining with the memes to being annoying. I like your content but please dial it down a bit.
@@Yurup yeah I think he's going too slow isn't he
Can we get a beginner-friendly tutorial to editing? I'm guessing it can be done with a script too ;D geddit? Cuz movies have scripts too, like this fractal shader. Hehe
DEMOLISH the default cube
Please? 🌚
This was too slow. Even 2x speed takes me more than one and a half minute to get through.
This three second break was so long that I was bored and wrote this comment
Good one^^
😂😂🤣
im just waiting for the ultimate video where he makes 1 weird sound that explains everything all at once
bruh he should do it and call it an intermediate tutorial instead of a beginner tutorial
That would go viral XD like 5pics per second for 2 seconds and one weird sound. He gotta. XDD
if anyone can do it its him
Wait that's not what this is?
Bahhhhhhhhhhhhhhhhhhhhhhh and done
The lack of identations in that code is giving me anxiety
sorry :)
But are you though?
As pythonist I can relate
@@CGMatter At least the Linux kernel code at 1:37 is properly indented, I can vouch for that :)
He could have done it all on one line...
RUclips compresses video, but CGMatter compresses the content itself.
the longer he makes these videos the faster he gets
go back and watch the coin video it feels soooo slow
watching this in a sensory deprivation tank phases you out of reality
video is over 2 mins sorry cant watch too long
memes ahead epic vid
just speed up the video and the problem is solved :)
I love how beginner friendly these tutorials are!
of course!
Me: wow fract...
CGMatter : you've been you ba bye..
Me: wait what?
XD
I knew I wouldn't forget what last week was supposed to be
"Implode the default cube"
Neat, had no idea you could just straight-up write shaders inside of Blender. Gotta give it a try sometime.
definitely pretty fast to pick up the basics if you know a bit of coding
It is Cycles only tho. And unless your PC supports CUDA, it is CPU only as well. But even with that limitations it is a fantastic underutilized feature that makes complex shaders a lot easier due to being able to write stuff like loops
Next you can use "show your love to the default cube and it'll disintegrate into nothingness like your imaginary girlfriend" a little long but ok
HOW DID YOU KNOW MY BLENDER SKILLS POSITION?
I don't know if you could copy this directly into blender, but if anyone needs the code all written out and functional, here it is.
Edit: Pasting the code below directly into blender using copy paste does in fact work.
shader fractal(
float creal = 0,
float cimag = 0,
point position = P,
output color fractalcolor = 0
){
float real = position[0];
float imag = position[1];
for(float i = 0; i < 200; i++){
float realtemp = real;
real = real*real - imag*imag + creal;
imag = 2*realtemp*imag + cimag;
if(sqrt(real*real + imag*imag) > 6 ){
fractalcolor = i/100;
}
}
}
you are a lifesaver, my guy. Been stuck on it for 10 min now. Just wouldn't work for me
Omg, wtf? it just didn't work for me like the guy before me. And now there's a friking fractal. Whyy
@@THEHOUSEOFSATIO I feel you man, 90% of the time I follow a tutorial it doesn't make anything remotely close to their product. I got lucky with this one and what you see in my first comment is my result after about 5 hours of confusion and trial and error. Most of the time I just have to watch tutorials and try to use the same skills to make something else. that way I don't feel like I messed up as much.
god bless you
You could go through all the numbers in pi in under 5 minutes
All the numbers in PI? So, infinity in under 5 minutes? Not even if infinity was real that makes no kind of sense.
cgmatter would never make a video that long
V. Z. It was a joke
If the speed he talks goes against infinity for the limit of 5 minutes, he can do it. Its mathematically possible.
Raz um can infinity have a speed?
wack that I actually understood the math and coding at full speed. what have I become
yes!!!
Ikr 😂
maths made sense, coding I have no knowledge - I should really get into coding
sly flex
A liar? ;)
You know this meme when you stop posting attention for one second in math class and empty blackboard is suddenly all written over?
That's how I felt when I blinked
You stop paying attention before class even starts. *CGmatter is 4 parallel universes ahead of you*
another one of those: "i want to try this but i actually wont because i am too lazy" videos
The code:
shader fractal(
float creal = 0,
float cimag = 0
point position = P,
output color fractal_color = 0
)
{
float real = position[0];
float imag = position[1];
for (float i = 0; i < 200; i++)
{
float temp_real = real;
real = real*real-imag*imag+creal;
imag = 2*temp_real*imag+cimag;
if (real*real + imag*imag > 16)
{
fractal_color = i/200;
}
}
}
// Minor change to the code generates the Mandelbrot set.
shader Mandelbrot
(
point position = P,
output color fractal_color = 0
)
{
float real = 0;
float imag = 0;
float creal = position[0];
float cimag = position[1];
for(float i = 0;i4)
{
fractal_color = i/200;
}
}
}
Hippity hoppity, YOUR code is now MY property.
what's the minor change? the code looks the same
@astraeus_BACKROOMS For the Julia set in the original code, initial N is the position, and initial C is a preset value. For the mandelbrot set, 0,0 is the initial N, and the position is the initial C.
Math + Blender + CGMatter = Literally all my interests. Absolute magic.
First video on youtube that I don't have to watch at 1.5x speed. Greatly appreciate the effort!
The fastest blenderer in the west!
if you use object coordinates, separate XYZ and plug the the X into creal and Y into cimag you get the mandlebrot set :)
I know fast tutorials are currently the main subjects of this channel, but I would love to see some full-length, beginner- to intermediate-level tutorials for how to do stuff like this. I feel like a tutorial on fractals, motion tracking, etc. would be really cool, especially if everything was thoroughly explained to the point that the viewer could make their own related project.
(This is just one idea, of course. Just know that we are open to other content formats if you ever feel creative burnout setting in)
I'm thinking of messing with the format as well
@@CGMatter You should. This is ADHD at the power of ADHD.
I watched this video in reverse.
pro move
CGMatter Video: is over 3 minutes long
Me: with fear in my eyes "this is about to be the most advanced thing I've ever seen"
I have to say thank you for these videos, not only have they reinvigorated my passion for blender, but the speed and means in which you present them is actually paradoxically easier for me to comprehend, as it is easier skip backward for something you missed rather than forward to cut out the gaps and keep attention on the video. all while the voice still sounds human
thank you so much! not everyone is down with the format so I'm glad you like it :)
The speed of the CG Matter tutorial is inversely proportional to the time it took to edit...
y=k/x 🥺😔
it's actually a nonlinear system
cgmatter rewrites the laws of time 3 seconds is now what we used to call 0.16 seconds
Honestly I love this so much more than a 7 episode beginner series on how to make a doughnut! Lol
For anyone who is getting an error...from scene settings change it to cycles, GPU compute and turn on open shading language also save your script with the extension '.osl'
Thank Cheezits I am semi-fluent in a few coding languages, I skipped that information and watch the rest on 2x multiple times, now it's burned into the back of my retinas and all I can see are fractals...i might need to see a doc.
FINALLY! A RUclips video where I'm not forced to speed up by x2.5 just to get to the point!
This is my kind of content delivery!
Fantastically well paced tutorial for such a complex topic, could be a series!
thank you!
This is everything I've been waiting for
Gotta b kidding me. Already hypnotized by your video and then FRACTALS?!
The sponsor was the only thing I understood here.
If CGMatter is hearting all comments this fast, he might even be faster in his tutorials, no seriously, I have to watch at 2x speed to understand a word of this video without boring myself to die.
Please note: if you add command break after assigment "fractalcolor", then you will get a very large increase in the speed of the algorithm.
shader fractal(
float creal = 0,
float cimag = 0,
point position = P,
output color fractalcolor = 0
) {
float real = position[0];
float imag = position[1];
float m = 500;
float d = 1000;
for (float i = 0; i < d; i++) {
float realtemp = real;
real = real*real + creal - imag*imag;
imag = 2*realtemp*imag + cimag;
float sq = sqrt(real*real + imag*imag);
float tempcolor = i / m;
if (sq > 4) {
fractalcolor = tempcolor;
break;
} else if (sq > 3) {
if (tempcolor - 0.4 > 0) {
fractalcolor = tempcolor;
} else {
fractalcolor = abs(tempcolor-1);
}
break;
}
}
}
awesome 10x! How do I make it work for
f(z)=Z^3-(z/z^3)
z = real + imag
love how straightforward you are. you kept the video short without the boring chit chat
Note: OSL only works with CPU rendering.
I wonder if we could do a similar thing with GLSL for Eevee.
Ooh, I've never looked into GLSL. Time to research
I've been waiting for this.
Epic tutorial, as always, wouldn't mind a basic tutorial in scripting in Blender. With a VERY basic knowledge of python, everything you did made a surprising amount of sense and I waNT MORE!!!!!
Ok, fast and totally easy to understand. I like it
An inspiration as always my boy.
your last 3 months summed up in 3 minutes? nice
I sometimes wonder why put so much effort in you're videos! They are just so great in any aspect! This must take ages. Love the effort you put it in^^ Keep it up
This is how I usually watch videos on RUclips. Subscribed
I downloaded this into my pron folder and now I am the cube.
Thank you for sharing :)
Great results and easy to follow ;)
CGMatter becomes more and more HowToBasic of Blender community.
It's actually very useful that he says "You've been you", cuz after a marathon of CG Matter's video for like an hour... I'm starting to forget who I am
You make this look so easy!
*Lovely!! Thank you!!*
THE MAN!
Wohoooo I did it! Got some amazing wallpapers out of it, thanks so much!
Amazing box 😀
Why do I love watching these videos even when I know I'm not going to do it now?
thank you for watching anyways :) I try to balance info for people actually doing it and entertainment for everyone else
That moment when you did it and you start experimenting around but ask yourself why there is a voice in the background screaming SKILLSHARE in superslowmo
Accidentally watched this at 1.5x. I exploded into pure energy and now know kung fu. But nothing else.
Love that you made an experimental rap track cgmatters
bless this tutorial
2:57 Correct, I do love you, CGMatter.
Just how i like my toturials non beginer friendly beginer friendly.
same
Rap god of blending skills and fractals.
The madlad
WOAH! your raps are soo good, for once i thought it was a tutorial 🎤 very epec
Great! Today I used an OSL shader which generated hexagons and now you come with fractals? That can't be an accident, maybe it's time to STUDY OSL?
i watched it again at doublespeed! lol it's hypnotising like you zoom into a fractal :D love this video!
0+0i ^^
Great tutorial as always. And never slow down, please. :)
I have been looking for a while after this.
Thank you.
Now I just need a way to generate these as a 3D mesh object.
(More Subvisisions = More Detailed Fractal)
I gotchu
and here I was thinking the imaginary numbers I was learning had no practical use
Wanna see your head BOOM? Plug the Z position value to either Creal or Cimg and plug out that baby to the density input of an principled volume node.... BOOM! 3d fractals
great tip!
@Estienne can you explain this a bit more? sounds really cool but I cant figure it out. Do I do this on top of the other node setup? Do I plug it into Volume of the material output? how do I plug the Z position in? do I use a separate XYZ node? where would it go?
@@flarbinator If I remember correctly :
1. Resurrect the default cube and use it instead of that boring plane
2. Create the same script node
3. Connect a Separate XYZ node to the vector output of the Mapping node
4. Connect the Z output of the Separate XYZ node to either the Creal or the Cimag input of the script node
5. Keep the ColorRamp node plugged to the sript node and disconnect it from the material surface input. Instead, connect it to a Math node with a multiply factor of something like 10. Try to "tighten" the gradient zone of the ColorRamp or increase the multiply factor to make the fractal less "blurry"
6. Connect that value output of the Math node to the intensity input of an Emission shader and plug this bad boy into the volume input of the material node.
This should work ...
Try to play with these things to improve the results : Z scale of the mapping node, switching between Creal and Cimag, multiply factor of the Math node, Color ramp...
@@stntoulouse Thank you soo much for the thought out response! I will give it a shot as soon as I get home! You Rock!
Thanks this was simple and easy to follow
Congrats on 69k subscribers
bless XD
I need to change the oil in my ears before my hearing locks up. Thanks Mr.CGMatter! Great Tutorial.
So this is how you can program your shaders? Will definitely give this a try. Thank you 👍
Nice! I never thought of the idea of iterating it through the python console instead of duplicating the node group lots and lots of times, and connecting them all together!
But just as another comment, you could've made the "i" in the for loop an integer
Also, you can use a while loop instead of a for loop, so you don't have to calculate more iterations than you really need to, speeding up rendering. But nevertheless, a very helpful tutorial!
Try this instead:
shader fractal(
float creal = 0, float cimg = 0, point position = P, output color fractalcolor = 0, int iterations = 0
){
float real = position[0];
float img = position[1];
int i = 0;
while(sqrt(real*real + img*img)
good point :) optimizing is important
For anyone still reading this, I have made an updated Mandelbrot script, complete with a maximum iteration count, rotation, zooming, and coordinate-choosing.
If "mandelbrot" is 0, it will render the Julia set, and if it is 1, it will render the Mandelbrot set. If "zoom" is increased linearly by increments of 1, the plane will zoom in by 2 times. Animating "zoom" linearly will provide constant zooming. Rotation is in degrees, but you can change it pretty easily in the code. Don't change the "space" vector, unless you want to remap the Mandelbrot set to a different space. You can change the "coordinate" vector to change the coordinate that the Mandelbrot set will be centered on. Lastly, for mandelbrot zooms, you probably want a relatively high iteration count (500-1000). I have included the complete code below:
shader fractal(
float creal = 0,
float cimg = 0,
point space = P,
point coordinate = 0,
output color fractalcolor = 0,
int iterations = 0,
float mandelbrot = 1,
float rotation = 0,
float zoom = 0
){
float div = pow(2,zoom);
float rBase = ((space[0]/div)+coordinate[0]);
float iBase = ((space[1]/div)+coordinate[1]);
float pi = 3.141592653589793238462643383;
float rx = sin((rotation*pi)/180);
float ry = cos((rotation*pi)/180);
float cr = (creal*ry - cimg*rx)*(1-mandelbrot) + mandelbrot*(rBase*ry - iBase*rx);
float ci = (cimg*ry + creal*rx)*(1-mandelbrot) + mandelbrot*(iBase*ry + rBase*rx);
float real = (rBase*ry - iBase*rx);
float img = (iBase*ry + rBase*rx);
int i = 0;
while(sqrt(real*real + img*img)
Awesome video! :D
Thank you Filip!
Honestly, at this point, I'm not subscribed for the tutorial, I'm subscribed for the fast hyperactive random comedy in the tutorial x3
wow You Are Great. i love the way that you explain ....
bruh this guy just explained imaginary numbers, fractals, and sponsored skillshare in 200 seconds
These videos just sumarizes the modern kid wanting everything fast even though good art takes time and patience. All that said, tho, I enjoy your vids haha
Time to study this video for the next decade
I am calmly stressed now, thank you
Just watched this in the lecture about complex numbers thinking i could escape them
the fastest man on the internet
damn straight
@@CGMatter I watched the video on 2x speed and died
:-1
SyntaxError: invalid syntax location:
^
shader fractal(
File "\Text", line 1
WHY ME
the same thing happened to me. let me know if you found a fix for it.
@@josephpasfield2557 dont Run Script, just plug it in the Shading tab
@@josephpasfield2557 It is all case sensitive, make you follow it exactly, I had the same error and realized i had written fractalColor instead of what it should be fractalcolor. It fixed it
shader fractal(
float creal = 0,
float cimag = 0,
point position = P,
output color fractalcolor = 0
){
float real = position[0];
float imag = position[1];
for(float i = 0; i < 200; i++){
float realtemp = real;
real = real*real - imag*imag + creal;
imag = 2*realtemp*imag +cimag;
if(sqrt(real*real+imag*imag)>4){
fractalcolor = i/200;
}
}
}
@@TehSpeedRunner Sorry, but what does this mean? I put the code in exactly as he had it, plugged in the nodes but it's still giving me the error message from the original comment
We need a cg matter for all sciences and arts
the people who have disliked this video, where always the people in math class who got a 'A' and this this is stupid.....
Keep up the amazing work.
bless!
Mind blowing )))
This made me to a jump spin jump hyper front flip on my trampoline.
I would like to see the bloopers for this video.
Brb I still have hope for the molecular tut
CGMatter taking the time to Heart all our comments. True saint here
very clear explanations ;-)
I don't understand the coding one bit but I love how, even complex the tutorial is, it's still really easy to follow along and create something amazing. Keep up the great videos! I'm wondering though, do you speed up your talking in editing or do you actually talk like you drank 200 cups of coffee?
I've done both. If I'm in a good mood I'll do it for real (maybe 2-3 sentences at a time), otherwise I just talk normally (with a bit of a different inflection) and speed it up.
Man this tutorial was a long one