导出为 USDZ 的 3D 图稿具有不同的颜色
首先我想说,我是 SceneKit 新手,并且在 iOS 上使用 AR 环境。
我有一个 3D 模型对象,一辆货车,作为 Blender 文件(.blend)的一部分 -->您可以在此处找到它。
我将其从 Blender 导出为 .glb 文件 -->您可以在此处找到它。
然后我在 Reality Converter 应用程序中打开 .glb 文件,并将其导出为 .usdz 文件 -->您可以在此处找到它。
问题是当我在 XCode 中预览对象以及将其放置在 AR 中时,对象颜色错误。
Blender 对象是否有问题?如果是这样,我应该对其进行什么更改才能正确导出颜色?
I want to start by saying that I am new to SceneKit and playing with AR environments on iOS.
I have a 3D model object, a van, as part of a Blender file(.blend) --> it can be found here.
I am exporting it as a .glb file from Blender --> it can be found here.
Then I open the .glb file in Reality Converter app, and export it as a .usdz file --> it can be found here.
The issue is when I preview the object in XCode and also when I place it in AR, the object colours are wrong.
Is there a problem with the Blender object? If so, what should I change to it so that the colours are exported correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关于搅拌机,Maya和Xcode
不幸的是,您在这里提到的问题是一个很棒的 Blender中的旧问题。的确,搅拌机输出错误(又名不一致)着色器的颜色,这是因为搅拌器在阴暗器颜色的线性颜色空间(不是SRGB)中运行。在这种情况下,有2种可能的解决方案。第一个是非常激进的 - 使用真实的专业软件,例如autodesk Maya 2023 with (因为学习玛雅人需要大量的时间),其中出口着着色器的颜色在正确的颜色空间中非常准确地复制 - 您必须从头开始重新分配所有材料。第二个 - 手动或以编程方式修复Xcode的检查器中的颜色。
从Maya中,您可以将模型导出为 binary 或 ascii
.usd
文件格式(确保已加载Mayausd插件)。然后使用现实转换器,以.usdz
存档中的结果转换。XCode解决方案
将您的
van.usdz
模型加载到Xcode中。为了方便起见,重命名模型的节点。非常重要!
选择
body_orange
节点,然后转到属性Inspector
TAB。删除颜色
属性。颜色
属性保留.usdz
配色架构。然后在
材料检查器
中分配所需的fiffuse
物理基于
着色器的颜色。另外,您也可以通过编程方式进行。这是SwiftUI示例示例代码:
这是RealityKit版本的SwiftUI示例代码:
://i.sstatic.net/8cujv.png“ alt =“在此处输入图像描述”>
关于Poly Count and Retopology在Maya中的几个单词,
我想在您的多边形中发表一条评论模型。可以制作具有2K至5K多边形的简单模型。但是您的模型有超过50,000多边形,这是一个巨大的数字。您的Hi-Poly模型将消耗大量资源(CPU,GPU,内存),因此,下降框架是可能的(如您在图片中所示,58 fps)。
那么,您该怎么办?理想情况下,这是一个3D建模者的工作,可以为游戏和移动平台创建低调模型 - 这确实是一项宝贵的技能。修改已经完成的网格(保存到 .fbx 或 .usdz )通常是一个坏主意。但是,例如,Autodesk Maya具有一个Retopology Tool(
cem –> retopologize
),该工具可帮助您大大减少使用高级算法的多边形数量。观看官方视频(时间 - 00:50)。About Blender, Maya and Xcode
Unfortunately, the issue you mentioned here is a great old issue in Blender. Indeed, Blender outputs wrong (a.k.a. inconsistent) shaders' colors, due to the fact that Blender operates in linear color space (not sRGB) of shader colors. There are 2 possible solutions in this case. The first one is quite radical - to use a real PRO software, like Autodesk Maya 2023 with USD plugin (because it takes a decent amount of time to learn Maya), in which exported shaders' colors are reproduced very accurately in correct color space – you must reassign all the materials from scratch. The second one – fix colors in Xcode's inspector manually, or programmatically.
From Maya you can export your model as binary or ASCII
.usd
file format (make sure that MayaUSD plugin is loaded). Then use Reality Converter, to convert the resulting model in.usdz
archive.Xcode solution
Load your
van.usdz
model into Xcode. Rename model's nodes in hierarchy for convenience.Very important!
Select
Body_Orange
node and go toAttributes Inspector
tab. DeleteColors
attribute.Colors
attribute keeps.usdz
colour schema.Then in
Material Inspector
assign a neededDiffuse
color ofphysicallyBased
shader.Also, you can do it programmatically. Here's a SwiftUI sample code for SceneKit:
And here's a SwiftUI sample code for RealityKit version:
A few words on poly count and retopology in Maya
I would like to make one remark about the polygons' count in your model. Such a simple model can be made having 2K to 5K polygons. But your model has over 50,000 polygons, which is a tremendous number. Your hi-poly model will consume a lot of resources (CPU, GPU, memory), thus, drop frame is possible (58 fps, as you can see in the picture).
So, what can you do about it? Ideally, it's a 3D modeler's job to conceive and create low-poly models for games and mobile platforms – it's really a precious skill. Modifying an already finished mesh (saved to distribution formats like .fbx or .usdz) is often a bad idea. However, Autodesk Maya for example, has a retopology tool (
Mesh –> Retopologize
) that helps you significantly reduce the number of polygons using advanced algorithm. Watch the official video (Time - 00:50).