3DStreet / 3dstreet

🚲🚢🚌 Web-based 3D visualization of streets using A-Frame
https://3dstreet.app
Other
251 stars 33 forks source link

different colors for vehicles #166

Open burritojustice opened 2 years ago

burritojustice commented 2 years ago

I apologize in advance for my ignorance about how 3D models work, but it would be nice if we had a way to change the color of a vehicle other than the default grey.

Could a random color be selected when the 3Dstreet view is loaded? Could a car color be selected in the editor?

Car colors are shockingly boring these days: https://blog.consumerguide.com/boring-car-colors/

but maybe we could select from

kfarr commented 2 years ago

example glitch code that changes a material inside gltf https://glitch.com/edit/#!/grateful-sweltering-meter

kfarr commented 5 months ago

@gnansai in addition to the removing rigging experiment, we would also like to be able to change vehicle colors dynamically.

Therefore, would it make sense to consider alternate coloring mechanism for vehicles instead of UV map? Such as vertex coloring or defining colors through material.

A good example to refer to is https://github.com/diarmidmackenzie/instanced-mesh/tree/main/examples/gltf-models note the gltf file whose color is modified in the various instances via the component

Another question may be how do we target a part of the gltf with code that is consistent for all vehicles? Which part is "colorable" and which parts have default colors that cannot be modified such as lights, wheels, interior, glass, etc.?

gnansai commented 5 months ago

@kfarr I checked the example "https://github.com/diarmidmackenzie/instanced-mesh/tree/main/examples/gltf-models". The above example randomizes the first material colors of the car model. image image

If I reorder the material in blender and put the window material at first, The code randomized the window color. image image

gnansai commented 5 months ago

I tried with our Isuzu truck model. I selected the few parts of the vehicle and assigned a new material "car-body". The example code randomizes the colors of "car-body" material. image image

The Solution would be We can use a different material for vehicle parts that allow for color changes and modify the color of the material in code.

Algorush commented 3 months ago

@gnansai, @kfarr, we can simply give a special name to the mesh that needs to be assigned a vertexColor or a material with a specific color. For example, for such a mesh, use the name "car-body". And I will be able to query this mesh by name via Three.js/Aframe

gnansai commented 3 months ago

Hi @Algorush @kfarr Here is a isuzu-truck model if you want to test. I have added a separate material "vehicle-body". You can change color of that material to change the color of the vehicle body.

Isuzu-truck-color-change-test-v01.zip image