How to override the shader color

Hello Three Js Team,

I have an study table geometry with which i am creating multiple instances using instance buffer geometry. I wrote an shader so that i can give multiple colors to my table according to different modes.

Here i used buffer geometry utils and merge the table base with its four legs.

Due to this i am only able to give the uniform color like red color so it is applying to entire table.

How is it possible to give the different colors to table legs.

I tried to user the color attribute in buffer geometry but it does not work due to shaders.

Any help on this

If it’s a custom shader you created, the only way to make it support multiple colors (or anything, for that matter) is to code it.

Shaders can do only what you tell them to - so if you pass a color attribute, you must then handle that attribute in the fragment shader :sweat_smile:

1 Like