[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 »

I'll try it tomorrow again and I'll report back if that was the case
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: light_world.lua incorrect lighting direction

Post by pgimeno »

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 »

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: Bing [Bot], Google [Bot] and 31 guests