igor725 / VoxelSpaceSDL

Comanche's Voxel Space rendering algorithm written in C using SDL.
MIT License
15 stars 3 forks source link

Distorted geometry facing down. #1

Open clort81 opened 1 year ago

clort81 commented 1 year ago

Thanks for this, much better than my implementation from 2008. One problem with the algorithm is the geometry when facing down. Stretched about 2:1 persp_fwd persp_down Have you any ideas how to render downward facing with less distortion? Cheers igor.

igor725 commented 1 year ago

Huh, that's weird... What os, compiler and video driver you use? Also could you try run it with software rendering mode?

igor725 commented 1 year ago

You need to add the SDL_RENDERER_SOFTWARE flag to the rflags variable in engine.c:99

igor725 commented 1 year ago

Just tested it on Windows 10, latest AMD video driver, SDL 2.0.20 and 2.26.2 (hardware/software acceleration) and I can't reproduce this issue. Honestly, I haven't touched this project for like a year and I have no idea what could cause such artefacts. I would be grateful tho if you track down the issue on your end and send a PR :)

clort81 commented 1 year ago

GridMap.zip Thanks for reply. I added the square lines to a map to illustrate the distortion. The map is C5W.bmp expanded to 4096x4096, with gridlines i added. You can also see the stretching in the y-axis by flying over the square temple in the original default map and looking down. This isn't an error in the backend, but I added the SDL_RENDERER_SOFTWARE flag and confirm I have identical results. INFO: Using software software renderer gcc is gcc-9 Anyway the issue is with the algorithm itself and I'd like to get it making un-stretched views. I'll update if I solve.

igor725 commented 1 year ago

Oh, I misunderstood you, sorry (haven't slept in quite a while). I thought these lines were graphics artifacts. I tried to fix this distortion long time ago but I couldn't.