bumpmapping lighting rotation math

Bugs will be moved here once resolved.

Post » Wed Mar 20, 2013 8:18 pm

Capx:
https://dl.dropbox.com/u/88228205/NormalMapTest.capx

Steps to reproduce:
1. Move the mouse over the sprites to see the lighting effect slowly follow the mouse across it's surface. I've adjusted the events so the behave the same.
2. See events. I've added comments in the capx to further explain and point out what I'm seeing.

Observed result:
Both squares are the same other than the first one has the rotate behavior. In order for the lighting effect to behave the same I needed to modify the math to get the Y parameter under bumpmapping.

It seems like the math to adjust for the rotating sprite is off.

I also noticed that with the exact same Z and Intensity parameters the lighting is vastly different.

Expected result:
I expected to just copy and paste the small equation and get the same result: A reflection effect that slowly followed the mouse's movement.

Browsers affected:
Chrome: yes
Firefox: untested
Internet Explorer: untested

Operating system & service pack:
Windows 7 sp1

Construct 2 version:
r122 & r123
    whatever232013-03-20 20:19:12
B
45
S
13
G
7
Posts: 34
Reputation: 5,919

Post » Fri Mar 22, 2013 4:14 pm

The bumpmapping light positions are in texture co-ordinates (0 for the left edge of the image to 1 on the right, and Y also goes 0 to 1 top to bottom). For convenience C2 multiplies these by 100 so it goes from 0 to 100 instead of 0 to 1. Your event calculations don't seem to take this in to account, so closing.Ashley2013-03-22 16:15:18
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Sat Mar 23, 2013 4:40 pm

I think you've misunderstood what I'm trying to show. I understand that the the X and Y coordinates on the bumpmap plugin expect a 0-100 value. Anything outside of that range shows no light. That was my intention with what I did.

I changed my formulas back to match each other. Now, if you mouse over the two sprites you will see that the X coordinate remains the same but the Y coordinate is inverted when the Rotate behavior is added to the sprite.

Even if I clamped the values from 0-100 the light reflection would still be incorrect.
B
45
S
13
G
7
Posts: 34
Reputation: 5,919


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest