Blender中创建的3D模型未出现在屏幕上的预期位置。

huangapple go评论63阅读模式
英文:

3D model made in Blender not appearing on screen where expected

问题

I created an object (a face) in Blender, exported it as a .obj, then used RealityConverter to make it a .usdz file.

我在Blender中创建了一个对象(一个面孔),将其导出为.obj文件,然后使用RealityConverter将其制作成.usdz文件。

I imported the .usdz file into my Xcode project. This is how I've attempted to anchor the Blender object to the user's face:

我将.usdz文件导入到我的Xcode项目中。以下是我尝试将Blender对象锚定到用户脸部的方式:

let cat = try! Entity.loadAnchor(named: "alienCat")
uiView.scene.addAnchor(cat)

When I use the above code with a simple object I created in Reality Composer, it works as expected and is anchored perfectly on the user's face.

当我使用上述代码与我在Reality Composer中创建的简单对象一起使用时,它按预期工作,并完美地锚定在用户的脸上。

But when I try the same code with my custom made .usdz file from Blender, the object doesn't appear on screen.

但是,当我尝试使用相同的代码与我在Blender中制作的自定义.usdz文件一起使用时,对象不会显示在屏幕上。

As I rotate the phone though, I see a large, blown up version floating above. I've attached 2 screenshots:

  1. The camera facing my face, and my face is black (expected). But no object attached to my face (unexpected).

但是,当我旋转手机时,我看到一个大的、放大的版本浮在上方。我附上了2张屏幕截图:

  1. 面向我的脸的相机,我的脸是黑色的(预期的)。但没有对象附在我的脸上(意外的)。

Blender中创建的3D模型未出现在屏幕上的预期位置。

  1. When I rotate the phone, I see my object floating way above my head and MUCH bigger than expected:
    Blender中创建的3D模型未出现在屏幕上的预期位置。

  2. 当我旋转手机时,我看到我的对象浮在我的头上远远高于预期,并且比预期的要大得多:

When I run the code, this is the error I get in the Xcode console:

当我运行代码时,在Xcode控制台中出现以下错误:

Warning: in AppendProperty at line 858 of sdf/path.cpp -- Can only append a property 'preliminary:anchoring:type' to a prim path (/)
Warning: in AppendProperty at line 858 of sdf/path.cpp -- Can only append a property 'triggers' to a prim path (/)

I believe my errors are originating from however I am creating my .obj in Blender. I'd like to fix these errors in Blender if possible. With the goal of just importing a .usdz and it works as expected. There was an answer posted here: https://stackoverflow.com/questions/65896647/realitykit-getting-runtime-warning-when-placing-a-model-in-arview by Andy Jazz. And he says If you setup a preliminary anchoring for USDZ model, then Xcode will not print such warnings.

我相信我的错误是由我在Blender中创建.obj文件的方式引起的。如果可能的话,我想在Blender中修复这些错误,目标是只需导入.usdz文件,它就能按预期工作。这里有一个答案:https://stackoverflow.com/questions/65896647/realitykit-getting-runtime-warning-when-placing-a-model-in-arview,作者是Andy Jazz。他说:“如果您为USDZ模型设置了初步锚定,那么Xcode就不会打印这样的警告。”

Is there a way to set up this preliminary anchoring in Blender?

在Blender中是否有一种方法来设置这个初步锚定?

How do I get these errors removed and have my .usdz object placed on the face as expected, and in an appropriate size?

如何消除这些错误,并使我的.usdz对象按预期放置在脸上,以及以适当的大小?

英文:

I created an object (a face) in Blender, exported it as a .obj, then used RealityConverter to make it a .usdz file.

I imported the .usdz file into my Xcode project. This is how I've attempted to anchor the Blender object to the user's face:

let cat = try! Entity.loadAnchor(named: "alienCat")
uiView.scene.addAnchor(cat)

When I use the above code with a simple object I created in Reality Composer, it works as expected and is anchored perfectly on the user's face.

But when I try the same code with my custom made .usdz file from Blender, the object doesn't appear on screen.

As I rotate the phone though, I see a large, blown up version floating above. I've attached 2 screenshots:

  1. The camera facing my face, and my face is black (expected). But no object attached to my face (unexpected).

Blender中创建的3D模型未出现在屏幕上的预期位置。

  1. When I rotate the phone, I see my object floating way above my head and MUCH bigger than expected:
    Blender中创建的3D模型未出现在屏幕上的预期位置。

When I run the code, this is the error I get in the Xcode console:

Warning: in AppendProperty at line 858 of sdf/path.cpp -- Can only append a property 'preliminary:anchoring:type' to a prim path (/)
Warning: in AppendProperty at line 858 of sdf/path.cpp -- Can only append a property 'triggers' to a prim path (/)

I believe my errors are originating from however I am creating my .obj in Blender. I'd like to fix these errors in Blender if possible. With the goal of just importing a .usdz and it works as expected. There was an answer posted here: https://stackoverflow.com/questions/65896647/realitykit-getting-runtime-warning-when-placing-a-model-in-arview by Andy Jazz. And he says If you setup a preliminary anchoring for USDZ model, then Xcode will not print such warnings.

Is there a way to set up this preliminary anchoring in Blender?

How do I get these errors removed and have my .usdz object placed on the face as expected, and in an appropriate size?

答案1

得分: 0

缩放问题

从Blender或Maya导出时,模型的比例默认为100:1(因为您将模型以厘米比例导出,而不是RealityKit的米比例)。运行面部跟踪时,面具的枢轴点与面具表面之间的距离始终大于0,这意味着在100:1的比例下,这个距离增加了一百倍。枢轴点甚至可以位于模型的边界框之外。还要检查Blender模型的轴是朝上的:正Y还是正Z。

anchor.scale /= 100
英文:

Scaling issue

When exporting from Blender or Maya, the scale of the model is 100:1 by default (because you're exporting your model in centimeter scale, not RealityKit's meter scale). Running facial tracking, the distance between the mask's pivot point and the mask surface is always greater than 0, which means that at a scale of 100:1, this distance increases by hundred times. The pivot point can even be outside the bounding box of the model. Also check which Blender model's axis is facing up: positive Y or positive Z.

anchor.scale /= 100

huangapple
  • 本文由 发表于 2023年2月26日 23:51:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75573165.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定