在以下 Material 中:
var mat = new THREE.MeshLambertMaterial({'color': ..., 'map': ...});
在将颜色设置为 map 的平均像素值与将颜色设置为白色与将其设置为黑色的情况下,颜色如何影响渲染结果。
文档说,如果为 Material 设置了.map
,则 Material 的颜色会“调制”漫反射贴图。这里的调制究竟意味着什么?
最佳答案
这可以在 standard three.js shaders 的源代码中找到。在 meshlambert_frag.glsl有行 #include <map_fragment>
和#include <color_fragment>
。这些ShaderChunk include 在 webgl 程序编译时进行处理。
在 map_fragment.glsl和 color_fragment.glsl我可以看到,diffuseColor
乘以color
应用 map 颜色后。
此外,浏览器的着色器编辑器扩展可用于查找在 webgl 中运行的着色器的源代码。
关于javascript - Three.js 中 Material 的漫反射贴图和颜色之间的相关性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40419642/