# Software rendering and zbuffering.

Alec Porter
Greenhorn
Posts: 29
Dear Fellow Javites,

Hello there! First of all I'd like to say thanks for reading my post. I know that you are busy people and taking the time to read this means a lot to me. Second, I purchased the book 'Developing Games in Java' and I have read through and enjoyed it. It is one of the best books I could find on the market for creating games in Java.

I'm writing this for some assistance with code in the book.

I started awhile back trying to put the pieces together and learn how to create a software renderer of my own. Of course it wasn't as easy as I thought it would be. I started with learning about vectors, projections, and scanline conversion. But my inexperience and lack of knowledge has lead me to a dead end.
The problem I'm facing currently is that I want to create a polygon zbuffered renderer that draws only solid colored polygons, no textures, and no shading. Now when I go to the book for reference on the subject it introduces zbuffering after shading and texture mapping. This extra information has obfuscated me and my attempts to understand how zbuffering works on its own.

I've done a fare share of research and I know(or at least think I do) how to calculate the ZDepth of a given point using the Polygon form Ax + By + Cz + D = 0, or in the book Z = d(UxV dot O) / (UxV dot W). But not for the life of me can I figure out how to apply this into code.

Attached to this link http://pastebin.com/jThNfNYh is a file that has taken the original ZBufferedRenderer class where I lopped off the shading and texture mapping parts in order to better understand how to calculate z depth by boiling it down to its bare essentials. If you have and suggestions how to do this I would greatly appreciate them.

Usually I'll keep working on a problem and try to not bother people with my questions that could be fixed by looking it up or just experimenting till it works. But this has become such a pain in my side that I'm reaching out for some help.

Thanks,
Alec