Skip to content

A program that emulates the 3d processing rendering from scratch in the CPU with C++

License

Notifications You must be signed in to change notification settings

RodrigoPAml/SoftwareRasterizer

Repository files navigation

SoftwareRasterizer

A program that emulates the 3d processing rendering from scratch in the CPU with C++ maded for fun

It uses assimp to import some 3d objects files with materials

245673981-bf4f6ff5-3029-439f-a41e-f891bf68d838

GIFS

Check some results

gif2

gif3

gif1

What is implemented ?

  • Perspective projection (world, camera and screen space ...)
  • Naive triangle "clipping"
  • Camera implementation with translation (with front, right and up vectors) and rotation (based on pitch and yaw)
  • Basic triangle scan line using triangle bounding box
  • Triangle interpolation for vertex attributes with z correction
  • Per pixel light, uv mapping with textures, wireframe, depth testing and more
  • Everything is writed in an array of pixels (Pixel buffer) and sended to GPU to draw as a simple texture
  • GPU is not used at all (only to show the result)
  • Face culling based on camera front vector (recent)

image

Menu options

  • Change framebuffer resolution
  • Draw mode (wireframe, light, normals, positions, uvs, patterns, depth)
  • Camera movement and rotation speed
  • Fov, Aspect Ratio
  • Pattern scalar
  • ZFar and ZNear planes

Funny Results

  • Here is some print of the results with the best angle

Images

image

image

4

image

Sponza

image

image

image

Fortress

image

image

image

To do

  • A better triangle drawing algorithm, to get more peformance
  • Triangle clipping is done perfectly only on Z axis, maybe if done in all axis will increase performance

About

A program that emulates the 3d processing rendering from scratch in the CPU with C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published