Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
NoreoAlles
Party member
Posts: 107
Joined: Mon Jan 03, 2022 5:42 pm

Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly

Post 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! :rofl:
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly

Post 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 ^^
My avatar code for the curious :D V1, V2, V3.
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly

Post 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.

Image
Attachments
Raycasting.love
(35.04 KiB) Downloaded 38 times
My avatar code for the curious :D V1, V2, V3.
User avatar
marclurr
Citizen
Posts: 98
Joined: Fri Apr 22, 2022 9:25 am

Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly

Post 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.
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Implementation/port of Lode Vandevenne´s Raycaster behaving weirdly

Post 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 :death:

I made a small repo on GitHub if you are interested: https://github.com/Bigfoot71/love2d-raycasting
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests