计算机高度计算方法,从高度图计算法线(Calculate Normals from Heightmap)

从高度图计算法线(Calculate Normals from Heightmap)

我正在尝试使用中央差分将高度图转换为法线矩阵,后者将对应于给定点的陡度。

我找到了几个有正确结果的链接,但没有解释背后的数学问题。

T

L O R

B

从这个链接我意识到我可以做到:

Vec3 normal = Vec3(2*(R-L), 2*(B-T), -4).Normalize();

事情是,我不知道2*和-4来自哪里。

在这个关于中心差分的解释中,我看到我们应该将这个值除以2,但我仍然不知道如何连接所有这些。

我真正想知道的是这背后的线性代数定义。 我有一个高度图,我想测量中心差异,我想获得正常的矢量,以便稍后用来测量陡度。

PS:Z轴是高度。

I am trying to convert an heightmap into a matrix of normals using central differencing which will later correspond to the steepness of a giving point.

I found several links with correct results but without explaining the math behind.

T

L O R

B

From this link I realised I can just do:

Vec3 normal = Vec3(2*(R-L), 2*(B-T), -4).Normalize();

The thing is that I don't know where the 2* and -

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值