Тёмный

Teaching myself C so I can build a particle simulation 

Gradience
Подписаться 6 тыс.
Просмотров 166 тыс.
50% 1

Pezzza's video: • Writing a Physics Engi...
Verlet Algorithm: www.algorithm-archive.org/con...
Verlet Integration: physics.drexel.edu/~valliere/P...
Icospheres: en.wikipedia.org/wiki/Geodesi...
This codebase is a mess but if you're curious about the implementation or what libraries I used:
C Version :: github.com/marichardson137/Ve...
Python Version :: github.com/marichardson137/Py...
Thanks for watching!
Timestamps
0:00 Introduction
0:25 Python Version
1:17 Verlet Integration
2:37 Implementation
3:29 Collisions
4:17 Issues
4:55 Optimization 1
5:43 Optimization 2
6:45 Optimization 3
7:45 Coloring Particles
8:52 Linking Particles
11:24 Outro
Music sourced from Epidemic Sound
Sonar - David Celeste
Radiance - Amber Glow
Watercolor Motion II - Trevor Kowalski
A Gentle Pulse - Imprismed

Опубликовано:

 

1 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 230   
@gr4dience
@gr4dience 27 дней назад
Hi everyone! Glad to hear you're enjoying the video, it means a lot. I added the source code in the description for those who asked (it's kind of a mess). My semester just ended so I should have some time to work on another graphics project. Let me know what you guys wanna see below! - Cheers
@simonzanta1403
@simonzanta1403 25 дней назад
heyy, i really enjoyed your video about computer graphics. Im currently researching sources for my Bachelor Thesis from computer graphics and i would like to ask you, if you could share some insights on how you research topics. It would be really helpful, couse i have no idea where to find sources and mainly what to search for.
@gr4dience
@gr4dience 22 дня назад
@@simonzanta1403 Public code repositories were certainly my best friend during this project! If I ever needed inspiration for some feature or felt myself getting stuck, I would do a quick search on RU-vid or Google for something similar and that was usually enough to get me through. Another tip is to try breaking down your research into smaller pieces that will be easier to source (ie. "OpenGL instance rendering" as opposed to "OpenGL particles"). Hope that helps!
20 дней назад
third
@vinayakk2745
@vinayakk2745 18 дней назад
hello there, really liked your video! I'm a first year computer science student, I would like to know more about what you do and how you got here, I'd love if you'd upload a video talking about yourself, your work and your journey, it would really help and inspire me! Thank you for this great video!
@hanya-chan454
@hanya-chan454 17 дней назад
i love the work, why dont u make gravity simulation using nueton's thurd law of motion, i tryied to do it in unity, it kinda works but somehow the particles after attracting to each other and colliding they start to repeal each other (using barn's hut algorithm , no error in my code) , maybe u can do a simulation and explain the optimization method u choose.
@Nipings
@Nipings Месяц назад
The editing in this video is incredible
@njorogekamau3820
@njorogekamau3820 5 дней назад
You can achieve the same using an open source python library called manim
@luce_9801
@luce_9801 Месяц назад
I know what I'm doing in summer now. Thanks for the inspiration!
@_Rie_
@_Rie_ 15 дней назад
me too gonna start college in august so im gonna learn C and make this happen good luck to you too
@Randomperson-yf2fw
@Randomperson-yf2fw 4 дня назад
@@_Rie_Good luck! C is a tough language in the beginning, but it's so satisfying to use once you've conquered the main pitfalls.
@PezzzasWork
@PezzzasWork 26 дней назад
Super cool video! Always funny to see we all encounter the same bugs along the way :D
20 дней назад
first
@PridedBacon
@PridedBacon 29 дней назад
Can you pls open-source this
@oldgold8247
@oldgold8247 15 дней назад
In the description now
@whannabi
@whannabi 3 дня назад
Gotta pay for all the spilled sweat
@samir_buch
@samir_buch 25 дней назад
This is super impressive! Casually glossing over the fact that you taught yourself *not just C* but also how to render things with openGL is no small feat. Your in-depth knowledge of particle simulation is also pretty impressive, requiring at the very least knowledge of relatively advanced calculus and physics. And, on top of all of that, this video was very well written and edited. Overall great job, keep it up!
@thewholeworldblurred
@thewholeworldblurred 29 дней назад
I clicked because of C!
@samuelcollier1764
@samuelcollier1764 29 дней назад
this was an awesome video! C is my favorite programming language and I love seeing graphics programming projects like these :)
@yourkideliasontwitter
@yourkideliasontwitter 17 дней назад
This is a great video, and it is surprisingly well edited! I am not interested at all in physics simulation but the way you explained it really made me start paying attention and it was interesting how you used each optimisation technique to achieve even better results!
@aleksaggor
@aleksaggor 13 часов назад
Mesmerizing! You did a fantasic job with this program and video, keep it up :)
@avion85
@avion85 29 дней назад
Good luck for your success on yt. We need more content like this.
@vasq
@vasq 26 дней назад
This is pure art. Amazing work bro.
@QuarzleTheMinecrafter
@QuarzleTheMinecrafter 29 дней назад
Yay another channel with my favourite type of content
@stone8684
@stone8684 13 дней назад
dude, you're so incredible. I'd like to see more videos. keep doing them :3
@wojciechkalinowski3827
@wojciechkalinowski3827 17 дней назад
Very nicely done! I like that you said what you did and kept it rather high level for the video. Whereas, if needed, and if you haven't already, then you can make a more detailed video for the code and maths. Great paste and keep at it!!
@evanbarnes9984
@evanbarnes9984 29 дней назад
Instantly subscribed! My god this is good.
@giorgito24
@giorgito24 27 дней назад
Absolutely stunning, more videos using C please😮
@hendersonvirtual
@hendersonvirtual 29 дней назад
Amazing, can’t wait to see more videos!
@ticusism
@ticusism 20 дней назад
Awesome! Thanks for sharing your journey.
@youknowwhatlol6628
@youknowwhatlol6628 27 дней назад
hello. i am a beginner in all those things and have just found this channel....can't say how grateful I am to you. You, my friend, are an inspiration. You are Knowledge. You are Greatness. You hold the Power. Thank you so much. Thanks. Would like to see more of these simluations, math-physics-chemistry-related programs and such. Thank you.
@DidIJustDoThat
@DidIJustDoThat 20 дней назад
I am here with you also a noob
@space-yg
@space-yg Месяц назад
Yoooooo amazing video!! I learned so much from it
@ArunKumar-zd4ue
@ArunKumar-zd4ue 24 дня назад
this is a great video mate. this video remainds me of sabastian lague's videos. when ever i have thoughts about why i chose programming as a career i think of these kind of videos which boost my happiness and i say to myself that this is why i chose programming as a career to build cool stuffs. thanks mate. Great job !!
@kiri9979
@kiri9979 28 дней назад
this video is amazing it feels like it's been made by a channel with at least a few hundred thousand subs keep it up !!
@user-qe6rh2qq9z
@user-qe6rh2qq9z 18 дней назад
Very cool and informative video. Thanks for the effort.
@waffles6555
@waffles6555 18 дней назад
I took a graduate level numerical methods course (my prof contributed to some popular CFD software) and it was very cool to see the different algorithms used. Great job !
@sirjersey
@sirjersey 29 дней назад
Amazing Video! Definitley learned something new :)
@agaveboy
@agaveboy 29 дней назад
that's great c code if you've really just learned it! good job
@lel7531
@lel7531 29 дней назад
Very cool video, top notch editing
@mattywlion5174
@mattywlion5174 13 дней назад
Man it's a fantastic video, it's just great, love this
@eduardomarinho1482
@eduardomarinho1482 29 дней назад
Great video and very interesting project, will try to do it on my own. Also, I’m impressed for the quality of the video!
@lbgonpokeit
@lbgonpokeit 19 дней назад
Awesome video, Man I could watch this stuff all day 😅
@drakeolejniczak2357
@drakeolejniczak2357 22 дня назад
That was awesome! My favorite part was when you found the linear algebra text and got your change of basis on.
@bigwalrosswalross3356
@bigwalrosswalross3356 Месяц назад
Another awesome programmer I have to subscribe xD Great work
@cobrascolar
@cobrascolar 29 дней назад
This channel is going to be massive
@georgiosdoumas2446
@georgiosdoumas2446 11 дней назад
I have studied physics in 1991-1995, and I had a semester on Fortran in the university. Then at 2004 I learned a little C, and the following years I was slowly reading a few books on C and C++ (mainly I was reading stuff about networks and linux for my jobs) . Since late 2023 I became a junior C++ developer. A few weeks I started learning OpenGL (I can give suggestions to who ever is interested). But I know that I am nowhere near the level to make such simulations! I am so impressed that you are still a university student and can produce those videos!
@dennischen2922
@dennischen2922 23 дня назад
This is such an awesome project! Glad to see a fellow NC State student doing cool things!
@Hakkyou1
@Hakkyou1 29 дней назад
Very nice video ! You might want to also look at fluid simulation using particle called Smoothed Particle Hydrodynamics. Basically you replace the collision algorithm with a constraint on the density modulated by a kernel. It sound bad like this but you already did 90% of the work there. Keep up the good work ! See you next video.
@nadjdev
@nadjdev 25 дней назад
Fantastic work!
@abdala3475
@abdala3475 27 дней назад
And here I am, struggling with a simple pyramid c code
@Pepegalord
@Pepegalord 19 дней назад
Feel you
@MasterofBeats
@MasterofBeats 19 дней назад
me fr fr
@wardingward4884
@wardingward4884 16 дней назад
Its okay, I'll get harder in arrays, and pointers 💀💀
@nad.99
@nad.99 15 дней назад
انا
@nad.99
@nad.99 15 дней назад
@@wardingward4884 linked lists is where I gave up willingly
@futuremapper_
@futuremapper_ Месяц назад
Love this!
@Sirepicwin
@Sirepicwin 14 дней назад
I literally just stumbled on this video, amazing and very fun to watch. Made want to actually learn C and take a break from JS for while lol
@philipmichel-dv4gk
@philipmichel-dv4gk 16 дней назад
really beautiful video . i can now see the importance o mathemetics in programming
@romeoxxiv
@romeoxxiv 23 дня назад
Very interesting, thank you!
@skyt-csgo376
@skyt-csgo376 29 дней назад
Awsome work!
@alessandroserra885
@alessandroserra885 29 дней назад
That's simply amazing
@chairlesscrocodile
@chairlesscrocodile 29 дней назад
Great video!
@Mia-tk7dz
@Mia-tk7dz 27 дней назад
love the video! good stuff
@dylancode
@dylancode 3 дня назад
The new Sebastian Lague! Excellent video!
@nad.99
@nad.99 15 дней назад
Halfway through this video i feel kms cuz I don’t see myself getting this good anytime soon. Man you’re awesome.
@jahaynes256
@jahaynes256 17 дней назад
I have had this as a future project in my mind for years. I never went to third dimension due to the fear of linear algebra. This is really impressive and inspirational. Thanks for sharing.
@megalos2030
@megalos2030 Месяц назад
Very good video !
@Gaiuscassius565
@Gaiuscassius565 21 день назад
super cool job. Very inspiring i wish i could do something like this
@mathiasensimon
@mathiasensimon 27 дней назад
Cant wait for more videos😊
@css2165
@css2165 25 дней назад
I hope this isn't going to be one of those channels that uploads 3 fire videos and then disappears for years Keep going bro 💯
@Green-Code
@Green-Code 21 день назад
Great video! Keep it up!
@Raskoll
@Raskoll 29 дней назад
Excellent video
@Wannabetolkien
@Wannabetolkien 18 дней назад
Amazing Work ! Post more content.❤
@aakkii5271
@aakkii5271 24 дня назад
Great channel potential, subbed
@shuraosipov
@shuraosipov 25 дней назад
Good job, man!
@prateek3167
@prateek3167 17 дней назад
great work
@DwellerLord
@DwellerLord 14 дней назад
This is the best video I've seen all year
@justins7796
@justins7796 13 дней назад
dang you're a legend if you used a physical Linear Algebra textbook to solve your problems. Subbed!
@blvnktek
@blvnktek 29 дней назад
You got my sub sir!
@Stylpe
@Stylpe 27 дней назад
This is going to be a fantastic springboard for my own physics sim ideas! Starred, will fork when this makes it to the top of my project queue (it's about number 3 I'd say, but full disclosure, it might also never happen 😛)
@charliechimp6917
@charliechimp6917 26 дней назад
Mesmerising
@user-zj3dd4yb3f
@user-zj3dd4yb3f 29 дней назад
Now I want to do this by myself.
@yousiftop7605
@yousiftop7605 29 дней назад
very enjoyable video
@sythatsokmontrey8879
@sythatsokmontrey8879 24 дня назад
Dude we have the same story. I spent 2 years building a physic engine because I saw that one video. But mine is in JS. it's terrible. I love it. Great video BTW.
@bramhuis3571
@bramhuis3571 24 дня назад
This video is amazing! It reminds me of Sebastian Lague’s video’s.
@Rahim-444
@Rahim-444 19 дней назад
yea very similar project
@the_speedy_dog6808
@the_speedy_dog6808 29 дней назад
this was amazing :)
@gedaliakoehler6992
@gedaliakoehler6992 29 дней назад
Great video, graphics engine, and physics engine :)
@Codrootbeyond
@Codrootbeyond 29 дней назад
Great video
@nordmu
@nordmu 16 дней назад
amazing video
@Alexander-pk1tu
@Alexander-pk1tu 17 дней назад
Good work man!!
@serhiiko7141
@serhiiko7141 29 дней назад
this video deserves much more than 2.7 k views
@antonpkf
@antonpkf 9 дней назад
good job b!
@rgel3762
@rgel3762 26 дней назад
Just what I was looking for
@ronald1851
@ronald1851 29 дней назад
awesome possum my guy
@Spencersstory
@Spencersstory 18 дней назад
Sick good work man. Makes me remember why I chose computer science
@Ace-fkubar
@Ace-fkubar 13 дней назад
Really Enjoyed the video Very cool! I had the same vibe from you as 3Blue1Brown.
@barkaouiaziz8926
@barkaouiaziz8926 20 дней назад
great content keep going
@3dgar7eandro
@3dgar7eandro 19 дней назад
Cool Bro!
@ed7590
@ed7590 22 дня назад
Inspiring, makes me want to drop all my JS projects and return to low level.
@m3tazodeh66
@m3tazodeh66 15 дней назад
This is soo cool
@Charky32
@Charky32 17 дней назад
its amazing
@shis10
@shis10 9 дней назад
Amazing 😮
@osalem192
@osalem192 16 дней назад
A new Sebastian Lague! Keep going!
@bird5790
@bird5790 29 дней назад
If you are working with grids, the paper "Compact, fast and robust grids for ray tracing" is very worth reading to optimize further
@gr4dience
@gr4dience 29 дней назад
I'll check it out!
@JMW1906
@JMW1906 29 дней назад
One more was to implement optimization is to compare the length squared (in handle collision) instead of competing the length. It means you replace a square root call (expensive) with two multiplications (one of the radius is the same), which can even be pre computed once if every sphere has the same radius: x²+y²+z² < 2r²
@gr4dience
@gr4dience 29 дней назад
That was my initial thought as well! The only issue is that to "resolve" the collisions, you still need to push each particle apart by half their separation so you would need to compute the distance regardless. I tried moving the square root function inside that condition but it didn't make too much of a difference :)
@JMW1906
@JMW1906 29 дней назад
@@gr4dience true, haven't thought about the fact that you need the value later. Still interesting though that it makes almost no difference when computed inside the if body. I think that means the grouping into chunks optimization to not check every sphere against every other has a good grid size and already avoids most checks, so most checks have to do the sqrt anyways.
@scattermc
@scattermc 29 дней назад
Insane nice work
@scattermc
@scattermc 29 дней назад
Literally turned on all notifications, its people like you that keep me eager to learn more and more. Without you i'd be dull
@jonathan2847
@jonathan2847 22 дня назад
Engineers make a small number of good RU-vid videos then dip back into the void to do their job. This is the good shit.
@Revvol93
@Revvol93 17 дней назад
love it!
@bonekazz-8441
@bonekazz-8441 20 дней назад
thats so cool bro
@omarwagmes
@omarwagmes 15 дней назад
we need the long version of this please
@user-nu5up8ff3c
@user-nu5up8ff3c 18 дней назад
great video, btw are you using Intel Mac or M chip ?
@elon_mysk3278
@elon_mysk3278 25 дней назад
Hey there, Gradience! I have a few questions for you! First off, I'm curious about how you created the particle simulation using Python. Which frameworks or modules did you use? I consider myself pretty advanced in Python, but I've never seen particle simulations implemented with Python before! :D I'm actually in the process of teaching myself C++ with the intention of creating a particle simulation. I believe it would be incredibly useful for my work as a Research Assistant in mechanical engineering! Your video has actually motivated me quite a bit! :D Also, in your pinned comment, you mentioned that your semester just ended. Could you tell me more about what and where you're studying? Looking forward to more content from you!
@gr4dience
@gr4dience 22 дня назад
Hello! For the Python version I used the NumPy and Pyrr packages for math and linear algebra respectively (they both rely on C internally for some operations/speed). Additionally I used PyGame for window/input management and OpenGL (PyOpenGL wrapper) for rendering w/ the GPU. You can certainly get pretty far with Python and it allowed me to prototype very quickly. The fact that you can create an entire HashMap with just 4 characters is truly remarkable. That being said, I wouldn't recommend it for a long-term project because of the poor performance and lack of real infrastructure for something like real-time simulation. I am currently a CS student in North Carolina. Thanks for the support and best of luck on your project!
@StevenMartinGuitar
@StevenMartinGuitar 23 дня назад
"still a million bugs left to implement" 😂
@aspectreishauntingeurope
@aspectreishauntingeurope Месяц назад
very cute!
@polknosik
@polknosik 15 дней назад
nice video
@NormanWasHere452
@NormanWasHere452 22 дня назад
I was also inspired by similar videos like yourself and having just watched this I'll definitely start play around having finished exams! How do you recommend I start? I was planning on jumping into C++ and OpenGL or Unreal (I've been wanting to learn C++ for this reason) but I saw you used some Python, I have some experience with python but its mostly scripting for data analysis and ML.
Далее
Coding Adventure: Simulating Fluids
47:52
Просмотров 1,6 млн
I didn't like this game
0:27
Просмотров 44
Why I Like Programming in C.
3:16
Просмотров 17 тыс.
You Are WRONG About 0 Based Indexing
25:02
Просмотров 205 тыс.
2D water magic
10:21
Просмотров 440 тыс.
Signals. I spent 2 years to understand this part.
21:24
The purest coding style, where bugs are near impossible
10:25
I Optimised My Game Engine Up To 12000 FPS
11:58
Просмотров 483 тыс.
Procedurally Generating Icons for my Farming Game
18:50
how NASA writes space-proof code
6:03
Просмотров 2 млн