After adding rain and snow to the new renderer yesterday (sw-renderer-redesign-part-2 branch), I noticed some particles occasionally stretch towards (0, 0, 0) when they are near a screen edge.
Pushing the camera into a wall also generates a jumble of triangles that I don't see in most 3D games. This is likely the same problem.
The clipping is done in the swGeometry namespace. ClipTriangle() and ProcessMeshForRasterization() are the most important functions that need improvement.
Ideally it would look the same as how OpenGL and Direct3D clip triangles, like one clean cut across the near plane. I took the easy way by doing math in world space with 3D clipping planes instead of doing it in clip space with the W coordinate like graphics APIs do.
This is my first triangle rasterizer that I learned from One Lone Coder tutorials, so anyone who knows better can probably help out. Performance has also been a struggle since the start so any improvement would be great!
Fixed in 426b97fc9bd8f14bf8c274cde841407249622574 on sw-renderer-redesign-part-3. It was caused by winding order not being respected when populating the inside and outside point arrays.
After adding rain and snow to the new renderer yesterday (
sw-renderer-redesign-part-2
branch), I noticed some particles occasionally stretch towards (0, 0, 0) when they are near a screen edge.Pushing the camera into a wall also generates a jumble of triangles that I don't see in most 3D games. This is likely the same problem.
The clipping is done in the
swGeometry
namespace.ClipTriangle()
andProcessMeshForRasterization()
are the most important functions that need improvement.https://github.com/afritz1/OpenTESArena/blob/d852a1a0e645191f372d7a7c9309b3db601a6709/OpenTESArena/src/Rendering/SoftwareRenderer.cpp#L130 https://github.com/afritz1/OpenTESArena/blob/d852a1a0e645191f372d7a7c9309b3db601a6709/OpenTESArena/src/Rendering/SoftwareRenderer.cpp#L340
Ideally it would look the same as how OpenGL and Direct3D clip triangles, like one clean cut across the near plane. I took the easy way by doing math in world space with 3D clipping planes instead of doing it in clip space with the W coordinate like graphics APIs do.
This is my first triangle rasterizer that I learned from One Lone Coder tutorials, so anyone who knows better can probably help out. Performance has also been a struggle since the start so any improvement would be great!