3D 计算机图形中的插值 [英] interpolation in 3d computer graphics

查看:23
本文介绍了3D 计算机图形中的插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以帮助用简单的术语解释什么是插值以及它如何在 3d 计算机图形中使用

I was wondering if someone could help with explaining in simple terms what interpolation is and how its used in 3d computer graphics

推荐答案

简单地说:给定两点 A 和 B,在它们之间找到一点.

Simply put: given two points A and B, find a point between them.

例如,如果我想一步将某物从位置 x=1 移动到 x=4:

For example, if I want to move something along a line from a position x=1 to x=4 in one step:

1-----------------------4

第一步在位置 1,第二步在位置 4,因此对象立即从一个位置移动到另一个位置.但是,如果我希望对象花费一定的时间或帧数来进行过渡,我需要通过找到均匀间隔的中间点来改进它.

The first step is at location 1, the second step is at location 4, so the object moves instantly from one location to the other. However, if I want the object to take a certain amount of time or number of frames to make the transition, I'll need to refine that by finding intermediate points that are evenly spaced.

如果我想让对象采取两步(或帧)从 1 移动到 4,

If I want the object to take two steps (or frames) to move from 1 to 4,

1-----------X-----------4

我需要计算新点 (X) 是什么,以便我可以在适当的时间在那里绘制对象.在这种情况下,点 X 将是

I need to calculate what the new point (X) is so I can draw the object there at the appropriate time. In this case, the point X will be

                                  (max-min)
location = min + (current_step) * --------
                                    steps

location 是我们想要找到的.min=1, max=4,在这个例子中 steps=2 因为我们想把 span 分成两步:

location is what we're trying to find. min=1, max=4, and in this example steps=2 since we want to divide the span into two steps:

step:   location:
0       1
1       2.5
2       4

1------------(2.5)-----------4

如果我们想采取 4 个步骤:

If we want to take 4 steps:

step:   location:
0       1
1       1.75
2       2.5
3       3.25
4       4

1---(1.75)---(2.5)---(3.25)---4

等等.对于四步,对象移动每帧总距离的 25%.对于 10 步、10% 等,令人恶心.

And so forth. For four steps, the object moves 25% of the total distance per frame. For 10 steps, 10%, etc ad nauseum.

对于多个维度(当对象具有 2 维或 3 维轨迹时),只需将其独立应用于每个 X、Y、Z 轴.

For multiple dimensions (when an object has a 2- or 3-dimensional trajectory), just apply this to each X,Y,Z axis independently.

这是线性插值.还有其他种类.一如既往,Google 可以帮助您.

This is linear interpolation. There are other kinds. As always, Google can help you out.

其他应用包括纹理映射、抗锯齿、图像平滑和缩放等,当然还有游戏和图形之外的许多其他用途.

Other applications include texture mapping, anti-aliasing, image smoothing and scaling, etc., and of course many other uses outside of games and graphics.

注意:很多框架已经提供了这一点.例如,在 XNA 中,它是 Matrix.Lerp.

Note: a lot of frameworks already provide this. In XNA, for instance, it's Matrix.Lerp.

这篇关于3D 计算机图形中的插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆