bumpmapping lighting rotation math

0 favourites
  • 3 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
  • Capx:

    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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)