Bro! This is an AWESOME CODING TUTORIAL!!! Because the moment it didnt work for you, you DIDNT CUT! You left it in and said to us "Huh...I thought that would work. Im gonna research why now." And we got the whole process of THAT TOO! Thats the part most people don't understand about programming. 99.999999% of the time its just reading some stackOverflow article from 6 years ago or some documentation that feels like it was written by a rabid raccoon on benadryl. Most other coding tutorials would have cut out the "huh" part and we would have just seen the code they ended up jury-rigging together after 9 hrs of brainstorming off cam. Thanks!
No matter what you're building, something as simple as a todo app or as complex as game engine 1:27:37 is a universal feeling when you get something working.
I am also trying to get into youtube doing videos like this, though I am a beginner and a medical student. I love programming and tech. Keep up ur videos they are inspiring me. Thank you.
lool I'm a med student as well and my main goal of 2025 is to get good at both CPP and OpenGL so I can start working on a game engine for a couple of years
You can calculate the collision with an other circle when the rays are at a greater distance than the circle radius, giving the impression that rays are emitted by the circle and not just the center point. Avoiding having no ray when the emitting circle center point is in a shadow object like at 1:35:24
@@OCEVNMusic I feel like everyone should find something that they enjoy doing, that way it’s so much easier and you can make it feel like ur not even working
Currently studying computer science for A levels (18 yo). This video is a fascinating look at a higher level of programming that I haven't reached yet, great and relaxing video! :D
Reading the title of the video will immediately think this is some absolute genius level stuff, but once you actually watch the video, you realise its not as far away as your think. The thing thats actually difficult is the fact this guy decides to do it in C using nothing but Vim
Very amazing and inspirational video. I'm self-taught and landed an apprenticeship as a backend engineer for about 15 months. Worked in Java for the most part. Once that completed got into uni for Computer Science. Currently teaching myself Linux, then plan to get shell/scripting down and jump into C/C++ in Vim like you're doing, then get back into Python once I learn a bit more on a lower level. Working as an Engineer fresh out of bootcamp showed me how much I didn't know, and how much I was missing out on by not attending uni. Videos like this inspire me to keep at it.
I have been watching a couple of your previous videos, and they are all very interesting. I also think that your explanations are getting better every video.
I am a final-year BCA student, and for a while, I had lost interest in my degree. However, after watching this, it has truly reignited my passion. Thank you!
I really enjoyed this video. I love how you explain absolutely everything, even the little details. It’s super helpful for learning. I’m going to binge-watch all your videos lolol
fantastic video mate! Im also recently getting into simulations using C/C++, would love to see some stuff with openGL too in the future, especially as its more powerful than SDL, but the teaching approach is really cool, good stuff!
You should color every pixel by computing (not drawing) a ray from its coords to light source, and then color the pixel after checking for an intersection of that ray with the scene. And if your scene just consist of circles you can calculate the closest distance from ray to sphere and get physicaly accurate shadows from that
1:52:25 You should draw the blur pixels in a different loop otherwise they'll get mixed up. What you are doing here is: painting a blur pixel and on top of that a ray pixel and then you paint another blur pixel on top of the previous ray point and so on... and that's why they cover up each other.
To solve the issue of having individual rays coming out of your light source in all directions, you could rework your raytracing algorithm to work in reverse, the way classic raytracers usually work. I'm sure you've come across it in the papers describing the 3D viewports and raytracing, but in a nutshell, it's inefficient to cast rays from every light source in every direction equally, as only a few will probably reach the eye of the observer. It is then usually the approach to follow the ray from its destination, that is, every single final pixel of the viewport. So you would loop across the X and Y coordinate space of your window, and for each pixel do a check whether that pixel is receiving light from the light source, or if it is obscured by anything - and you would not draw a line, only fill in the color of the pixel accordingly. It gets complicated once you have multiple light sources and reflective surfaces where your ray has to split up (and basically you need to recursively check whether that pixel is getting any light contribution from every individual light source, and via any reflection path or directly). But it quickly becomes way more efficient than doing it by tracing light rays from multiple light sources in all directions.
"m" is the slope of the line, a slope of a line is equivalent to the tangent of the line with respect to x axis traditionally, if m is perpendicular to x axis, the line is parallel to the y axis (slope is infinite)
i dont have asceses to coding team's(like people who work in a coding job) or no guidance, or mentor. I am constantly stuck by the thought that im doing something wrong, at a base level. The way you think and explain helps out, i hope you can go deeper into your way of thinking and think out loud. I am currently learning C as i think this language is not going anywhere ever.
Keep it up man you're killing it. Btw what software did you use for drawing. It looks like ms paint but it's different than the normal ms paint did you make any modifications or is it a different software. Please let me know thanks!
@@HirschDaniel Oh okay thanks. I have an idea for the next video. Can you make a hologram of a ball for example the idea is a hologram because it looks cool lol.
I assume your approach about circle rendering is based only on your own algorithms skills. You should search about the midpoint circle algorithm, which optimize your "naive" approach and include other stuffs like anti aliasing
I would suggest making larger object a bit "darker" color and try to implement ray impact on large object. Such that part of large object exposed to light source would become brighter (gradient like color change)
If I say "what you did has nothing to do with ray-tracing" might come out to harsh, first you need to know how light bounces from the object and that every new "hole" of light is a new light source. So the window between screen/window border and your object is essentially a new light source and should be recalculated. This is just a line renderer that gets obstructed by a spherical object (since it was most easily implemented for purpose of this video).
yeah you're right. This is technically a special case of ray tracing without reflections, or rather where light is completely absorbed. Of course, there's MUCH more to it. This is just a starting point. Keep in mind this is just a YT video, with limited scope
24:30 I actually was hoping you'd go for the more efficinet way of doing it, instead of drawing a lot of small rectangles, you first draw the rectangle inscribed inside the circle and then draw the rectangles in the sides to fill the gaps, and then keep drawing rectangles to fill the gaps in the sides until you have rectangles that are as small as pixels. But I understand why you wouldn't do this because I don't think you'll need to draw many circles for this application so optimizing this would be a waste of time. But I hope you would do a video about this approach I suggested, I think it's possible but I don't know how to do it programatically.
hm you should do a proper 3d sphere ray tracer next, shouldn't be tough from this base. i cooked one up in less than 100 lines of glsl code. simple simple
@@yante7 how is the scene looks like ? i feel that the ball that acts like the sun will have lines coming out of it everywhere that will block the camera.
what is _absolute_ scratch for you? Starting with implementing network drivers? Starting with implementing TCP/IP from scratch? This might be a much, much bigger project than you might think
@@HirschDaniel I would say an application level implementation, like buidling websockets based on the websocket protocol on top of an existing TCP/IP stack, (like using winsock in C) and then maybe start implementing from the transport layer by implementing your own TCP/IP stack . Regardess of whichever route you decide to go I would love to see it!
Hey, watched a few of these, also got into c/c++ thanks to you! Love the videos, though in this one you did raytracing for a single point light source, not a circular one. Too long to describe it here, but look up about umbra, penumbra, and antumbra, if you don't already recognise what I'm talking about. Other than that, great video as always, keep up the good work!
What does your vim config look like? I want to learn to "live in the editor" too. How do you setup autocomplete, C syntax highlighting, multiple windows in the terminal etc?
Hello there, thank you for the creative videos. Can you please assist in creating a c program that transfers a file from the server to the client. But before transferring the file it splits the file into different parts and then sends them randomly and the receiver program organises them back into their respective order and combines the split files into one.
Super easy. I'd split the file using some zipping library, send them in random order, and then unpack at the receiver's end. The zip library should take care of assembling in the right order automatically. For the networking, find some library that suits your needs. Actually it can be as simple as 7z and ftp
I really want to understand how to apply math formulas to coding, I'm not entirely sure what is going on or happening at lest say knowing the angles or finding out how a line does an angle? Seeing you try to figure the math out is a good frame of reference even though I'm scratching my head like a dumb monkey thinking "Huh? What, uhh okay? So....wait what?"
I didn't see the whole video, but isn't it raycasting, not raytracing? It's was used in Wolfenstein 3D, Doom, etc. when there was no gpu, and cpus were not that powerful. Each ray, when hitted something, represented a tile/sprite, and changed their size depending on how far away was the object in 2D space from the camera.
You are good at coding but not at math , your video helped me a lot to understand libraries and how to code , but I was screaming in the middle when you were taking too much time to understand circle math.
just for fun, to sharpen vim skills for work, where I frequently jump between files and grep files in terminals. It helps to "live in the terminal". But of course, I use IDEs as well. Always pick the best tool for your job!
what's interesting to me is that the "C" language is not that complicated, I write in "Java" and in general everything is clear, despite the fact that the last time I saw the "C" language was 14 years ago
100% agree. I code Java daily since it's my main language at my job, and it's (compared to C) much more abstract, much more convoluted, and requires you to know many design patterns to be able to contribute to large applications
Tell me where to get an eclipse javascript auto code snippet generator. I need it! I can't stand writing out the full code statements every single time! Old eclipse used to have it. Then, they ruined it as with all technology
@HirschDaniel Previously I'm using ms dos turbo c compiler. But after some time I realized that turbo c is very old. Other programmers use gcc for compilation. That's why I'm asking to you.
c in vim without any plugin or auto complete. absolute flex
I don’t use any autocomplete, I use vscode with C and CMake for Vulkan but didn’t set up autocomplete yet. Not as much of a flex though
why would it be flex?
he literally has autocomplete on
@5DPixel what is the benefit personal benefits without using Autocomplete
@@basseloobb there is none
Bro! This is an AWESOME CODING TUTORIAL!!! Because the moment it didnt work for you, you DIDNT CUT! You left it in and said to us "Huh...I thought that would work. Im gonna research why now." And we got the whole process of THAT TOO! Thats the part most people don't understand about programming. 99.999999% of the time its just reading some stackOverflow article from 6 years ago or some documentation that feels like it was written by a rabid raccoon on benadryl.
Most other coding tutorials would have cut out the "huh" part and we would have just seen the code they ended up jury-rigging together after 9 hrs of brainstorming off cam.
Thanks!
No matter what you're building, something as simple as a todo app or as complex as game engine 1:27:37 is a universal feeling when you get something working.
I am also trying to get into youtube doing videos like this, though I am a beginner and a medical student. I love programming and tech. Keep up ur videos they are inspiring me. Thank you.
Why are you in med school if you love tech and programming bro
if you like medicine try getting into making apps related to it or useful for you
lool I'm a med student as well and my main goal of 2025 is to get good at both CPP and OpenGL so I can start working on a game engine for a couple of years
@@hyesden why make a game engine
@@Rockstarskar he is indian bro his parents probably forced him lmao
You can calculate the collision with an other circle when the rays are at a greater distance than the circle radius, giving the impression that rays are emitted by the circle and not just the center point. Avoiding having no ray when the emitting circle center point is in a shadow object like at 1:35:24
I have no idea what you are doing, I don't even code, but I come by every now and then because this shit looks manic and I love it.
these videos give me absolute motivation to do coding
Its the opposite for me but i understand you
@@arampathkushan2861 same
if you need to find motivation to code, dont
@@topias1447 elaborate
@@OCEVNMusic I feel like everyone should find something that they enjoy doing, that way it’s so much easier and you can make it feel like ur not even working
Gotta love the typical programmer pose at 1:00:51
Currently studying computer science for A levels (18 yo). This video is a fascinating look at a higher level of programming that I haven't reached yet, great and relaxing video! :D
Reading the title of the video will immediately think this is some absolute genius level stuff, but once you actually watch the video, you realise its not as far away as your think. The thing thats actually difficult is the fact this guy decides to do it in C using nothing but Vim
Thx motivating
Very amazing and inspirational video. I'm self-taught and landed an apprenticeship as a backend engineer for about 15 months. Worked in Java for the most part. Once that completed got into uni for Computer Science. Currently teaching myself Linux, then plan to get shell/scripting down and jump into C/C++ in Vim like you're doing, then get back into Python once I learn a bit more on a lower level. Working as an Engineer fresh out of bootcamp showed me how much I didn't know, and how much I was missing out on by not attending uni. Videos like this inspire me to keep at it.
I have been watching a couple of your previous videos, and they are all very interesting. I also think that your explanations are getting better every video.
I am a final-year BCA student, and for a while, I had lost interest in my degree. However, after watching this, it has truly reignited my passion. Thank you!
I really enjoyed this video. I love how you explain absolutely everything, even the little details. It’s super helpful for learning. I’m going to binge-watch all your videos lolol
fantastic video mate! Im also recently getting into simulations using C/C++, would love to see some stuff with openGL too in the future, especially as its more powerful than SDL, but the teaching approach is really cool, good stuff!
55:40 "Aaaahhh WHAT?" - The only acceptable reaction to seeing R Code. LMAO
LMAO🤣🤣🤣🤣
whats wrong with r?
zzzzzzz
Dude I have been laughing at this for 5 minutes now... my stomach is hurting
This is insane dude, videos like these give me motivation to work on my projects!
i like how bro here casually created primitive paint =) 35:20
I've been following this video the last couple of days, great work your channel is awesome. You' have a talent for this kind of content
You should color every pixel by computing (not drawing) a ray from its coords to light source, and then color the pixel after checking for an intersection of that ray with the scene. And if your scene just consist of circles you can calculate the closest distance from ray to sphere and get physicaly accurate shadows from that
well such a brilliant thing to do that from a just raw code, I'm mesmerised. Keep up the good work.
I would say I'm addicted to your TH-cam videos now. Such an amazing contend, this is peek C programming ❤
this video hyped me. I miss solving such exercises, been some time. thanks I loved it.
1:52:25 You should draw the blur pixels in a different loop otherwise they'll get mixed up. What you are doing here is: painting a blur pixel and on top of that a ray pixel and then you paint another blur pixel on top of the previous ray point and so on... and that's why they cover up each other.
This video make me remember a guy who make a kernel, he also raw dogging C with vim, crazy. Definitely wizard of modern era
To solve the issue of having individual rays coming out of your light source in all directions, you could rework your raytracing algorithm to work in reverse, the way classic raytracers usually work. I'm sure you've come across it in the papers describing the 3D viewports and raytracing, but in a nutshell, it's inefficient to cast rays from every light source in every direction equally, as only a few will probably reach the eye of the observer. It is then usually the approach to follow the ray from its destination, that is, every single final pixel of the viewport. So you would loop across the X and Y coordinate space of your window, and for each pixel do a check whether that pixel is receiving light from the light source, or if it is obscured by anything - and you would not draw a line, only fill in the color of the pixel accordingly. It gets complicated once you have multiple light sources and reflective surfaces where your ray has to split up (and basically you need to recursively check whether that pixel is getting any light contribution from every individual light source, and via any reflection path or directly). But it quickly becomes way more efficient than doing it by tracing light rays from multiple light sources in all directions.
I spent 2 hours watching the video, it made me happier and more relaxed than when I watched movies, thank you very much
Man, your channel it's so great ! Keep going ! +1 sub.
"m" is the slope of the line, a slope of a line is equivalent to the tangent of the line with respect to x axis traditionally, if m is perpendicular to x axis, the line is parallel to the y axis (slope is infinite)
Man, keep going! Amazing videos.
1:27:37 understandable reaction
Bro doesn't even need a regular resume anymore. He can just link this video and it's gonna speak volumes.
i dont have asceses to coding team's(like people who work in a coding job) or no guidance, or mentor. I am constantly stuck by the thought that im doing something wrong, at a base level. The way you think and explain helps out, i hope you can go deeper into your way of thinking and think out loud. I am currently learning C as i think this language is not going anywhere ever.
1:53:29 that aliasing looks so good
I love watching this kinds of awesome videos, even tho I don´t know even basic coding haha
Keep this is up bro. It's amazing!
Keep it up man you're killing it. Btw what software did you use for drawing. It looks like ms paint but it's different than the normal ms paint did you make any modifications or is it a different software. Please let me know thanks!
It's just Windows 11 Paint, no modifications!
@@HirschDaniel Oh okay thanks. I have an idea for the next video. Can you make a hologram of a ball for example the idea is a hologram because it looks cool lol.
I assume your approach about circle rendering is based only on your own algorithms skills. You should search about the midpoint circle algorithm, which optimize your "naive" approach and include other stuffs like anti aliasing
Thanks
Great content! When there's math or geometry in the coding content, I instantly give a like
Bro, I can't even close vim. Mad respect
I would suggest making larger object a bit "darker" color and try to implement ray impact on large object. Such that part of large object exposed to light source would become brighter (gradient like color change)
This is the modern version of that person who coded a theme park tycoon in assembly
love these types of videos!
You earned a new subscriber🎉
This would be so much fun to implement using CUDA or other parallelization techniques
Yeah i did something similar to this cpu only then redid it with cuda and it was a lot faster lol. on github at jonafinmicclen/GPU-Ray-Tracing
If I say "what you did has nothing to do with ray-tracing" might come out to harsh, first you need to know how light bounces from the object and that every new "hole" of light is a new light source. So the window between screen/window border and your object is essentially a new light source and should be recalculated.
This is just a line renderer that gets obstructed by a spherical object (since it was most easily implemented for purpose of this video).
yeah you're right. This is technically a special case of ray tracing without reflections, or rather where light is completely absorbed. Of course, there's MUCH more to it. This is just a starting point. Keep in mind this is just a YT video, with limited scope
that's fucking impressive man, keep it up
I would really like if you make an SDL tutorial. It will be really helpful!
that sanity must be below zero
2:50
***me turning off shadows in every game***
Meanwhile, I struggle remembering a for loop in js
24:30 I actually was hoping you'd go for the more efficinet way of doing it, instead of drawing a lot of small rectangles, you first draw the rectangle inscribed inside the circle and then draw the rectangles in the sides to fill the gaps, and then keep drawing rectangles to fill the gaps in the sides until you have rectangles that are as small as pixels. But I understand why you wouldn't do this because I don't think you'll need to draw many circles for this application so optimizing this would be a waste of time. But I hope you would do a video about this approach I suggested, I think it's possible but I don't know how to do it programatically.
hm you should do a proper 3d sphere ray tracer next, shouldn't be tough from this base. i cooked one up in less than 100 lines of glsl code. simple simple
i would recommend looking through the cherno's ray tracing playlist, very good and got me started
@@yante7 how is the scene looks like ? i feel that the ball that acts like the sun will have lines coming out of it everywhere that will block the camera.
Welcome back Terry Davis
If he was Terry we would have had a few choice n-words already and glowies all over the place ;)
Close enough but welcome back
are you really using vim ! amazing! how could you do that
Absolutely insane work! Not my level obviously...
Nice video! Maybe you should try SDL_Renderer instead of Surface.
this is so good !
Dude. That's ray casting not tracing.....
I would love to see a video about implementing websockets from absolute scratch.
what is _absolute_ scratch for you? Starting with implementing network drivers? Starting with implementing TCP/IP from scratch? This might be a much, much bigger project than you might think
@@HirschDaniel I would say an application level implementation, like buidling websockets based on the websocket protocol on top of an existing TCP/IP stack, (like using winsock in C) and then maybe start implementing from the transport layer by implementing your own TCP/IP stack . Regardess of whichever route you decide to go I would love to see it!
1:31 you'd be surprised...
Hey, watched a few of these, also got into c/c++ thanks to you! Love the videos, though in this one you did raytracing for a single point light source, not a circular one. Too long to describe it here, but look up about umbra, penumbra, and antumbra, if you don't already recognise what I'm talking about. Other than that, great video as always, keep up the good work!
Yes, I know what you mean, thanks! Video scope needs to be limited, though!
How do I GET TO THIS LEVEL
Just code a lot for about 3 months
Can you please try adding “reflection” variable to obstacle? Like every object in our would reflects some of light
Like make three objects with different reflectance and floor/walls to see how different patterns of shadows combine on them
i always wonder what is open in the top right tmux pane
1:35:41 okay but the rays to the left shouldnt disappear. What went wrong? Radius squared?
No, my code doesn't consider that rays should start at the circle's surface. Currently it acts as if rays originate in the center of the circle.
@ i totally forgot about that part because i watch until my attention span says “enough”. Right. Sorry…
cant you just fill up the space with a gradient color, the space delimited by the shadow
interesting idea
To fill the entire screen you can just call SDL_FillRect passing NULL as the SDL_Rect* argument
Thanks! That's very useful to know
What does your vim config look like? I want to learn to "live in the editor" too. How do you setup autocomplete, C syntax highlighting, multiple windows in the terminal etc?
Yeah lol c in vim? you're a true programmer.
1:53:30 that's called moiré pattern fyi
can you split the video in to chapters
Hello there, thank you for the creative videos. Can you please assist in creating a c program that transfers a file from the server to the client. But before transferring the file it splits the file into different parts and then sends them randomly and the receiver program organises them back into their respective order and combines the split files into one.
Super easy. I'd split the file using some zipping library, send them in random order, and then unpack at the receiver's end. The zip library should take care of assembling in the right order automatically. For the networking, find some library that suits your needs.
Actually it can be as simple as 7z and ftp
@@HirschDaniel If you dont mind, can you please make a video about the zipping library coz I never used any in C
50 missed calls from nvidia
i see VIM i panic
Am learning cpp this comes through recommendation😊
Loved it..
I really want to understand how to apply math formulas to coding, I'm not entirely sure what is going on or happening at lest say knowing the angles or finding out how a line does an angle?
Seeing you try to figure the math out is a good frame of reference even though I'm scratching my head like a dumb monkey thinking "Huh? What, uhh okay? So....wait what?"
I didn't see the whole video, but isn't it raycasting, not raytracing? It's was used in Wolfenstein 3D, Doom, etc. when there was no gpu, and cpus were not that powerful. Each ray, when hitted something, represented a tile/sprite, and changed their size depending on how far away was the object in 2D space from the camera.
Ray casting is a type of ray tracing
He did not even use chatgpt, what a surprise !
How do I get to this level?
put chat gpt on the other screen
Open your editor and actually code
No reflections?
Hello world, the sky is midnight.
You are good at coding but not at math , your video helped me a lot to understand libraries and how to code , but I was screaming in the middle when you were taking too much time to understand circle math.
totally genious
Can you help me with my maths problem
I rewrote this to pygame with some my changes, and its work in less than one fps...
dumb questions, im new in this sectior, Why are you Programming with vim, and dont use a IDEA for it?
just for fun, to sharpen vim skills for work, where I frequently jump between files and grep files in terminals. It helps to "live in the terminal". But of course, I use IDEs as well.
Always pick the best tool for your job!
Once you really get into programming, IDEs can actually hamper your work
1:53:12 Sun dog!
Technological degrading ... Now ordinary shadows are called - "Raytracing"
what's interesting to me is that the "C" language is not that complicated, I write in "Java" and in general everything is clear, despite the fact that the last time I saw the "C" language was 14 years ago
100% agree. I code Java daily since it's my main language at my job, and it's (compared to C) much more abstract, much more convoluted, and requires you to know many design patterns to be able to contribute to large applications
maybe decreasing the rays_number to 100 could have shown proper blur to rays...
feeling so dumb
Don't be discourage! With enough hard work we could do anything! Hard work beats talents
cool stuff
Tell me where to get an eclipse javascript auto code snippet generator. I need it! I can't stand writing out the full code statements every single time! Old eclipse used to have it. Then, they ruined it as with all technology
Which c compiler you are using
cc. Why?
@HirschDaniel
Previously I'm using ms dos turbo c compiler. But after some time I realized that turbo c is very old. Other programmers use gcc for compilation. That's why I'm asking to you.
Coding in C without autocomplete, and in Vim. You'll definitely be safe when GPT takes our jobs away.
oh my god.
Is this 3D or 2D
Subscribed!!