3 ms·
The title is misleading - the shader does not implement the original Wolfenstein rendering engine, it's an experiment in generating textures inside the code.
by nukeop 9y ago
The title is misleading - the shader does not implement the original Wolfenstein rendering engine, it's an experiment in generating textures inside the code.
- jcl 9y agoIt'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.