mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-24 21:09:57 +01:00
Merge branch 'master' of https://gitlab.com/drummyfish/small3dlib
This commit is contained in:
commit
d011bdc9be
1 changed files with 2 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# small3dlib
|
# 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).
|
If you like this, you may also like my similar project: [raycastlib](https://gitlab.com/drummyfish/raycastlib).
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ The basic philosophy is:
|
||||||
## tips/troubleshooting
|
## tips/troubleshooting
|
||||||
|
|
||||||
- Don't forget to **compile with -O3!** This drastically improves performance.
|
- 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.
|
- 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 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).
|
- 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).
|
||||||
|
|
Loading…
Reference in a new issue