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.

61 thoughts on “Software Rasterizer

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

Comments are closed.