1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-20 20:29:58 +01:00
Find a file
Miloslav Číž 9c5024dcd2 COntinue city
2019-06-22 04:04:16 +02:00
programs COntinue city 2019-06-22 04:04:16 +02:00
tools Update 2019-06-17 21:51:23 +02:00
README.md Update README.md 2019-06-22 02:00:14 +00:00
small3dlib.h Use helper function in demos 2019-06-21 23:47:30 +02:00
todo.txt Start level demo 2019-06-21 21:29:51 +02:00

WIP, NOT WORKABLE YET!

small3dlib

3D software rasterizer for (not only) resource-limited computers.

If you like this, you may also like my similar project: raycastlib.

eye-candy previews

TODO

features

  • Very fast, small and efficient.
  • Uses only integer math (32bit).
  • No dependencies (uses only stdint standard library), extremely portable.
  • Single header, KISS.
  • Pure C99, tested to run as C++ as well.
  • Still flexible -- pixels are left for you to draw in any way you want with a custom fragment-shader like function.
  • Perspective correction, 3 modes: none (linear only), full (per-pixel), approximation (per-N-pixels).
  • Different drawing strategies to choose from: none, z-buffer (none, full, reduced), triangle sorting (back-to-front, fron-to-back with stencil buffer).
  • Triangles provide barycentric coordinates, thanks to which practically anything that can be achieved with OpenGL can be achieved (texturing, shading, normal-mapping, transparency, PBR, shadow mapping, ...).
  • Tested on multiple platforms (PC, Arduboy, Pokitto, Gamebuino META).
  • Many compile-time options to tune the performance vs quality.
  • Well commented and formatted code.
  • Completely free of legal restrictions, do literally everything you want.

limitations

  • Though performance is high, due to multiplatformness it can't match platform-specific rasterizers written in assembly.
  • Proper near-plane culling (subdividing triangles) is missing. You can either cull whole triangles completely or "push" them by the near plane. These options are okay when drawing a models not very close to the camera, but e.g. 3D environments may suffer from artifacts.
  • Due to the limitations of 32bit integer arithmetics, some types of movement may be jerky.

TODO

how to use

TODO

tips/troubleshooting

  • Seeing buggy triangles flashing in front of the camera? With the limited 32bit arithmetic far-away things may be overflowing. Try to scale down the scene. If you also don't mind it, set S3L_STRICT_NEAR_CULLING to 1 -- this should probably solve it.