Jump to content

parallax mapping, directional light bug


Recommended Posts

Lighting of parallax mapped object seems to be inverted when using directional light.

playground:  http://playground.babylonjs.com/#1SGTPA#5
 

The scene contains paralax mapped rectagle and few spheres,  the only light on the scene is directional light with the direction equal to (0,-1,0)
The mirror is not so important here.

When looking from the side of spheres,  light on the plane goes from down,    on spheres it goes from the top
but when we rotate the camera and look on the back face of plane,  suddenly light there goes from the top

same example, but light direction changed to (1,-1,0):
http://playground.babylonjs.com/#1SGTPA#6
 

 

paralax_dirlight2.jpg

paralax_dirlight1.jpg

Link to post
Share on other sites
On 1/4/2017 at 12:30 PM, Sebavan said:

I guess your normal map is using a different convention. You can add videoMat.invertNormalMapY = true; to fix it

http://playground.babylonjs.com/#1SGTPA#12

Thanks, it solves issue for now,  I need to do more test on project i am working on, to see if it works with more complicated scene.
That texture and normal map are exactly same files as in the official babylon tutorial on parallax mapping topic :),  so i assumed those files to be the most ok as possible.

https://doc.babylonjs.com/tutorials/Using_parallax_mapping

So maybe file in tutorial is wrong?
It still doesn't explain inconsistency of front vs back face lighting, but it is not as big problem in my case. 
But in case of switched backface culling  CW vs CCW,  or even worse when mixing CW and CCW faces while disabling backface culling, it may be an issue.

 

Link to post
Share on other sites
11 hours ago, ceedee said:

https://doc.babylonjs.com/tutorials/Using_parallax_mapping

So maybe file in tutorial is wrong?
 

What could be wrong in the tutorial? I didn't fully understand, sorry.

If I remember correctly NormalMapping in BJS use a "special" convention by default, the tutorial about Bump Mapping should be up to date and mention it. (If I also remember correctly @Sebavan updated a while ago).

Link to post
Share on other sites
  • 1 month later...
On 1/5/2017 at 2:41 AM, Nockawa said:

What could be wrong in the tutorial? I didn't fully understand, sorry.

Sorry for so late answer, i was too busy in last weeks :(

So i have made another test to be sure. I have taken the playground from paralax tutorial, and changed it a bit, but textures and scene is basicly same.
http://playground.babylonjs.com/#10I31V#93
It is one light moving around cube, in the initial camera position you see front side of cube and hoghlights seem to be rotating in wrong direction.
as Sebavan said adding material.invertNormalMapY = true  solves the problem and higlight rorate in proper direction.

So, the conclusion is:
-Texture file with normal/height map in tutorial playground should be reedited with inverted changed Y part of normals.

OR

- material.invertNormalMapY = true  should be added to playground of paralax tutorial

But as i said earlier it is not a big deal ( not real bug or something),

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...