Coloring the room

How to color the room top side into BABYLON.Color3()

This is my playground demo: https://playground.babylonjs.com/#9A47DB#1

As i understood from custom mesh building, I need to get correct vertices and give them the color, but i cannot understand how it works:(

This is the full buildFromPlan.

When you do this you can set options for the interior and exterior UVs and colors. Top and bottom and sides of the wall always take the exterior UVs and color.

In this PG https://playground.babylonjs.com/#4GBWI5#265

The code for this is on lines 75 - 79, 238, 582

More info on custom mesh and colors

You also need to know about vertex normals and flat shaded mesh

Thank you for your answer. But, for example. In case if i need to texture each wall by individual material. How can i implement this?

In which case you would need to change interiorColor and exteriorColor options from a single value to an array of values interiorColors and exteriorColors.

https://playground.babylonjs.com/#4GBWI5#1666

Of course this meant changes within the buildFromPlan code.

1 Like

You can take a look on the technique of UV mapping :grinning_face_with_smiling_eyes:
What is UV Mapping & Unwrapping? (conceptartempire.com)
Map Materials to Individual Mesh Faces | Babylon.js Documentation (babylonjs.com)

2 Likes