1
\$\begingroup\$

Note: I dont use tiles, I use 3D Polygons :)

I'm currently working on a real-time renderer for scanned real life objects. My main goal is to have an isometric viewer with the simple ability to rotate the object.

This alone is a simple problem. I basically had the full solution for it, but I wasn't happy with the performance at all.

As you might know, software rendering based on the CPU is slow (but I don't want to code a game engine, just a small viewer which should be okay with a low poly count like < 10000) but for what i need it works surprisingly good.

The only part where my renderer is toooo slow is the z-buffer (multiple seconds for a 3000 poly obj). Mainly because it loops xyobjects*polygons.

Currently I'm using some sort of painters algorithm to draw polygons one after another, which brings me some problems: https://youtu.be/PDq4xtrgoi8

As you can see the distances per poly are calculated very poorly, just the center of the poly to world point 1000,1000,1000.

My question is not just about the pointers algorithm but I'd love to use a minimal failing method of drawing the polygons in a specific order rather than calculating every pixel by z-buffering.

If you have other simple methods which work fast on a CPU, I' d really appreciate hearing about them! :)

\$\endgroup\$
  • \$\begingroup\$ I think you will run into a lot of reordering loops if you want to do z-sorting on these polygons. Take a look at this for reference: siggraph.org/education/materials/HyperGraph/scanline/visibility/… You basically need to correct for situations where a simple "who has the highest Z value" doesn't work; this increases the number of checks and calculations significantly. I don't know the solution (other than z-buffering) so posting this as a comment instead of answer. \$\endgroup\$ – Felsir Oct 13 '16 at 13:07
  • \$\begingroup\$ Depth buffering doesn't need to be as slow as you describe. You might find this article series from the ryg blog interesting. In it. the author breaks down a software renderer released by Intel, and looks at how to optimize it further. It may have some ideas you can use to speed up your implementation. \$\endgroup\$ – DMGregory Oct 13 '16 at 13:17
  • \$\begingroup\$ You are doing great so far, and painter algorithm would be my choice too. Can I ask why it has to be software renderer? My only reason to code one would be to develop more intuition on 3D math and how render engines work. But for a simple viewer I would go with old OpenGL API, fixed pipeline, no culling algorithm, no object sorting, and adjust the projection matrix for an isometric looking orthogonal projection. The same can be done with new API but you have to write a simple vertex shader to implement matrix multiplication in the correct order. Implementing a full engine isn't needed. \$\endgroup\$ – Hatoru Hansou Dec 28 '16 at 18:12
-5
\$\begingroup\$

In this book, Mathematics for 3D Game Programming and Computer Graphics - Eric Lengyel chapter 9, you can find information that can be usefull for you. Here it is a screenshot of the chapter. enter image description here

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Here on stackexchange we want to provide answer questions directly and not just point to other sources for answers. \$\endgroup\$ – Philipp Dec 28 '16 at 8:53
  • 1
    \$\begingroup\$ Maybe, you could write a summary of what's said on these chapters to make your answer more valid. \$\endgroup\$ – CpCd0y Dec 28 '16 at 9:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.