I'm a graphics developer. I developed a Game Engine in C. I know only 200 spheres are nothing for your graphics card. Reason why your FPS dropping is, because raylib maybe 200 draw calls behind the scene. If you optimize ur draw calls u can only 1 draw call and draw more than 10000 spheres without any problem. Graphics card and CPU is actually like server client architecture. Imagine u send 200 sync requests to server for each sphere, instead 1 request for 200 spheres...
I feel the problem is also that Raylib generates a new sphere each time you do a DrawSphere() call. Like I did some messing around and you can get a lot of performance if you load a sphere model before the loop and then draw that model instead of doing DrawSphere(); You can get a simple sphere with LoadModelFromMesh(GenMeshSphere(radius,slices,rings)); so thats also pretty neat Like in the DrawSphere() case I draw 1,000 spheres at like 15fps but when drawing the pre-loaded sphere model I get like 40fps when doing 10,000 spheres. Both using -O3 as the flag if that matters for graphic stuff, and I loaded a model with 16 slices and rings which is the same number DrawSphere() uses. It's by no means a professional test, but you can notice it running better
@@matthias916 I don't know how raylib implemented under the hood. But I'm damn sure it's not about how many triangles, vertices and fragments. Specially fragment shader doesn't compute lighting, shading etc... expensive calculations. On the screen only few fragments with simple flat colors. There is no way only 200 spheres that much lag. I'm just guessing maybe too many OpenGL calls. Copy data to GPU and draw etc... Each OpenGL calls are blocking. Maybe beginMode3D and endMode3D just switching shader programs. Not buffering for batch rendering.
I've been loving these streams on raylib! Raylib is such a wonderful library. By the way, raylib has an rcamera module which makes a lot of the math you did redundant with one super easy function, namely UpdateCamera, for moving the camera with usual controls under a variety of modes, and a couple of lower-level functions, namely CameraMoveForward, CameraMoveRight, CameraMoveUp, CameraYaw, and CameraPitch, for managing the camera yourself, and some even lower-level functions that I won't name.
This was so cool to watch, starting from the algorithm and all the way to applying it to color quantization and image compression. You've inspired me to build some image processing projects of my own.
I think using only the unique colors is a good idea for optimisation, but maybe it would make sense to keep track of the number of times each unique color appears in the image, to give more weight to these colors depending on the amount of pixels they correspond to (unless you're already doing that and I missed it). (Also default sRGB is a terrible color space to do quantization in, but it doesn't matter too much)
It makes very much sense for an api to expose degrees as it allows the user to, most of the time, input exact values: 30, 45 or 90 are nicer to type and read than fractions of pi. It's even more true if you read your values from some config file and feed the api directly.
That's pretty freaking cool, a simple dither mask pre-applied before quantizing would make an even bigger difference at the low color counts I bet. I've always wondered how to do this kind of thing, but never really looked into over the years, it's so stupid simple!
And that is why programmers and computer scientists get paid so much. Because we're the only ones that are stubborn and stupid enough to put up with that crap every single day.
Also, classical end-of-stream comment: after years trying complex dithering algorithms, I loved how such a simple and elegant solution exists. I'll definitely try that approach if I need it. Or try that visualisation in Vulkan (just because I can 😄).
hold all fingers together, index finger pointing towards positive x, curl your fingers into a thumbs up, they curl towards positive y, positive z is the direction of your thumb.
hey look man, i quick and easy mercy evaporation is in both of our best interests, i go poof and escape mad man next door, you continue reclaiming a throne that always belonged to you - its a win win
@@neshkeev Huh? This implemened multiple programming languages and just A LOT of interesting stuff. Just scorll a bit through the videos and you find many many many things that don't have anything to do with any graphical thing what so ever.
OpenGL isn't utterly insane to learn. Why people don't just write their own OpenGL code themselves and take responsibility for their apps' performance is beyond me.
Interesting that they use degrees, because I thought radians were standard. Maybe that's just for the things I've been doing and not graphics programming? I wish I could get you a new computer because your potato is more highly starched than mine. I would just use GIMP to specify an image size, but it might be too much for your computer to handle. Of course I should probably use my image library to do such simple things more like you use STB. And your statement about spending too much time on rotation really hits hard, but not in the way you meant it. Too much time on rotation can really give you PTSD. Although I doubt anyone else watching you will understand what I'm talking about.
Too bad Raylib uses raw GL vertex primitives behind the scenes. So each sphere/cube pumps one draw call per vertex. 200 spheres isn't much, but it shows how OpenGL sucks unless you use array objects, instances, etc.
@@paca3107 On the web they do, but the browser you use is written in C or C++ and so is the OS below it. JS would be a weird choice for a desktop music player unless you want to use Electron which is really slow
I'm a graphics developer. I developed a Game Engine in C. I know only 200 spheres are nothing for your graphics card. Reason why your FPS dropping is, because raylib maybe 200 draw calls behind the scene. If you optimize ur draw calls u can only 1 draw call and draw more than 10000 spheres without any problem. Graphics card and CPU is actually like server client architecture. Imagine u send 200 sync requests to server for each sphere, instead 1 request for 200 spheres...
makes sense
damn makes sense
doesnt raylib already buffer everything with the begin and end drawing methods?
I feel the problem is also that Raylib generates a new sphere each time you do a DrawSphere() call. Like I did some messing around and you can get a lot of performance if you load a sphere model before the loop and then draw that model instead of doing DrawSphere(); You can get a simple sphere with LoadModelFromMesh(GenMeshSphere(radius,slices,rings)); so thats also pretty neat
Like in the DrawSphere() case I draw 1,000 spheres at like 15fps but when drawing the pre-loaded sphere model I get like 40fps when doing 10,000 spheres. Both using -O3 as the flag if that matters for graphic stuff, and I loaded a model with 16 slices and rings which is the same number DrawSphere() uses.
It's by no means a professional test, but you can notice it running better
@@matthias916 I don't know how raylib implemented under the hood. But I'm damn sure it's not about how many triangles, vertices and fragments. Specially fragment shader doesn't compute lighting, shading etc... expensive calculations. On the screen only few fragments with simple flat colors. There is no way only 200 spheres that much lag. I'm just guessing maybe too many OpenGL calls. Copy data to GPU and draw etc... Each OpenGL calls are blocking. Maybe beginMode3D and endMode3D just switching shader programs. Not buffering for batch rendering.
TSoding
Turing Soding ❌
Terry daviS OverDosING ✅
I've been loving these streams on raylib! Raylib is such a wonderful library. By the way, raylib has an rcamera module which makes a lot of the math you did redundant with one super easy function, namely UpdateCamera, for moving the camera with usual controls under a variety of modes, and a couple of lower-level functions, namely CameraMoveForward, CameraMoveRight, CameraMoveUp, CameraYaw, and CameraPitch, for managing the camera yourself, and some even lower-level functions that I won't name.
"the source code is the best documentation" this will stick in my mind forever, thanks
This was so cool to watch, starting from the algorithm and all the way to applying it to color quantization and image compression. You've inspired me to build some image processing projects of my own.
I think using only the unique colors is a good idea for optimisation, but maybe it would make sense to keep track of the number of times each unique color appears in the image, to give more weight to these colors depending on the amount of pixels they correspond to (unless you're already doing that and I missed it).
(Also default sRGB is a terrible color space to do quantization in, but it doesn't matter too much)
It makes very much sense for an api to expose degrees as it allows the user to, most of the time, input exact values: 30, 45 or 90 are nicer to type and read than fractions of pi. It's even more true if you read your values from some config file and feed the api directly.
degrees also have higher precision than radians which is nice when working with floats
@@unnamed1479 sure, however they usually get converted into radians at some point and then you loose precision...
@@OlivierDALET heh yeah good point
Another amazing one stream, Merry Christmas
Degrees are usually used because it is a more intuitive unit than multiples of pi, in mathematics you rarely ever see a degree tbh.
That's pretty freaking cool, a simple dither mask pre-applied before quantizing would make an even bigger difference at the low color counts I bet.
I've always wondered how to do this kind of thing, but never really looked into over the years, it's so stupid simple!
And that is why programmers and computer scientists get paid so much. Because we're the only ones that are stubborn and stupid enough to put up with that crap every single day.
God I love C, keep it up!
same here, C is love, C is life! HAHAH
Also, classical end-of-stream comment: after years trying complex dithering algorithms, I loved how such a simple and elegant solution exists. I'll definitely try that approach if I need it. Or try that visualisation in Vulkan (just because I can 😄).
In germany we have a "Doppelhaushälfte" 😂
Would have been cool to see the image render in real time on screen as the means approach their local minimum
Yeah do this!
hold all fingers together, index finger pointing towards positive x, curl your fingers into a thumbs up, they curl towards positive y, positive z is the direction of your thumb.
now use CIEDE2000 for the distance metric instead of euclidean distance
hey look man, i quick and easy mercy evaporation is in both of our best interests, i go poof and escape mad man next door, you continue reclaiming a throne that always belonged to you - its a win win
- How much watches?
- Ten clocks.
- Such much?
- For whom how…
- MFTI finished?
- A-a-a-ask!..
36:28 check out the position name 4 lines below :D
Can you please make a series on system programming with C language pls.
look up handmade hero. That will give you what you need.
He can't do system programming, only computer graphics
@@neshkeevhow do you know?
@@neshkeev are you trying to Dani him?
@@neshkeev Huh? This implemened multiple programming languages and just A LOT of interesting stuff. Just scorll a bit through the videos and you find many many many things that don't have anything to do with any graphical thing what so ever.
28:26 why changing Z sign made camera see cube? isn't that just looking at cube from different direction?
Was wondering the same thing!
Zozing need a new PC, on mine , Krita loads up in under 3 seconds.
2:10:22 ! Dumy dum dum!! Ofcourse!!! lol
OpenGL isn't utterly insane to learn. Why people don't just write their own OpenGL code themselves and take responsibility for their apps' performance is beyond me.
Twice of the half of the cube
Interesting that they use degrees, because I thought radians were standard. Maybe that's just for the things I've been doing and not graphics programming? I wish I could get you a new computer because your potato is more highly starched than mine. I would just use GIMP to specify an image size, but it might be too much for your computer to handle. Of course I should probably use my image library to do such simple things more like you use STB. And your statement about spending too much time on rotation really hits hard, but not in the way you meant it. Too much time on rotation can really give you PTSD. Although I doubt anyone else watching you will understand what I'm talking about.
This only works on linux?
22:23 doesn't which way z goes depend on which way camera is looking?
pretty sure in raylib the x,y,z axes are fixed, but your unit vector for forwards and backwards would be affected by your camera direction
@@unnamed1479> unit vactor for forwards and backwards
are you talking about `position` or `target` or `up`?
@@RandomGeometryDashStuff (target - position) / mag(target - position)
great video, but pls expand your german wortschatz
Too bad Raylib uses raw GL vertex primitives behind the scenes. So each sphere/cube pumps one draw call per vertex. 200 spheres isn't much, but it shows how OpenGL sucks unless you use array objects, instances, etc.
Why you dont publish your code make it easier
the source is usually in the description
Is your Emacs evil?
Can you share with me the discord link?
it was so easy
27:30 Здорово! 😃
HOW CAN I JOIN UR DISCORD?
Bro u so smart!
1:28:33 How about that
SHAYSER
What? No 4D visualizations? Unsubscribe! 😂
please show me how to do this in serious language like javascript or react.
C isn't serious? XDDDD
@@SomeRandomPiggo is not, in real life people use js.... xDd
@@paca3107 On the web they do, but the browser you use is written in C or C++ and so is the OS below it. JS would be a weird choice for a desktop music player unless you want to use Electron which is really slow
”0" ==- null
>>true
serious language moment.
javascript
serious
ha...
First!!!
get real
im indian sir please help im indian
sorry, you cant be helped ... good luck
how can ı in discord channel ?
you dropped this .