2 ms·
It's actually closer to the Wolfenstein rendering engine than one might expect... Like the original, it does a ray-march in the ground plane to find map object
by jcl 9y ago
It's actually closer to the Wolfenstein rendering engine than one might expect... Like the original, it does a ray-march in the ground plane to find map objects:
https://github.com/id-Software/wolf3d/blob/0516778/WOLFSRC/WL_DR_A.ASM#L414 https://github.com/id-Software/wolf3d/blob/0516778/WOLFSRC/W...
And, like the original, it separates the cases of wall blocks, door blocks, and sprites. It also expedites ceiling/floor drawing by just picking a flat color for the top and bottom halves of the screen:
https://github.com/id-Software/wolf3d/blob/0516778/WOLFSRC/WL_DRAW.C#L946 https://github.com/id-Software/wolf3d/blob/0516778/WOLFSRC/W...
But it naturally differs from the original in that it is rendering per-pixel rather than per-column, so it does not need to accumulate a list of sprite intersections to draw in reverse order over the walls -- it can just stop raymarching when it encounters an opaque pixel:
https://github.com/id-Software/wolf3d/blob/0516778/WOLFSRC/WL_DRAW.C#L1157 https://github.com/id-Software/wolf3d/blob/0516778/WOLFSRC/W...
In a sense, the shader works like rewriting and optimizing the original renderer so that it renders to a screen of a single pixel, then running 147,456 instances of the renderer to fill the 512x288 pixel screen.