Close

Proposed Rendering Pipelines

A project log for C70100 GPU

The Goal: 3D rendering on an FPGA

dylan-brophyDylan Brophy 10/10/2020 at 04:310 Comments

Why would I look at this before having a fully functional processor?

I need to know what operations I will be doing the most, and perhaps even write the software that will be rendering, before I design the instruction set.  By understanding the program I'll be running I can optimize the processor for that program.

There are three main ways I want to be able to render:

Rasterization

Here is my idea:

  1. Create a depth buffer somewhere, storing distance from the camera
  2. For each triangle, project the three vertices
    1. For each pixel in that triangle compare with the depth buffer, overwrite if closer to camera
    2. Also compute fragment color and write to color buffer if closer to camera
  3. Swap the video generator's address with that of the color buffer
    1. Old color buffer is new image, old image is new color buffer
    2. This achieves double buffering

Ray Tracing

Not sure if I ever want to really program this, but I want the option.

  1. For each pixel
    1. Find the nearest triangle (if any) that would render on that pixel
    2. Compute the color of that pixel using the triangle (or lack thereof)
    3. Write the color to the pixel

2D Images

Here we need the option of rotating images and computation of depth (think 2D games like Starbound).  Possibly smooth lighting or cool graphical effects.

  1. Create a depth buffer and color buffer
  2. For each sprite instance
    1. For each pixel in the sprite compute a rotated position for it
      1. Shade and write color to the color buffer
  3. Swap the video generator's address with that of the color buffer
    1. Old color buffer is new image, old image is new color buffer
    2. This achieves double buffering

This is surprisingly similar to the Rasterization pipeline...  Am I doing something wrong?  Please let me know if I am, I'm somewhat new to this :P

Discussions