我花了相当多的时间进行谷歌搜索,看看是否可以在three.js环境中完成这个操作。
我想创建一个基于TextGeometry而不是简单的原始对象(例如Lee StemKoski -shadow glow example中的球体或立方体)的发光效果。
我一直在阅读和尝试Lee StemKoski的例子
特别是他的Shader Glow example,正如所述,该示例适用于简单对象,但与复杂几何形状不兼容。因此,我想知道是否有任何变通方法或其他建议来创建文本周围的发光效果。
问候
w9914420
更新:我决定使用映射概念,通过将图像附加到文本上,可以创建发光效果。在这个例子中,我使用了一个圆,但对于我需要的文本进行映射应该不太困难。
更新:20/3/17 - 所以我尝试使用theeX.atmosphere材质来创建那种难以捉摸的文本发光效果。以下是一些结果。
如您所见,还没有完全实现 - 我遇到的问题是无法更多地平滑外部发光文本的顶点。我不确定是否可能,欢迎任何建议。
用于创建效果的原生代码。
//normal text created
var geometry2 = threeLab.asset.simpleText('hello','my_font');
var materialme = new THREE.MeshNormalMaterial();
var mesh = new THREE.Mesh( geometry2, materialme );
this.scene.add( mesh );
// we create a secondary text object to use as glow
var geometry = threeLab.asset.simpleText('hello','my_font');
// clone for manipulation
var geoclone = geometry.clone();
//Thes functions are need to make it work in this case
geoclone.mergeVertices();
//geoclone.computeCentroids();
geoclone.computeVertexNormals();
geoclone.computeFaceNormals();
// part of threex library to make the glow scale and expand
THREEx.dilateGeometry(geoclone, 0.5);
var materialz = THREEx.createAtmosphereMaterial();
var meshHalo = new THREE.Mesh(geoclone, materialz );
//we have now our glow
this.scene.add( meshHalo );