Three.js - 将纹理绑定到粒子
我的问题是如何将纹理绑定到粒子 使用 THREE.ParticleCanvasMaterial ?
我的意思是,将纹理绑定到粒子的语法是什么?
My question is how can I bind texture to a particle in
use of THREE.ParticleCanvasMaterial ?
I mean what is the syntax to bind texture to particle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该尝试使用
ParticleBasicMaterial
并传入Texture
作为材质的贴图属性:另外,请查看 canvas_article_sprites 示例。请注意,它正在动态生成纹理,但您可以如上所述加载自己的纹理。根据经验,CanvasRenderer 在处理许多/大纹理时速度很慢。
You should try to use a
ParticleBasicMaterial
and pass in yourTexture
as the map property of the material:Also, have a look at the canvas_particle_sprites example. Notice that it's generating a texture on the fly, but you can load your own texture as described above. From experience, the CanvasRenderer is slow with many/large textures.
2019 更新:ParticleBasicMaterial 已弃用
https://thirdjs.org/docs/#api/en/deprecated/DeprecatedList< /a>
您需要使用 PointsMaterial 而不是 ParticleBasicMaterial
或者,您可以使用画布绘制粒子纹理的圆形形状,如 George 的建议:
测试图像
结果
Update 2019: ParticleBasicMaterial is deprecated
https://threejs.org/docs/#api/en/deprecated/DeprecatedList
You need to use PointsMaterial instead of ParticleBasicMaterial
Alternatively you can use canvas to draw Circular shapes for particle texture as suggest by George:
Test Image
Result