pichou Posted November 18, 2017 Share Posted November 18, 2017 Hey Guys I have an issue with gradientMaterial. Here is a basic playground where everything is fine : https://www.babylonjs-playground.com/#2IFRKC#8 If I use a DirectionalLight instead of HemisphericLight, the material become much darker and the gradient is already almost not visible : https://www.babylonjs-playground.com/#2IFRKC#9 And if I change the sphere for a plane or a cylinder, the gradientMaterial become only dark : https://www.babylonjs-playground.com/#2IFRKC#10 Does this mean we can't use gradientMaterial with directionalLight? Thanks Pichou Quote Link to comment Share on other sites More sharing options...
jerome Posted November 19, 2017 Share Posted November 19, 2017 When you remove the hemispheric light ground color (the light coming from the sky "reflected" by the ground), your object is also darker, what is normal : https://www.babylonjs-playground.com/#2IFRKC#11 Now, let's give some z-value to your directionalLight : https://www.babylonjs-playground.com/#2IFRKC#12 and the object is lighter So everything depends on where you put the lights knowing they all behave differently. You could also use a point light always set at the camera position : https://www.babylonjs-playground.com/#2IFRKC#13 Quote Link to comment Share on other sites More sharing options...
pichou Posted November 20, 2017 Author Share Posted November 20, 2017 OK thanks @jerome for this explanation. This is just a matter of shadow and light direction/position then. For your information in my scene I just add an hemispheric light that is opposite to my directionalLight so that the right color appears on the gradientMaterial I use. Cheers, Pichou 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.