I am making a 3d renderer with python and so far am sorting the triangles which I want to replace with a z-depth buffer. The thing is, I don't know how to make a z-depth buffer in pygame. I still want it to be playable however.

By the way, I am using pygame polygons.

  • 1
    \$\begingroup\$ This answer appears to describe what you're looking for. \$\endgroup\$
    – Vaillancourt
    Apr 22 at 14:15
  • 1
    \$\begingroup\$ Hello & welcome to the Game Dev SE! We also have this post discussing some potential issues with implementing a homemade z-depth buffer with SDL2. However, I'm not familiar enough with Pygame or your project to know how applicable the details are to your situation. Could you edit your question to include more information about the problems you are having & why you are considering using a depth buffer? It's possible that there may be some other solutions. \$\endgroup\$
    – Pikalek
    Apr 22 at 14:23
  • \$\begingroup\$ But I don't want to loop through each pixel. It would be super slow. \$\endgroup\$ Apr 22 at 14:43
  • \$\begingroup\$ Pygame is made with sdl so It shouldn't be to different \$\endgroup\$ Apr 22 at 14:44
  • \$\begingroup\$ Looks like you want to use a depth buffer to fix issues that arise even with sorting triangles. Depth buffers work on pixels, unfortunately. This other question could be of use. \$\endgroup\$
    – Vaillancourt
    Apr 22 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.