Hello, I've seen Crafti, it looks a lot more complete than mine.
The rendering is based on the triangle renderer in https://gitea.planet-casio.com/Lephenixnoir/Azur which renders in fragments to the fast on chip memory so it isn't bottlenecked by the slow main RAM, but I customised it to add textures etc. It's using barycentric coordinates over a bounding box which is probably not as fast as scanline rendering but I can try to make it use scanlines at some point.I'm also using parts of https://codeberg.org/drummyfish/small3dlib. It's using depth sorting which works fine for a simple voxel world like this but if I add things like entities and non-full blocks that might complicate things. Also, to speed things up it uses affine texture mapping (which I think yours uses too?) but splits the triangles when they get close to reduce the distortion. The splitting is causing the seams in the video, I can probably improve it by having sub-pixel precision in the triangle rendering or something
> The rendering is based on the triangle renderer in https://gitea.planet-casio.com/Lephenixnoir/Azur which renders in fragments to the fast on chip memory so it isn't bottlenecked by the slow main RAM, but I customised it to add textures etc. It's using barycentric coordinates over a bounding box which is probably not as fast as scanline rendering but I can try to make it use scanlines at some point.
Ok, interesting. Does it use barycentric coordinates for texturing only or also for single color triangles? I see that the tree is not textured and I wonder whether that's to save texture memory or to use scanline rendering.
> It's using depth sorting which works fine for a simple voxel world like this but if I add things like entities and non-full blocks that might complicate things.
It might, but it should still work fine as long as there's no unusual geometry, like overlapping itself. Depending on how you sort everything, freely moving entities might be complex but I don't think non-full blocks are much of an issue.
> Also, to speed things up it uses affine texture mapping (which I think yours uses too?) but splits the triangles when they get close to reduce the distortion.
Yep. I didn't bother with splitting up triangles (or even using partial Z based interpolation like Quake), as I don't think it's that bad of an issue.
Initially I planned for the game to be flat shaded and added textures as an experiment, then realised the performance wasn't as horrible as I expected, so it's mostly just a leftover from that. I did end up writing a scanline renderer for the flat shaded triangles, I think for those the bottleneck was transforming the vertices though.
Maybe I can deal with z-sorting entities by splitting them on voxel boundaries, and I guess dividing them again at any boundaries within non-full blocks (is this similar to https://en.wikipedia.org/wiki/Binary_space_partitioning?)
For the affine texture splitting, as far as I can tell your game is more focused on creative mode/building whereas I might also want to add a survival mode so for that you're more likely to be up close to the blocks (e.g. in thin underground tunnels) and then the artifacts get much worse so I guess it matters more for me.
> Initially I planned for the game to be flat shaded and added textures as an experiment, then realised the performance wasn't as horrible as I expected,
Heh, same!
> so it's mostly just a leftover from that. I did end up writing a scanline renderer for the flat shaded triangles, I think for those the bottleneck was transforming the vertices though.
IME vertex transformation is not expensive at all, compared to actually drawing on screen, at least if there is HW support for multiplication. Optimizations like merging identical block faces next to each other also reduce the total number of vertices, but this makes the texture distortions more apparent.
> Maybe I can deal with z-sorting entities by splitting them on voxel boundaries, and I guess dividing them again at any boundaries within non-full blocks (is this similar to https://en.wikipedia.org/wiki/Binary_space_partitioning?)
Kind of, yeah. With the structure of blocks in a chunk there is basically already a layer of partitioning that can be used, though it might not help sorting that much. Is there enough RAM for a Z buffer? If so, it might just be fast enough...
> For the affine texture splitting, as far as I can tell your game is more focused on creative mode/building whereas I might also want to add a survival mode so for that you're more likely to be up close to the blocks (e.g. in thin underground tunnels) and then the artifacts get much worse so I guess it matters more for me.
I never really bothered with that also because in tunnels/caves there is a bigger issue: There is no hidden surface elimination, which results in overdraw and due to the rather low effective fillrate in FPS drops. I couldn't come up with a good way to implement that properly without hurting performance itself.
The rendering is based on the triangle renderer in https://gitea.planet-casio.com/Lephenixnoir/Azur which renders in fragments to the fast on chip memory so it isn't bottlenecked by the slow main RAM, but I customised it to add textures etc. It's using barycentric coordinates over a bounding box which is probably not as fast as scanline rendering but I can try to make it use scanlines at some point.I'm also using parts of https://codeberg.org/drummyfish/small3dlib. It's using depth sorting which works fine for a simple voxel world like this but if I add things like entities and non-full blocks that might complicate things. Also, to speed things up it uses affine texture mapping (which I think yours uses too?) but splits the triangles when they get close to reduce the distortion. The splitting is causing the seams in the video, I can probably improve it by having sub-pixel precision in the triangle rendering or something