Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Normal Mapping Question (Janbo)

Author
Message
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 14th Jun 2019 14:42
Hi Janbo, I've been playing around with your excellent 2D Normal Mapping code from this thread: https://forum.thegamecreators.com/thread/212611 (now locked)

However my shader knowledge/maths aren't good
Attached are a couple of gifs I hope show the problems. I draw a square at the screen co-ords of the light, and a circle for the range.

Two questions:

1. Can you tell me how to 'point' the light straight into the screen, so that its a spot rather than a cone? see light_angle.gif - it looks pointed down and left.
2. When I resize the app window or make it full screen, the normal light moves further away from the xy coords - possibly due to 'uniform vec2 agk_resolution' changing. Is there a way I can compensate for this?

Ultimately I'd like to show the light, as a circle, at the mouse coordinates - regardless of the screen size.
The attached shader should be the same as your original, I don't think I hacked it around too much...


Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 19th Jun 2019 10:43 Edited at: 19th Jun 2019 10:44
Hi,
it should already be a point light.
How does your normal map look like ?
I know this first "effect" normally its when you forget to normalize something or that like.
So are sure my demo work for you ?
Actually I also know the second one and I somehow solved that for me need to take a look at it, but agk_resolution is a good guess
I'm in hospital so...I probably wont visit the forums so frequent than normally.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 19th Jun 2019 14:38
Hi Janbo, I'm sorry to hear that you're back in hospital. Heart conditions are no joke.
I'll pursue the resolution angle The Normal map is just a flat image 127,127,255.

Get well soon friend!

Login to post a reply

Server time is: 2024-11-21 12:28:31
Your offset time is: 2024-11-21 12:28:31