0

I'm doing a student project and I have a scene with an ambient light and a spotlight. I've imported a Blender model which has the line:

"colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],

in the JSON file.

Is there any way to turn off this property in a MeshPhongMaterial so that it only reacts to the spotlight and not the ambient light.

I've tried removing the line and setting it to zero but this has had no effect. Can I turn this property off? Or should I remove the ambient light from a scene and use a different type such as Directional?

Thanks for any help.

KayM
  • 318
  • 1
  • 2
  • 12
  • You can do this: `material.ambient.set( 0x000000 )`. (but in practice, ambient reflectance should usually match the material `color`.) You can also do this: `ambientLight.color.set( 0x000000 );` It sounds like something else is going on... – WestLangley Jun 24 '14 at 16:24
  • Thank you, you've solved my problem! I didn't want to load in a material from Blender just the geometry. But then once I loaded the geometry and set a colour in the loader function I think it had the default grey Blender setting for the ambient property. I've set the colour using your material.ambient.set to the same colour I've chosen for the model. It works perfectly. – KayM Jun 24 '14 at 19:20

1 Answers1

0

In practice, the ambient reflectance of the material should usually match the material color, also known as the diffuse reflectance. Doing so will likely make your model look better.

For example, you can do this

material.ambient.copy( material.color );

or

material.ambient.set( 0xff0000 );

three.js r.67

WestLangley
  • 102,557
  • 10
  • 276
  • 276