Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a detail tesselated 3D graphics engine #113

Open
Dawoodoz opened this issue Dec 28, 2024 · 1 comment
Open

Create a detail tesselated 3D graphics engine #113

Dawoodoz opened this issue Dec 28, 2024 · 1 comment
Labels
Big task This can take months to complete and may generate sub tasks. enhancement New feature or request Realism

Comments

@Dawoodoz
Copy link
Owner

Dawoodoz commented Dec 28, 2024

To showcase that software rendering is a lot more capable when not trying to follow how graphics cards render things, a 3D graphics engine with a custom rendering pipeline is needed. The traditional texture sampling rendering pipeline is okay for low polygon graphics, but the high overhead of trying to do everything would be bad for performance.

How the tesselated 3D engine should work:

  • Everything is drawn sorted by depth, from far away to close.
  • Needs heavy use of occlusion shapes to reduce redundant drawing.
  • Anti-aliasing uses the depth sorting to let edges between front and back facing polygons be drawn with a soft edge. So each triangle drawn needs to know about its neighbors by shared vertex indices.
  • All textures are baked into detail tesselated vertex data when geometry is loaded.
  • Models that have not been near the camera for a long time can free the highest resolutions of pre-generated geometry to save memory.
  • There is no perspective correction, only affine polygons. This allow iterating a color and depth offset in a SIMD vector.
  • Triangles are always assumed to be small, so that no integer division is needed to rasterize. Just calculate affine vertex weights using integers and compare while adding offsets.
  • The vertex format should be packed in such a way that as much as possible is processed without random access of vertex data. This usually reduces rendering time by 50% by avoiding cache misses.
  • Store vertex colors using small integers for fitting more geometry into the cache.
  • Shading to vertex color can saturate brightness before storing the color in a vertex buffer, so that no saturation is needed when drawing pixels.
  • Anisotripic filtering can be done by letting each pyramid level of a texture contain pre-blurred viewing offsets as higher dimensions. Looking up these pre-computed colors and writing them into vertex color buffers can be done slowly on a schedule.

This has the potential to give realtime 3D graphics on par with older graphics cards, but with a very different visual style. It will either look a little blurry from not affording enough color detail on a low end CPU, or really nice from having extreme detail tesselation where you can no longer tell that textures are replaced with vertex colors on a high end CPU.

@Dawoodoz Dawoodoz added enhancement New feature or request Big task This can take months to complete and may generate sub tasks. Realism labels Dec 28, 2024
@Dawoodoz
Copy link
Owner Author

Dawoodoz commented Dec 30, 2024

It would be easier to keep a common format if the existing 3D rendering takes semi-planar vertex buffers. Then one can separate vertex shading from rasterization of the transformed data. Reusable SIMD functions can transform vertex buffers in virtual stack memory to transform and animate geometry. Multiple results should allow implenting deferred rendering. Embedding scripts that implement custom modifiers on whole vertex buffers can then be used for customizable geometry compression and animation independent of the application's code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Big task This can take months to complete and may generate sub tasks. enhancement New feature or request Realism
Projects
None yet
Development

No branches or pull requests

1 participant