Three.js:如何在缩放时保持sprite文本大小不变 [英] Three.js: how to keep sprite text size unchanged when zooming

查看:7905
本文介绍了Three.js:如何在缩放时保持sprite文本大小不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  var texture = new THREE.Texture(canvas); 
var material = new THREE.SpriteMaterial({map:texture,transparent:false});
var sprite = new THREE.Sprite(material);

当鼠标放大时,文字大小如何变化?

解决方案

新的行为是精灵根据他们与透视相机的距离缩放 - 就像其他对象一样。



如果你不想让它们缩放,你可以重叠第二个sprites场景,用正交相机渲染。请参见 http://threejs.org/examples/webgl_sprites.html



它被称为平视显示器或HUD。



three.js r.63


In three.js, when the mouse is zoomed, the text will be magnified and reduced accordingly.

var texture = new THREE.Texture( canvas );
var material = new THREE.SpriteMaterial ( { map: texture, transparent:false } );
var sprite = new THREE.Sprite( material );

How do you keep the text size from changing when the mouse is zoomed?

解决方案

The new behavior is for sprites to scale according to their distance from the perspective camera -- just like other objects do.

If you do not want them to scale, you can overlay a second scene of sprites, rendered with an orthographic camera. See http://threejs.org/examples/webgl_sprites.html.

It is called a "heads-up-display", or HUD.

three.js r.63

这篇关于Three.js:如何在缩放时保持sprite文本大小不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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