The escalation to "visualizing the SDF of a 3D projection of a 4D box" near the end was quick :)
@xellart5 жыл бұрын
Sir you are a beast. Everytime my googling about raymarching gets concrete you appear in the results. Phenomenal work and resources you put out there, thank you so much!
@InigoQuilez5 жыл бұрын
Thanks. I have more coming!
@slowestjabroni2 жыл бұрын
No kidding man! i don't think anyone would know how to do raymarching without this guy
@dmdjt5 жыл бұрын
That's the best explanation I've seen so far... Thank you!
@sea-saw5 жыл бұрын
That was great. The visual going from 2D to 3D to 4D was fantastic!
@PurpleShadowDragon10 ай бұрын
hello
@BartKevelham5 жыл бұрын
Great explanation, wonderful visualization, what a resource! Keep it up!
@25knightcrawler5 жыл бұрын
My god. These are some top notch quality videos :O Thank you :)
@milosavpavlovic75482 жыл бұрын
Thanks, this was great, even the shading of the outside and inside of the shape, in the end, was purposeful.
@Dudevid5 жыл бұрын
I echo the sentiment in the comments that I would adore a series of these videos covering each primitive, getting progressively more complex and building on previous videos! Thanks for the amazing work, IQ.
@psykoj11 ай бұрын
So well explained! Why didn’t I have teachers like this growing up. thank you!
@SpencerYonce2 жыл бұрын
You are a true wizard, my friend. Continue to share the magic of numbers, as this wizardry is contagious to the mind of fellow thinkers.
@geoffcunningham68235 жыл бұрын
Are you planning on doing a series of these for the other primitives on your website? Would be really useful for basic understanding - as it's a lot better than just copying formulas. Also I don't have the brains to derive these myself! They aren't obvious, to me a least, but with explanation really make sense.
@InigoQuilez5 жыл бұрын
I have many videos in the pipe, and a few are about deriving SDFs, yes!
@xbzq5 жыл бұрын
Excellent animations there. I bet it was a lot of work, but it shows in the result.
@5up5up Жыл бұрын
i love how the expression involves vectors, so it doesnt matter what are the dimensions, i love the elegance of this whole thing, thanks for explaining it!!
@esbensloth5 жыл бұрын
Great video! I have learned so much from reading your articles over the years, very happy that you are expanding to videos as well!
@RostamiMagic5 жыл бұрын
Thank you for the clear explanation. The graphics are stunning!!
@CraigPerry5 жыл бұрын
How is it possible there’s only 10k subscribers to this channel. This is one of the most interesting and educational channels ever!
@noonansean19795 жыл бұрын
I really wish you would do more videos, in fact I wish you would do an entire course right here on youtube. There's so much many of us could learn from you.
@InigoQuilez5 жыл бұрын
I'm on it! My goal is to lower the quality bar a bit so I can make more and more quickly. As I said, I'm on it
@noonansean19795 жыл бұрын
I'll have to raise my bar so I can follow along! Mr. Quilez I can't think of a better course I'd love to watch than something produced by yourself. Thank you.
@armenmichaeli6704 Жыл бұрын
I wanted to mention one little thing which I myself seem to have noticed for the first time, watching this video -- I think music, the right kind of music (which I guess is subjective, admittedly), will help one learn better. It relaxes the mind and helps you put your mind closer to the "zone". At least that's my impression. Either that or it's Inigo's soft Spanish accent that he speaks with, or simply his method of explaining the difficult using simpler terms. Anyway, think about it -- music as a catalyst of learning math...
@Blacksoul4444 жыл бұрын
the most powerful compact explanation and formula I've seen so far!! Stunning!!, absolutely amazing!
@sociamix5 жыл бұрын
Cool thank you, can't wait for the next one !
@yaafl8174 жыл бұрын
You are one incredible teacher, thank you for this, it's amazing!
@ragingwolfaboo Жыл бұрын
You're an inspiration, man! Thank you for all of your work and resources.
@TheArtofCodeIsCool5 жыл бұрын
Nice one! Great visualizations!
@lemonjumpsofficial Жыл бұрын
OMG YOU'RE ON KZbin!!! I SAW YOUR WORK ON SHADERTOY!!!
@Saturos025 жыл бұрын
Deeply appreciated! Hope to see more derivations in the future!
@mactyler5 жыл бұрын
Looking to give 3 blue 1 brown some competition I see!
@Ganerrr2 жыл бұрын
Would this be more optimal? it only makes a call to length when necessary float sdf_rect(vec3 p, vec3 s) { vec3 adj = abs(p) - s; return vmin(adj)
@atomictraveller Жыл бұрын
"SIGNED distance field" somewhere on the page/in the content ;)
@geoffrey36684 жыл бұрын
Mind blowing is the right thing to say! Thank you to make complicated thing very easy to understand.
@mattschaeferdesign5 жыл бұрын
Was just talking about your video tut abilities over lunch! And you drop this craziness around the same time haha.
@InigoQuilez5 жыл бұрын
I'm learning for sure! Also, telepathy? See you soon!
@jochenfeldkotter19875 жыл бұрын
thank you.. Finally understood the df I used so many times without thinking about it :)
@iaobardar34525 жыл бұрын
I love this explanation! please do more!
@sidekick3rida2 жыл бұрын
The math is fascinating. Would love if you did a course.
@felipegutierrez34775 жыл бұрын
Very elegant formula! Saludos desde Colombia
@rongovard67613 жыл бұрын
Do you have cocaine ?
@felipegutierrez34773 жыл бұрын
@@rongovard6761 So funny, shame that thousands of people suffer from a war to take drugs to richer countries.
@smthsmth1115 жыл бұрын
Cool tut. Thanks a lot, Inigo!
@sarvagyagupta17444 жыл бұрын
This is amazing. One question though. At 5:28, what is the value of R? I understood the equation before it and how we are generalizing it but to go to the next equation, we'll need the direction of vector P to get the value of R right?
@InigoQuilez4 жыл бұрын
R is just the dimension of the box, it's a constant vector. In 2D, it would be R = (Rx, Ry)
@sarvagyagupta17444 жыл бұрын
@@InigoQuilez Hmm. I think I got confused. abs(P) I assumed as the magnitude of P. So are we basically subtracting a point on the edge of the surface to some extension of the same point?
@InigoQuilez4 жыл бұрын
No, abs(p) is the component-wise absolute value of p. It's still a vector. The magnitude is length(p). Basically abs is |x| and length is ||x||. It's not necessarily the most logical, but that's how GLSL and most graphics programming languages call things.
@sarvagyagupta17444 жыл бұрын
@@InigoQuilez Makes so much sense. Yeah, abs(p) is nothing but the abs value of each element. My bad that I confused it with what "length" does. And now, it makes perfect sense how ||abs(p)-R|| (length(abs(p)-R)) gives us what we want.
@connellpaxton6615 Жыл бұрын
THESE ARE AWESOME VIDEOS!! THANKS SO MUCH!!
@smiley_haha5 жыл бұрын
I found it easier when trying to think of an SDF for a box to just intersect boxes of infinite volume and simplify from there. i.e. for 3D use 6 versions of sdInfiniteBox(vec3 p, float height) { return h - p.y; }, inline them, and then try to minimize the formulas. Ends up reducing to a few max and min operations if I remember correctly. I do like how your approach generalizes to more dimensions though, that is really cool.
@InigoQuilez5 жыл бұрын
The intersection of infinite boxes won't work in most applications. What you get is a bound for the distance, not a real (euclidean) distance. That might be okey for some types of colission detection or slow marching, but generally you want the exact distance to the box, not just an approximation.
@pako_powr5 жыл бұрын
Very nice explanation!
@nehuelarmenanzas4 жыл бұрын
Subscribed! Amazing!
@geko2867 Жыл бұрын
You should have mentioned that this is pretty much the sphere function but using chebychev distance instead of euclidean distance. A curve that has equal euclidean to a point forms a circle, while using chebychev forms a square- and manhattan distance forms a smaller square rotated by 45 degrees.. or a "diamond"
@mihailazar24873 жыл бұрын
06:27 I'm sorry, but how can the distance function ever be less than 0 in this case where if you add a parameter to the length function can only yield a positive value
@InigoQuilez3 жыл бұрын
q's components can be negative and maxcomo(q), the largest component of q can be negative. So when adding it to the lengrh (which is zero in the interior of the box), you get a negative value for the SDF.
@sunflower40313 жыл бұрын
good video man
@colinleungNiloCat5 жыл бұрын
thank you for the explanation
@ReBufff Жыл бұрын
Really helpful, thank you!
@oluwasanmiadenaiye36302 жыл бұрын
What is abs()? Absolute of components or length of v from 0?
@frankeke85415 жыл бұрын
you are amazing
@carmo1223 жыл бұрын
Why is it that you use the absolute value of P instead of just P in the q = abs(P) - R? I tried without the abs in the shadertoy example in your website but couldn't notice a visible difference.
@Chribit2 жыл бұрын
Hey iq, While experimenting with offline SDF rendering, i noticed that the sdf for a box is almost exactly the same as the one for the elongation operation… as in the datatypes, math operations and function calls are all identical besides the length() and „primitive()“ calls in each. Trying to figure out how that can be interpreted. Is it similar to how the SDF of a capsule is basically an elongated sphere? If yes, what exactly would be a non-elongated primitive in a box?
@christopher81165 жыл бұрын
The SDF of a box is the distance from any point in space to the box ? What must be learned to get to this point in mathematics; unless a break down video can be created ?
@KaletheQuick2 жыл бұрын
Oh cool a saquare! Ingo: "Look, it's a cube now!" Oh cool! Ingo: "Now a tesseract!" AHHHHHHHHHH!
@turboblaat5 жыл бұрын
Hi Iq! thx for all these aswesomness, I want to dive some deeper in sdf functions, and would like to use the plane shading used in this example. Could you share that in a shadertoy with a 3d sdf drawing the gradient on a 3d plane?
@pedroenmanuelfuenteszambra88734 жыл бұрын
Are you planning to bring the theme of voxels? Im very interested in this theme. There are some experiments and tech demos coming out recently that are showing how far can you go in realtime with this things. But most of the sources are written in a very technical lingo. I saw your video and I understood box collision logic immediatly. I would like to see something like this in voxels. pls
@miktilk48185 жыл бұрын
Cool! Just, simply cool!
@NonTwinBrothers3 жыл бұрын
Stop blowing my mind, aaaaaaijoasih
@newtoo87675 жыл бұрын
Hey Inigo Quilez! I looked at your 6 hour tutorial and repeated everything. I got -50% fps for every added primitive. Is SDF rendering really faster than polygonal rendering? Is SDF useful in videogames? Can i get more perfomance using SDF?
@cycomkid Жыл бұрын
What is the benefit of this? Where it is used?
@eventhorizon80145 жыл бұрын
Really cool ! :)
@grisevg3 жыл бұрын
Thank you
@mathieug98605 жыл бұрын
Fantastic stuff! But isn't the max() operator implemented with if/else statements?
@InigoQuilez5 жыл бұрын
No, not at all. MAX is like ADD, SUB or CMOV, it's a branchless instruction of the processor.
@besusbb3 жыл бұрын
isn't the max() usually implemented with a branch operation?
@InigoQuilez3 жыл бұрын
No, unless you don't really have any other choice and have to do it that way.
@weinsim38564 жыл бұрын
What is maxcomp()?
@InigoQuilez4 жыл бұрын
The largest component of a vector. maxcomp(v) = max(v.x, max(v.y, ...))
@weinsim38564 жыл бұрын
@@InigoQuilez thank you, i already found it on your website.
@zayaerme2 жыл бұрын
I am a professional Instructional Designer with 3D as a hobby. I would love to help you on creating full blown 3D courses for free. Learning from you would be invaluable for me.
@Yashar-yp3yc6 ай бұрын
Perfect🔥❤️
@Davi-c4q5 жыл бұрын
Why isn’t the max function considered a branch? Doesn’t it have to compare 2 numbers internally?
@blondieresource7675 жыл бұрын
Shader units have a built-in max() function that is a single instruction.
@InigoQuilez5 жыл бұрын
The GPU can compute the max of two numbers without branching, like it can compite the addition or subtraction of two numbers without branching. It's most likely a combinatorial circuit.
@RicardoGarcia-mm3fo4 жыл бұрын
brilliant!
@mjthebest72946 ай бұрын
But this doesn't really get rid of the branching, they are just hidden in the max funcions! Still nice, there are intrinsincs that perform max very quicly.
@InigoQuilez6 ай бұрын
No, the max() function doesn't use branching, it uses a CMOV instruction which does NOT jump but use masking to combine bits. That's the whole point.
@mjthebest72946 ай бұрын
like this? mov eax, dword [esp+8] mov ebx, dword [esp+4] cmp eax, ebx cmovl eax, ebx ret I'm not sure the max/min functions from the standard library uses this trick tho
@InigoQuilez6 ай бұрын
Yhat's old school, but yes,I guarantee wr haven't done bramches for min/max many decades. Same for GPU, it's a hardware instruction since forever. In fact it's the other way around, and many if() statements are simulated with min/max.
@mjthebest72946 ай бұрын
@@InigoQuilez that is very interesting! I know there are sse intrinsics like _mm_max_ps() that emit direct cpu instructions for doing it wide, so yeah it makes sense. Thank you!
@Corbnorb2 жыл бұрын
how does length() work?
@Alex-Dev2 жыл бұрын
sqrt(Px² + Py²)
@rawwars5 жыл бұрын
can you add some reference in the description to read something about it? for now i will simply go with the google flow XD
@InigoQuilez5 жыл бұрын
All the references are in the desctiption of the video, in particular iquilezles.org/www/index.htm is where I have all the tutorials and maths realted to SDFs.
@ollllj3 жыл бұрын
distance to parabola and quadraticBezier next!
@yaafl8174 жыл бұрын
Is there a way to derive a direction from this?
@Chribit2 жыл бұрын
If you mean a direction when recieving a „sphere“ during sphere tracing, the first derivative of the distance function will give you the gradient / slope -> you can get the direction from the signs
@Monogrammaton4 жыл бұрын
Bob Saget is one of his patreon supporters??
@LukePettit3dArtist5 жыл бұрын
I dont suppose a follow up on why or how this used could be forthcoming. I found it interesting but the shriveled and aged maths side of my Brain was wondering how it is used or useful.
@pedroenmanuelfuenteszambra88735 жыл бұрын
How you made the animation at the start of the video? You made a shader for that? Are you working on a framework or something? Cant think of someone doing that thing in ShaderToy.
@InigoQuilez5 жыл бұрын
I actually made it in Shadertoy. I modified my original Greek Temple shader and added the animations, it was pretty quick to do.
@redoxee5 жыл бұрын
Nice!
@GameDevAraz Жыл бұрын
all i wanted was to mask a texture so the edges are soft but ohwell. unreal
@lemonjumpsofficial Жыл бұрын
omg that's so cooll!!!!!!!!
@dmitryparadise76185 жыл бұрын
Спасибо!
@zapparello5 ай бұрын
Amazing, but this function does not make a difference for inside or outside the box. It always returns a positive value.
@HuyPhamChnl4 ай бұрын
Sir!
@zXHAcKeRzXz2 жыл бұрын
Vous avez mis le SDF où ????????
@pedroenmanuelfuenteszambra88735 жыл бұрын
BTW very good quality video. A couple more like this and way less noobs on the streams will be asking what is NDotL.
@Toomnyrabbo Жыл бұрын
WHO WATCHES THIS?!??!?!?!??!?!
@mav45678 Жыл бұрын
Nice video. However, using background music for math videos is IMO counterproductive. The listener is supposed to be be maximally focused while listening to you, and the music is distracting
@johnadams6249 Жыл бұрын
I don’t think music is inherently out of place in math videos. Just look at 3Blue1Brown. If the pinnacle of mathematics education on KZbin uses background music, then surely it can’t always be a bad thing. I do think there’d an issue with the audio mixing though. The music changes volume throughout the video (although I think I remember watching a video saying that KZbin uses auto-gain so it may not be intentional) and the music is a little too loud during the speaking parts of the video. Perhaps a different style of background music might lend itself better to the video as well, the techno music is a bit busy.