Coding a Rotating 3D Cube in C

preview_player
Показать описание
✘ Get Source Code and Early Video Access on Patreon:

(Affiliate Links):
✘ Learn to Code at CodeCrafters:

✘ How I Study:

In this episode we define the 3D cube's sides (using points in 3D space), and then we render that cube to the screen using a very simple projection (plain projection, ignoring the depth coordinate). The result is a 2D-looking plain square that is actually a 3D cube in disguise.
Then, we animate the 3D cube and make it rotate! This requires some matrix multiplication with rotational matrices.
Рекомендации по теме
Комментарии
Автор

I had the same excitement as you got when it finally work, I was suffering with you. I like so much this content, keep doing it

MiguelCollado-ow
Автор

had fun doing this!! I felt the "what the hell is that?" at 1:53:41. The excitement when it finally works OMG it was awesome. Also if anyone is curious try changing a sign or value in the rotation matrix. It gives a very interesting pattern which, it think after some tweaking can be made to repeat cyclically for a cool background or something.

harinayan
Автор

This series gave me motivation to start C, keep going with the great content

PixelatedDoesStuff
Автор

Project suggestion: quite easy but very fun, calculating PI using the colliding blocks in a perfectly elastic world. Very fun project I did when I started programming, though I think it'd be a bit too easy for you but fun none the less.

Also very nice video, congrats on learning so much :)

piolix
Автор

Haha, I like the excitement once you got it working! Nice work!

landonbrown
Автор

Great content! Please keep up. It helps me learn alot from coding along with your video. Btw, i suggest the next tough project of "multiple dof forward/reverse kinematics visualized simulation" for your consideration.

mechasteed
Автор

This stuff is gold! Thanks Daniel. I've been following along learning how to use SDL with C on macOS.

sonodrome
Автор

I love these coding videos in C + Vim ❤. Can I suggest a next project for a video ? Trying to recreate a simple Geogebra in C, for entering a function and draw it over x and y cordinates

robertobertocchi
Автор

I started learning SDL by following your tutorials especially the Game of Life in C series. You are really creative thank you for this tutorial

Do you have AI lessons in libraries from your programming in C ?

ALG
Автор

Hey man! I am a great fan of yours from India!

kalaidoscopez
Автор

Without using gpt wow you own my respect king

CihansahYILMAZ
Автор

At 50:00 I think your approach is very literal. I would have set the Z axis as a 1x1 pixel, where, max zoom was, depending on perspective, maybe 15x15 pixels.

The math would be very different. The cube would actually appear to become closer to the viewport this way. Your method does not simulate depth, especially when you check the perspectives for line geometry

Both work, however. Your rotating cube is still impressive

AnaMaddison
Автор

I love your videos, I am also planning on to start a channel where I do C videos

CandCpp
Автор

bro can you do a tutorial for c and SDL? wanna do stuff like this

ChrisTian-ejzb
Автор

Your approach is interesting.
I was wondering how far can we go drawing points in a surface to create a "fake 3d". Yeah, fake in quotes because i consider everything on the screen as fake.
In fact doesn't matter if you are using 2d surface to create a cube rotating or actually drawing a cube in a 3d space. What's really matter is what people perceive. And you hit the point with simplicity.
Nice work!

Vulto
join shbcf.ru