Coding Challenge #112: 3D Rendering with Rotation and Projection

In this coding challenge I render a 3D object (cube) in 2D using rotation and projection matrices in Processing (Java).

🔗 Matrix Multiplication:
🔗 Rotation Matrix on Wikipedia:
🔗 3D Projection on Wikipedia :

🎥 4D Hypercube(Tesseract):
🎥 Matrix Math:
🎥 Matrix Multiplication for 3D Rendering:

🚂 Website:
💖 Patreon:
📚 Books:

🎥 Beginners:
🎥 Coding Challenges:







21 responses to “Coding Challenge #112: 3D Rendering with Rotation and Projection”

  1. Ciccio&Bombo Avatar

    19:00 technically the light source is infinitely far away
    19:43 applying the X matrix to the PVector, then applying the Y and Z matrixes is the same as applying a single XYZ matrix. This XYZ is made matmultipling Z with Y and then the result with X. The order matters.
    Graphically Z×(Y×(X×V)) == (Z×Y×X)×V

  2. Guysudai1 Avatar

    I did the same thing in assembly as a school project(only for more shapes)

  3. Jaultaub Avatar

    I always wondered how 3D rendering works. Never thought that it was that 'easy'.
    I now really want to build this in C and draw 3D stuff to the console!

  4. Niklas Aichinger Avatar

    Amazing Video Can you do the 4 Dimension Coding Challenge on a livestream?

  5. Peter Lous Avatar

    Nice coding challange! How do you prevent division by zero when doing the perspective projection (i.e. distance – rotated.z = 0)?

  6. kevnar Avatar

    Coding Challenge for you, Daniel: Create a 2D maze (as in your maze challenge), then render it in first person perspective using points and lines as in this challenge. Let the user walk around in it with keyboard clicks and mouse looking.

    I attempted this years ago in Visual Basic 6.0, without knowing any of this matrix math. It nearly broke my brain.


    I have the same shirt. Same pinch!

  8. Antonio Estrada Avatar

    Coding Challenge – Line Follower Robot Simulation

  9. Maxim Patrat Avatar

    When you coping parts of code with mistakes , somewhere one coder dies

  10. Bruuuce Ted Avatar

    I saw the content on the slack several days ago and I can saw it on YOUTUBE now! AMAZING

  11. Chemielehrer und Philosoph Avatar

    I really enjoy watching your videos! The enthusiasm you show is totally addictive 😉

  12. Tomyk9991 Avatar

    will machine learning and ml5 be available in processing itself sometime?

  13. Danny Schulze Avatar

    Hey David, you should make a tut all about web tracking, web trackers, and how to make a basic url web tracker!

  14. giorgio marchetti Avatar

    Thank you, thank you for everything!

  15. Ivanovic Romano Avatar

    AMAZING!!!! If somebody asked me to do this, I wouldnt even dare to try since I thought is super complex… had no idea it can be so easy!!

  16. William Fritzon Avatar

    I found your channel a few days ago, since I've been looking for some fun ways to learn programming. Finally I found someone with a playful spirit, love your videos!

Leave a Reply

Your email address will not be published. Required fields are marked *