使用 Babylon JS,在具有 DynamicTexture 的球体上绘制圆会产生椭圆形

Using Babylon JS, Drawing a circle on a Sphere with a DynamicTexture results in Elliptical shapes

所以我开始使用动态纹理并 运行 尝试一些时髦的东西。我创建了一个带有动态纹理的球体对象,并使用 .arc 创建了一些圆圈;然而,当它到达屏幕时,圆圈变成了椭圆形。我希望有一个简单的修复方法,但我还没有找到任何东西。

操场:Circle on a Sphere

感谢您的宝贵时间!

卡洛斯

显然,它在做正确的事情。当您应用动态纹理时,它会在父对象本身创建时应用。

要尝试这个,请打开这个示例-https://www.babylonjs-playground.com/#5ZCGRM#2并将 groundWidth 更改为 80,您会看到文本已被拉长。

var groundWidth = 80; // width changed to 80
var groundHeight = 10;
var ground = BABYLON.MeshBuilder.CreateGround("ground1", {width: groundWidth, height: groundHeight, subdivisions: 25}, scene);

此外,在https://doc.babylonjs.com/how_to/dynamictexture中,您可以看到球体表面的文字"sphere"已相应调整 - https://d33wubrfki0l68.cloudfront.net/27a5c2a531378e8120af19956fcedc68c38b51f9/2c1cb/img/how_to/dyntext.png

有一种方法可以通过更改 uScale 和 vScale 在表面上制作圆,但这是一个临时解决方案,我建议使用其他工具,如 Blender。

materialObj.diffuseTexture.vScale = 1;
materialObj.diffuseTexture.uScale = 2; 

以及 link - https://www.babylonjs-playground.com/#RQGTKJ#1