简体   繁体   English

XNA 3D Blender模型无法保持规模

[英]XNA 3D blender models not keeping scale

So I am making all my models is Blender and then exporting it to .fbx format using the File ->Export and then checking off XNA Strict Options. 因此,我将所有模型制作为Blender,然后使用文件->导出将其导出为.fbx格式,然后选中XNA Strict Options。 This works just great, except that when I put my model in XNA, it has been stretched along the up-down axis and it is always the same scale. 这很好用,只是当我将模型放入XNA时,它已沿上下轴拉伸并且始终保持相同的比例。 No matter how much I scale it in Blender, it is always the same size in game. 无论我在Blender中缩放多少,它在游戏中的大小始终相同。 Any ideas? 有任何想法吗? Also, I'm not sure if this is related, but if I have a model with multiple parts, it will only show one part of it. 另外,我不确定是否相关,但是如果我有一个包含多个部分的模型,它将仅显示其中一部分。 Any help is appreciated! 任何帮助表示赞赏!

I am more familiar with 3ds max than blender, but if this was happening in max I would know what's going on so I'll say it in case Blender works in a similar fashion. 我对3ds max的了解比对Blender更为熟悉,但是如果这在max中发生,我会知道发生了什么,所以我会说出来,以防Blender以类似的方式工作。

When you modify something in a 3d modeling app (like scaling the model on a particular axis), it does not actually change the positions of the vertices like you may think. 当您在3D建模应用程序中进行某些修改(例如在特定轴上缩放模型)时,它实际上并不会像您想象的那样改变顶点的位置。 It only creates a transform matrix that can be applied to the original vertex positions at render time to make it appear the way you expect. 它仅创建可在渲染时应用于原始顶点位置的变换矩阵,以使其以您期望的方式显示。 So when you import the model into Xna, you are importing the model with it's unscaled vertex positions and all the transform matrices it takes to render the model the way you would expect it to. 因此,当您将模型导入Xna时,您要导入的模型具有未缩放的顶点位置以及以您期望的方式呈现模型所需的所有变换矩阵。 But you have to apply those transforms in your Xna code or the model wont appear the way it did in your modeling app. 但是您必须在Xna代码中应用这些转换,否则模型将不会像在建模应用程序中那样出现。 (the issue you are having) (您遇到的问题)

The way you apply the transforms is by calling the Xna Model.CopyAbsoluteBoneTransformsTo(Matrix[]) . 应用转换的方法是调用Xna Model.CopyAbsoluteBoneTransformsTo(Matrix[]) Make sure you do not call Model.CopyBoneTransformsTo(Matrix[]) , you need the one with the word 'Absolute' in it. 确保不调用 Model.CopyBoneTransformsTo(Matrix[]) ,而需要其中带有单词“ Absolute”的对象。

Here is a tutorial that shows how to implement that method: http://msdn.microsoft.com/en-us/library/bb203933(v=xnagamestudio.40).aspx 这是一个演示如何实现该方法的教程: http : //msdn.microsoft.com/zh-cn/library/bb203933(v=xnagamestudio.40).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM