#how can i add the colors in a gltf model with multiple meshes

7 messages · Page 1 of 1 (latest)

wanton vessel
#

when i add my model its all black and i have no idea how to export colors from the meshes

cerulean gulch
#

you need to add Directional Light to the seen first!

wanton vessel
cerulean gulch
#

Open console an check if you have errors there!

wanton vessel
willow hemlock
#

you can just add it like so

#

`export const Toilet = (
props: BlueprintElement<BlueprintModelConfiguration> & BlueprintObjectProps
) => {
// @ts-ignore
const { nodes, materials } = useGLTF(
path('/assets/models/toilet.glb')
) as GLTFResult;
const highlight = props.selected || props.active;

return (
<group
name={props.id}
position={props.position}
rotation={[0.0, props.rotation, 0.0]}
scale={props.scale}
dispose={null}
>
<Suspense fallback={null}>
<mesh geometry={nodes.Object_3.geometry} rotation={[0.0, 0.0, 0.0]}>
// Add color
<meshBasicMaterial color="#00ff00" />
<Edges
scale={1.0}
threshold={15}
color={highlight ? '#0000ff' : '#000000'}
/>
{props.children}
</mesh>
</Suspense>
</group>
);
};

useGLTF.preload(path('/assets/models/toilet.glb'));`