How To

How do I make walls straight in my ray casting program?


Hey, I did a thing. 2020-09-08 08:42

Lately I’ve been testing around with the ray casting concept. I made a very basic program which draws a 3D image of a 2D map from the perspective of a camera. (which is what ray casting basically is)
But, when the camera is next to a wall looking parallel to that wall the wall next to the camera looks curved instead if straight. A while back I remember watching a video about this problem but I couldn’t find the video and I don’t remember what the fix for it was. And I also don’t understand most of the other peoples ray casting programs because they more advanced techniques that I don’t yet understand.

Ray Casting Demo.nx | Open in app
2020-09-08 08:42

was8bit 2020-09-08 09:49 (Edited)

Raytracing 3d math is abit fuzzy for me... hopefully others can help :)

(I simulate it via restricting movment, i have an example posted)

Timo 2020-09-08 11:43

I used this tutorial:

It handles the fish eye perspective issue correctly.

Timo 2020-09-08 16:35

By the way, nice idea to use sprites!

Hey, I did a thing. 2020-09-09 12:03


Log in to reply.