Is there any material that supports lighting that I could use with setColorAt in InstancedMesh

Is there any material that supports lighting that I could use with setColorAt in InstancedMesh?

I need to change the color of the selected instanced mesh objects

doesn’t every material support vertex colors? you can for sure use meshstandardmaterial et al.

Thanks, I have a working project that changes color perfectly when using MeshBasicMaterial, when I simply change to MeshStandardMaterial, all the objects are black.

because you need lights. add at least an ambientlight, or a pointlight.

You’ll certainly need lights as @drcmda says. With MeshStandardMaterial you’ll need more than an ambient light if it’s metallic. Set metalness = 0 if you don’t need it. If you do need metalness, or just wanted higher-quality lighting, use an environment map.

Also note that setColorAt multiplies against any existing color on the material. If you’re going to set the color of each instance you’ll probably want to use white (#FFFFFF) as the base material color, so the instance colors are shown unchanged. This is similar to setting vertex colors on a non-instanced mesh.

1 Like