5 ms·
[Edit] ah ok they clarify later as a performance enhancement. I think it was pretty integral to the algorithm, but ok. Wait why do they say painter's algorithm
by Jare 4mo ago
[Edit] ah ok they clarify later as a performance enhancement. I think it was pretty integral to the algorithm, but ok.
Wait why do they say painter's algorithm. Comanche and other such voxel terrain engines went front to back and never had overdraw.
- swiftcoder 4mo agoReverse painters algorithm is still painters algorithm. You trade off the cost of a full screen clear before the frame, in return for eliminating overdraw
- knome 4mo agoYou could avoid a full screen clear by using the y-buffer to draw in sky segments after rendering terrain.
- swiftcoder 4mo agoYou still need to have some sort of mask to tell you which pixels have not yet been written this frame
- knome 4mo agothat's what the y-buffer is that the article mentions in the front-to-back rendering section. it tracks how tall each columns write is so you can use it to only write the diff between it and the voxel behind it, skipping writing anything at all if the voxel behind is shorter than the current height. So once you're done rendering front-to-back, you've got a y-buffer of highest-writes you can slap your blue sky across from highest-to-screentop on each line, avoiding the need to clear by write the sky to the full screen before starting the render.
- swiftcoder 4mo agoyes, I guess you can get away with only clearing the y buffer, rather than the whole screen
- s-macke 4mo agoAuthor here. Yes, it is integral. I chose this approach to first show how to draw it from back to front, because the code is easier to understand this way.
- Lerc 4mo agoI think it's worth noting that you can tilt with this method, but not roll. Great for a helicopter game, Less so for general flight sim. That was a large part of how games were designed back in the day. Start with what you have the ability to do, find the game that matches what you can do.
- nnevatie 4mo agoNotice the demo video from Comanche also shows roll. Edit: To support roll, the renderer essentially rendered the voxel terrain into a frame buffer and then applied camera transformations that gave the appearance of a fully rotating viewpoint. The terrain itself was not being raycast through a true 3D voxel volume.