Textured Raycast Trial

Publicado 2023-06-12


This is a first attempt to render textured height maps in something close to real time. I guess these would be considered voxels?

I am casting rays from the screen and checking intersect with the floor plane to get an x,z coordinate. Then I load a pixel from the map for the color and a pixel from the map at an offset location to get a height value.

A neat feature is that shadows could be baked into the texture.

Code is ugly, buggy, and poorly optimized...

Issues:
--In order to keep the frame rate up while moving, I had to double pixel size.
--Looking up a pixel on the map is very slow, but I want to be able to handle 512x512 height maps and this is the best way I can think of. (512x512 color map and 512x512 height map)
--tall vertical walls jump in and out of existence, especially when at a distance. Actually, this happens with all pixels. Rounding errors perhaps?

I'm going to look at Zep's Raycast demo and see if there is anything in there that I can borrow.

-ElectricGryphon