Software Rasterizer

This project was about rendering objects to the screen using only the CPU. I started off with a template to open a window, and some functions to render pixels on the screen buffer. First of all I created a triangle, and rendered it to the screen. for this I looped over the triangle’s edges, and filled two arrays with the most-left and most-right position on the screen. After that I looped over the screen vertically, and drew lines between the two. With this one triangle was rendered. After this I started to store additional information, such as vertex colour, texture coordinates, and a z-buffer.

After rendering triangles was working, I wrote a Obj-loader so that I could load 3D models and render them on the screen. Since .obj files are just lists of vertex positions, vertex normals and texture coordinates, this was pretty easy. It was nice to see objects being rendered once it was working.

For the scene I created a scene-graph. Every object is a scenenode. The buny is one scene node, which is attached to the ground, which is its parent, and also a scenenode, which is attached to the world. Changing the scaling, rotation or position of a parent will also change the settings to their child nodes, transforming their vertices into the right space.

Optimization was a big part of this project. I pust a lot of work into optimizing the cache speeds by making it data-orientated instead of object orientated. Whenever data from an array gets loaded into the cache, the CPU copies the part behind it as well, lowering the time it takes to fetch this data for the following iterations. mainly because of cache optimizations my software rasterizer is able to run 60FPS on one core of modern processors in a scene with over 200.000 triangles.

55 thoughts on “Software Rasterizer

  1. Pingback: generic for cialis
  2. Pingback: new cialis
  3. Pingback: generic cialis
  4. Pingback: 20 cialis
  5. Pingback: cialis 5 mg
  6. Pingback: viagra for sale
  7. Pingback: payday advance
  8. Pingback: installment loans
  9. Pingback: short term loans
  10. Pingback: cialis 20 mg price
  11. Pingback: best online casino
  12. Pingback: buy cialis
  13. Pingback: levitra 10mg
  14. Pingback: vardenafil 20 mg
  15. Pingback: cialis online
  16. Pingback: pharmacy online
  17. Pingback: top erection pills
  18. Pingback: viagra generic
  19. Pingback: viagra 50mg
  20. Pingback: viagra 100mg
  21. Pingback: buy careprost
  22. Pingback: generic for cialis
  23. Pingback: Buy now viagra
  24. Pingback: cialis india

Comments are closed.