如何使用VertexBuffer3D来操作分层显示结构中的对象?
为了更好地解释我想要实现的目标,这里有一个简单的示例:
场景 1:在某个 3D 容器对象中,我想添加两个立方体:一个没有任何转换,另一个立方体具有小的位置、旋转和缩放调整。添加这两个立方体后,我还想转换容器的位置、旋转和比例。
场景 2:在 3D 角色的身体中,它由许多分层的子级(和子级)组成,每个子级在动画过程中都有各种变换。
所以我的问题是:
如何有效地计算这些单独的 3D 对象变换?仅使用一个 VertexBuffer3D
是否可以做到这一点?或者我是否需要多个 VertexBuffer3D
来跟踪每个对象?使用多个 VertexBuffer3D
似乎可能会达到极限(但我还没有阅读足够多的 Stage3D
/ Context3D
文档来确定) 。
To better explain what I'm trying to achieve, here's a simple example:
Scenario 1: Within some 3D container object, I would like to add two Cubes: one without any transformation, and one with small position, rotation and scale adjustments. After adding those two cubes, I would like to also transform the container's position, rotation and scale.
Scenario 2: In a 3D character's body, it consists of many hierarchical children (and subchildren), each having various transformations over the course of an animation.
So my question is:
How do I calculate these individual 3D object transformations efficiently? Can it even be possible to do this with only one VertexBuffer3D
? Or do I need several VertexBuffer3D
to keep track of each objects? Using multiple VertexBuffer3D
seems like it could hit a limit (but I haven't read enough of the Stage3D
/ Context3D
documentation to know for sure).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将这些转换作为顶点程序常量作为矩阵传递。常数变化很快。顶点缓冲区用于源数据并且应该很少改变。对于诸如骨骼(我认为骨骼动画或骨骼动画是维基百科术语:))角色模型之类的高级事物,您可以传递多个矩阵并选择权重。
You should pass those transformations in as vertex program constants as matrices. Constants are quick to change. Vertex buffers are for source data and should rarely change. For advanced things like bone (i think bone animation or skeletal animation is the wikipedia term :)) models for characters, you pass multiple matrices and select weights.