[SOLVED] light_world.lua incorrect lighting direction

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.
0x29a
Prole
Posts: 27
Joined: Sun Jul 06, 2014 10:22 pm

Re: light_world.lua incorrect lighting direction

Post by 0x29a » Thu Oct 27, 2016 8:48 pm

I'll try it tomorrow again and I'll report back if that was the case

User avatar
pgimeno
Party member
Posts: 1978
Joined: Sun Oct 18, 2015 2:58 pm

Re: light_world.lua incorrect lighting direction

Post by pgimeno » Thu Oct 27, 2016 8:52 pm

0x29a wrote:Do you happen to know how to do it? I'd be forever in your debt.
Just use your default window resolution to do this:

Code: Select all

vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords) {
  pixel_coords.y = 600.0 - pixel_coords.y;    // <-- Insert this, changing 600.0 to your default height
  float dist = ...
(Edited to make it 600.0 instead of 799.0)
Last edited by pgimeno on Thu Oct 27, 2016 9:01 pm, edited 1 time in total.

0x29a
Prole
Posts: 27
Joined: Sun Jul 06, 2014 10:22 pm

Re: light_world.lua incorrect lighting direction

Post by 0x29a » Thu Oct 27, 2016 8:55 pm

Hi,
actually I tried it out right now. As it turns out, Slime was right!

Code: Select all

 vec3 normal = normalize(vec3(normalColor.r,invert_normal ? 1 - normalColor.g :  normalColor.g, normalColor.b) * 2.0 - 1.0);

swapped with

Code: Select all

 vec3 normal = normalize(vec3(normalColor.r,invert_normal ? normalColor.g :  1 - normalColor.g, normalColor.b) * 2.0 - 1.0);
gets the job done!

Thank you both for your enormous help!

Have a good one

Post Reply

Who is online

Users browsing this forum: No registered users and 192 guests