Page 2 of 2
Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly
Posted: Thu Mar 30, 2023 9:33 am
by NoreoAlles
marclurr wrote: ↑Thu Mar 30, 2023 6:10 am
I've actually gone down this exact rabbit hole fairly recently, I'd started with a fully software rendered version and while I'd managed to optimise it to a reasonable level I wanted to try and make it even faster. The shader version can render at 4k resolution with virtually no performance impact. This topic documents how I did it, the github is on there too if you want some inspiration. There's probably ways to improve it even more
viewtopic.php?f=5&t=93880
hahah, watching
this video by you made me want to try and create one in the first place!
Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly
Posted: Thu Mar 30, 2023 11:38 am
by Bigfoot71
marclurr wrote: ↑Thu Mar 30, 2023 6:10 am
I've actually gone down this exact rabbit hole fairly recently, I'd started with a fully software rendered version and while I'd managed to optimise it to a reasonable level I wanted to try and make it even faster. The shader version can render at 4k resolution with virtually no performance impact. This topic documents how I did it, the github is on there too if you want some inspiration. There's probably ways to improve it even more
viewtopic.php?f=5&t=93880
If anybody is interested in the fully software version I can probably dig it out, but it's likely not much different from the many raycasters already posted on the forum.
Ah yes I remember your post, bravo and thank you for your repost, it will be really useful
Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly
Posted: Fri Mar 31, 2023 9:35 pm
by Bigfoot71
The shader is done and the software rendering has been improved a bit! For the shader I was a little inspired by how Marclurr had done. It's still a bit messy, there are a lot of points to improve and also things to add, I might do a separate topic if I really go further than that.
If you want to be inspired or even copied it's free
I didn't add the ceiling although that's easy to do now that the floor is done, but for the simple reason that I thought it was cool to be able to deifne several diferent floors with negative values in the map array, then I what do i do for the ceiling? So I preferred to do nothing for now, but some slight shader changes will suffice.
You have the straff with Q/E or A/E and you can also switch maps with M. The window is also resizable live. You just have to set the second parameter of the raycaster:init method in main.lua to false to try without hardware acceleration. You can remove and put the textures you want, it simply won't display them if they aren't there.
Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly
Posted: Sat Apr 01, 2023 7:37 am
by marclurr
Well done, looking very cool! And glad I was able to point you in the right direction
I'm quite jealous of your single draw call implementation, I originally thought of doing the mine the same however I decided against it as I didn't want so many branching statements in a shader, but it looks to have zero impact on performance and is much neater. Running side-by-side on my laptop both yours and mine have more or less the exact same render time of <1ms.
You've actually reignited my interest in the topic, I'm planning to implement batching for the sprite rendering as they currently require one draw call per sprite.
Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly
Posted: Sun Apr 02, 2023 12:02 am
by Bigfoot71
Glad to hear it, it was one of the things that I told myself that it was absolutely necessary to change (the number of conditions in the shader) but if it works as well so much the better!
I still optimized it and added the ceiling as well as the management of several floor/ceiling textures, I can't stop
I made a small repo on GitHub if you are interested:
https://github.com/Bigfoot71/love2d-raycasting