JonathanRev Posted October 31, 2017 Share Posted October 31, 2017 Hello guys ! i was working with groundmaterial several weeks already , but i recently noticed that "DirectionalLight" is not a good friend of "WORLDMONGER.GroundMaterial" i hope i am wrong , but i was experimenting with endless landscapes and i noticed that when i go far from the point 0 , 0 , 0 of my scene the diarectionallight doesn't iluminate with the same intensity when i go far away from point 0 , 0, 0 when i use the GroundMaterial i set the directional light this way : var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, 0), scene); light.intensity = 1.0; and i am using the groundmaterial as : var groundMaterial = new WORLDMONGER.GroundMaterial("groundMaterials", scene, scene.getLightByName("dir01"); ----------------------------------------------------------------------------------------------------------------- Now when i use a the StandardMaterial : var groundMaterial = new BABYLON.StandardMaterial("ground0", scene); groundMaterial.diffuseTexture = new BABYLON.Texture("shaders/Ground/grass.png", scene); and i move far from the point 0, 0, 0 it works perfect and iluminates with the same intensity for example if i were some kilometers far away from the point 0,0 as it would be on the point 0,0 is this really something related to groundmaterial? , or i should use some trick to have kilometers of my scene with the same intensity in light using directionallight and groundmaterial? i have already tried using the scene.registerBeforeRender(function() to have the directionallight follow the camera but i don't think it is a good solution , i guess the DirectionalLight should iluminate the same ortogonal way even if i am far away from the initial location point of the directionallight. Quote Link to comment Share on other sites More sharing options...
JonathanRev Posted October 31, 2017 Author Share Posted October 31, 2017 you can see what i explained on this two images Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 31, 2017 Share Posted October 31, 2017 Hey! the ground material assumes that you are using a point light: https://github.com/BabylonJS/Website/blob/master/Scenes/WorldMonger/Shaders/Ground/ground.fragment.fx#L6 JonathanRev 1 Quote Link to comment Share on other sites More sharing options...
JonathanRev Posted October 31, 2017 Author Share Posted October 31, 2017 wow ! totally right , i guess i fixed it this way , i replaced : // Light vec3 lightVectorW = normalize(vLightPosition - vPositionW); by this : // Light vec3 lightVectorW = normalize(vLightPosition); Not sure if this will have any effect in another part of the game, but now it iluminated perfect in all directions ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 1, 2017 Share Posted November 1, 2017 Happy users make me happy 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.