1992年,德军总部
同年,OpenGL 1.0 发布
RayCasting 3D 渲染

高度 = 缩放因子/距离

锁不锁帧?


渲染过程






状态栏的精灵图

RayCasting的优化

*souce:https://www.youtube.com/watch?v=nMAgogUyv3E*

如何绘制呢?

RayMarching,成本有点高
优化1:所有元素都跟网格对其
In a world with some constraints the problem becomes much simpler. If a map is made of aligned square blocks evenly distributed across a grid, a solution yielding 100% accuracy and low runtime overhead is to check for ’hits‘ only when a ray crosses the grid. This was the choice made for Wolfenstein 3D, and explains why the game can only draw perpendicular walls of 8 feet by 8 feet by 8 feet.

优化2:既然都是网格,可以根据轴与光线第一个交点来预测行进路径


Sin/Cos 也要做个表提升性能
I’m no super mathematician– I learned high school math well enough to solve real world problems with it. John Carmack - Programmer
嗯嗯嗯。。。。。。
防鱼眼
高度计算公式


公式类似这个
难道不应该是这个公式吗?



这会导致鱼眼。。。。

解决办法:



差别对比
80386 机能下,渲染 Column 的优化
- 硬编码的材质缩放函数,减少 CPU 指令开销

2.延迟渲染
cheat1(玩赖

相似的直接不计算了



墙壁材质 Lit + Unlit 制作光感


门与 RayCaster


80386 机能下,渲染 Sprite 的优化
1.缩放器(如上)考虑透明度问题

2.延迟渲染(同上)

Buy a 486 :)

命运之矛的防拷贝保护
Joshua 是防拷贝保护的后门

会触发一个致敬 1984 电影 WarGames 的彩蛋
