双轮廓 - 一个噪声函数的法向量双轮、向量、噪声、函数

2023-09-08 10:37:22 作者:听书人

我目前正在开发的利用双轮廓给地形更加有机/现实生活中的样子体素引擎。

I'm currently working on a voxel engine that utilizes dual contouring to give the terrain a more organic/real-life look.

如果你不熟悉的双轮廓,基本上我需要提供一个密度函数来表示一个特定的点是否是空气或固体(在我的情况,我利用3D单噪声),我需要能够以提供对3D降噪功能,任何一点的法向量。

If you're not familiar with dual contouring, basically I need to supply a density function to denote whether a specific point is air or solid (in my case, I'm utilizing 3D Simplex Noise) and I need to be able to provide the normal vector at any point on the 3D noise function.

一般情况下,计算法线一个三角形时,我采取两种构成三角形的向量的叉积;在这种情况下,我应该只是申请一个小三角洲噪声功能来达到同样的效果?

Normally, when calculating normals for a triangle, I take the cross product of two of the vectors that constitute the triangle; in this case, should I just apply a small delta to the noise function to achieve the same effect?

感谢您的帮助!

推荐答案

我发现一个的 采用梯度移动立方体算法(我工作的一个体素引擎太)简单的方法,但因为你仍然在三角形运行在一个三维网格,而不是直接与您能给试试看。

I've found a simple approach using gradient for marching cubes algorithm (I'm working on a voxel engine too), but since you're still operating on a 3D grid and not directly on the triangles you could give it a try.