{"id":19071073,"url":"https://github.com/mokiat/softgfx","last_synced_at":"2025-09-05T05:42:14.127Z","repository":{"id":82147446,"uuid":"245369022","full_name":"mokiat/softgfx","owner":"mokiat","description":"Software Graphics in Go and WebAssembly","archived":false,"fork":false,"pushed_at":"2022-05-29T09:28:37.000Z","size":3187,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T17:19:36.384Z","etag":null,"topics":["go","golang","software-rendering","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://mokiat.com/softgfx/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mokiat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-06T08:40:01.000Z","updated_at":"2024-12-02T15:10:41.000Z","dependencies_parsed_at":"2023-03-01T02:30:39.148Z","dependency_job_id":null,"html_url":"https://github.com/mokiat/softgfx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fsoftgfx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fsoftgfx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fsoftgfx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fsoftgfx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mokiat","download_url":"https://codeload.github.com/mokiat/softgfx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251336700,"owners_count":21573246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","software-rendering","wasm","webassembly"],"created_at":"2024-11-09T01:22:13.984Z","updated_at":"2025-04-28T15:23:35.382Z","avatar_url":"https://github.com/mokiat.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Software Graphics\n\nThis project demonstrates the implementation of old-school 3D software graphics in [Go](https://golang.org/) and [WebAssembly](https://github.com/golang/go/wiki/WebAssembly).\n\n[![preview](preview.png)](http://mokiat.com/softgfx/index.html)\n\nThe demo can be accessed at [http://mokiat.com/softgfx/index.html](http://mokiat.com/softgfx/index.html)\n\n## History\n\nOriginally, this project was implemented in Pascal and then in Delphi. I wanted to play around with Go and its WebAssembly support and this seemed like the ideal project to port. \n\nAlong the way, I switched to 32 bit colors, from the original 8 bit ones, increased the resolution, fixed some bugs and improved the code. I also introduced my own level generator that converts obj files into bsp extrusion levels (with a lot of caveats).\n\nI have bundled the application and level generator source code into a single repository (a monorepo). Originally they were split into two separate projects - `space-insomnia` and `space-insomnia-levgen` respectively. I have since renamed the project to a more descriptive, yet short, name.\n\n## Tutorial\n\nWhile the end result might not be that mesmerizing, when compared to modern hardware-accelerated 3D graphics, the algorithms and optimizations that were used can be quite fascinating, especially for someone that is new to graphics programming. In my early days, seeing how the math, data structures, and algorithms used in a few lines of code can produce something almost tangible inspired me to pursue software development further.\n\nI would like to pass this feeling forward to the few brave individuals that dare to get their hands dirty. I am planning on documenting the main algorithms, equations, and optimizations that were used in the [Wiki](https://github.com/mokiat/softgfx/wiki) section of this project. Hopefully, it serves as a good starting point for anyone that wishes to understand the inner workings of the software renderer.\n\n## References\n\nImplementing the software renderer required the usage of both low-level and high-level optimizations, mathematics, data structures and algorithms. A key source of information has been _Ivaylo Belchev_'s masters thesis and the [BOOM 2 Engine](http://www.geocities.ws/SiliconValley/Bay/2234/boom2.htm).\n\nThe level that is shown in the demo was modeled in [Blender](https://www.blender.org), exported to an obj file and converted to an extrusion map with the custom level generator. The textures used were downloaded from [TextureHeaven](https://texturehaven.com/) and downscaled to the required size.\n\nFollowing are some other interesting resources on the subject matter that I have since come across:\n\n* [Lode's Computer Graphics Tutorial - Raycasting](http://lodev.org/cgtutor/raycasting.html)\n* [Fabien Sanglard's Duke Nukem 3D: Build Engine Internals](http://fabiensanglard.net/duke3d/build_engine_internals.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokiat%2Fsoftgfx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmokiat%2Fsoftgfx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokiat%2Fsoftgfx/lists"}