演示:
https://dl.dropboxusercontent.com/u/123374/so-pages/20160601/index.html
alphaTexture
在每次渲染期间都会更改其偏移量。作为“map”属性,它会改变,但作为“alphaMap”,它不会改变。第二个网格的 alphaMap
演示链接中的相关代码:
var colorTexture = new THREE.TextureLoader().load('blue.png')
, alphaTexture = new THREE.TextureLoader().load('alpha.png')
, offset = 0
, colorFill = new THREE.Mesh(
new THREE.Geometry(),
new THREE.MeshPhongMaterial({
map: colorTexture,
alphaMap: alphaTexture,
side: THREE.DoubleSide,
shading: THREE.FlatShading
})
)
function render() {
requestAnimationFrame(render)
offset += .01
alphaTexture.offset.x = Math.sin(offset)
renderer.render(scene, camera)
}
render()
预期:
对象的透明部分会随着 alphaTexture 偏移量的变化而移动。
实际:
透明部分固定在 Material 上。但是,如果我编辑设置为 map
属性(而不是 alphaMap
)的纹理偏移量,它 * 能够移动,这对我来说似乎是不一致的行为。
最佳答案
您所看到的是 Three.js 的当前“功能”:每个网格仅允许一对 offset/repeat
。 mesh.map
具有优先权。
有关详细信息,请参阅 https://stackoverflow.com/a/14372235/1461008
将来可能会对此进行更改,以允许每个纹理或每个 Material 属性单独的偏移/重复
设置。
三.js r.84
关于javascript - 无法更改用作 alphaMap 的纹理的偏移/重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37579923/