ceedee Posted January 3, 2017 Share Posted January 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 4, 2017 Share Posted January 4, 2017 Ping @Nockawa Quote Link to comment Share on other sites More sharing options...
Sebavan Posted January 4, 2017 Share Posted January 4, 2017 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 Quote Link to comment Share on other sites More sharing options...
ceedee Posted January 4, 2017 Author Share Posted January 4, 2017 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. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 5, 2017 Share Posted January 5, 2017 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). Quote Link to comment Share on other sites More sharing options...
ceedee Posted February 5, 2017 Author Share Posted February 5, 2017 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), Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.