5 ms·
I'd kill for a dozen comments, esp. if a goal is to educate students. 498 lines would still be impressive.
by Tempest1981 8y ago
I'd kill for a dozen comments, esp. if a goal is to educate students. 498 lines would still be impressive.
- deleted 8y ago[deleted]
- robterrell 8y agoIt's a neat trick of projection, and really easy to hack on and extend yourself once you know the trick. Using your map of the space, cast a ray from the camera position through every column of the display rectangle; using the distance the ray travelled before intersecting the wall, you can calculate the apparent height of the wall seen in that column of the display; so, in that column, draw the wall that high. You can get fancier with textures for the walls, varying the floor height, walls that can appear and disappear (i.e. "doors"), and so on. Better than my 10-second explanation: https://lodev.org/cgtutor/raycasting.html https://lodev.org/cgtutor/raycasting.html
- AnIdiotOnTheNet 8y agoNote that the site has several more entries with extensions to that base raycaster, which you can find in the index. Interesting note about this technique: you get perspective correct texturing for free. "Real" 3D rendering usually had to cope with affine texturing due to performance costs until dedicated hardware for it came along.
- rasz 8y agolike this? https://github.com/ssloy/tinyraycaster/wiki https://github.com/ssloy/tinyraycaster/wiki table of contents is in upper right
- Tempest1981 8y agoNice!
- Tempest1981 8y agoI see the link to the wiki now in the README.md. The first time, I think the doom graphics distracted me, along with the "cat | wc" metrics. Thanks for the pointer.