Animating Canvas Billboard in THREE.js

前端 未结 2 1979
天命终不由人
天命终不由人 2021-01-04 22:47

Everyone,

I\'m trying to animate a Canvas-based texture that is mapped onto a plane, like a billboard. I\'ve made a point of including material.needsUpdate

相关标签:
2条回答
  • 2021-01-04 23:36

    The needsUpdate flag is reset (to false) every time the texture is used (every render loop), so it needs to be set to true in the render loop (before the render call, or it'll be a frame off). So in your example, put sign.material.map.needsUpdate = true before renderer.render( scene, camera ). texture.needsUpdate = true and material.needsUpdate = true are not needed.

    Also, you only need to set the needsUpdate flag on the texture, as the material properties are not changing.

    0 讨论(0)
  • 2021-01-04 23:43

    Place this right before your render() call:

    sign.material.map.needsUpdate = true;
    

    Fiddle: http://jsfiddle.net/pPKVa/

    0 讨论(0)
提交回复
热议问题