次のコードでは、正投影カメラとテクスチャとしてプレーン ジオメトリにマップされたキャンバスを使用して、非常に基本的なシーンを設定しています。
透明なキャンバスに白いテキストを配置しましたが、canvas.toDataURL() を使用しても効果がありません。
ただし、キャンバスの内容をテクスチャとしてマテリアルに適用し、それを超標準的な 2D シーン内でレンダリングすると、テキストの輪郭が黒い線で囲まれます。これはおそらく、奇妙なアンチエイリアスが発生した結果です。この例では、レンダラーのクリア カラー、マテリアル、およびテキストはすべて真っ白です。
スクリーンショットは次のとおりです。
var camera = new THREE.OrthographicCamera(window.innerWidth / - 2,
window.innerWidth / 2,
window.innerHeight / 2,
window.innerHeight / - 2, 0, 10);
var scene = new THREE.Scene();
canvas = document.createElement('canvas');
canvas.width = 300;
canvas.height = 300;
var context = canvas.getContext('2d');
context.fillStyle = "white";
context.font = "bold 72px Arial";
context.fillText("Zibri", 50, 100);
var texture = new THREE.Texture(canvas);
var geometry = new THREE.PlaneGeometry(canvas.width, canvas.height);
texture.needsUpdate = true;
var material = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texture, transparent: true });
var mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
renderer = new THREE.WebGLRenderer({ antialias: false });
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor(0xffffff)
document.body.appendChild( renderer.domElement );
camera.lookAt(scene.position);
renderer.render(scene, camera);