使用三个js更改合并网格上的材质颜色 [英] Changing material color on a merged mesh with three js

查看:123
本文介绍了使用三个js更改合并网格上的材质颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

合并多个网格以更改所选单个网格上的颜色时,是否可以与使用的缓冲区进行交互?

Is that possible to interact with the buffer used when merging multiple mesh for changing color on the selected individual mesh ?

使用网格物体集合很容易做到这一点,但是具有多种不同材质的合并网格物体又如何呢?

It's easy to do such thing with a collection of mesh but what about a merged mesh with multiple different material ?

推荐答案

取决于您改变颜色"的含义.请注意,合并后,该网格与其他任何未合并的网格一样.

Depends on what you mean with "changing colors". Note that after merging, the mesh is like any other non-merged mesh.

如果您指的是顶点颜色,则可能要遍历面并根据材质索引确定要更改颜色的顶点.

If you mean vertex colors, it would be possibly to iterate over the faces and determine the vertices which color to change based on the material index.

如果您要为材料本身设置颜色,请确保可行.合并的网格仍然可以像普通网格一样具有多种材料-在MeshFaceMaterial中,尽管如果要进行合并,则需要为每个几何体传递材料索引偏移参数.

If you mean setting a color to the material itself, sure it's possible. Merged meshes can still have multiple materials the same way ordinary meshes do - in MeshFaceMaterial, though if you are merging yourself, you need to pass in a material index offset parameter for each geometry.

这篇关于使用三个js更改合并网格上的材质颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆