[Solved] Need help on a raycasting light shader

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

Re: [Solved] Need help on a raycasting light shader

Post by Bigfoot71 »

Very interesting! And it's true that I didn't even ask myself the question when in general nothing is displayed immediately by an engine and several images can even be precalculated before display, it is perhaps the simplicity of Löve who made me believe it could be simple (big mistake) ^^.

I still tried to repeat the same procedure by calculating not in love.draw but by calculating love.graphics.present in love.run and I found again the same results for the 3 shaders (~0.002 seconds on average on the same pc) so I finally also think that these are not good techniques.

Personally I would have learned things from this post, thank you once again ! :D

Edit: I take this opportunity to specify in case someone is in the same situation as me and would like to use the last shader proposed by Sasha264, if the position of the object that the mask must cover is not at the origin of the screen (0,0), this time you need to subtract the position of the object from `screen_coords` AND `light_pos` (unlike the old one where `vec2 current_pos = screen_coords - mask_pos` was enough.

i.e.:

Code: Select all

vec2 a = screen_coords - mask_pos;
vec2 b = light_pos - mask_pos;
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 9 guests