From 0780f1d55dde8371f41341d9fdcd14c8efe5ce56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Mon, 1 Jul 2019 16:41:15 +0000 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d8d48e..1de7c5c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # small3dlib -3D software rasterizer for (not only) resource-limited computers. +Public domain 3D software rasterizer for (not only) resource-limited computers. If you like this, you may also like my similar project: [raycastlib](https://gitlab.com/drummyfish/raycastlib). From 3907a46b9b32f6db9bdccd78185bd1721fd84335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Mon, 1 Jul 2019 18:02:49 +0000 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1de7c5c..d471906 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ The basic philosophy is: ## tips/troubleshooting - Don't forget to **compile with -O3!** This drastically improves performance. +- Your pixel drawing function (`S3L_PIXEL_FUNC`) will mostly be the performance bottleneck, try to make it as fast as possible. The number of pixels is usually much higher than the number of triangles or vertices processed, so you should focus on pixels the most. - In your `S3L_PIXEL_FUNC` **use a per-triangle cache!** This saves a lot of CPU time. Basically make sure you don't compute per-triangle values per-pixel, but only once, with the first pixel of the triangle. You can do this by remembering the last `triangleID` and only recompute the value when the ID changes. See the examples for how this is done. - 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. - Seeing triangles weirdly deform in front of the camera? Due to the lack of proper near plane culling one of the options (`S3L_STRICT_NEAR_CULLING == 0`) deals with this by pushing the vertices in front of the near plane. To fix this either manually subdivide your model into more triangles or turn on `S3L_STRICT_NEAR_CULLING` (which will however make the close triangles disappear).