标量距离场或定向距离场的例子?

时间:2016-12-28 22:25:14

标签: graphics glsl shader modeling

我在本文中发现了标量距离场和定向距离场,从体数据中提取特征敏感表面。

有什么区别,任何人都可以提供一个例子。非常感谢。

1 个答案:

答案 0 :(得分:0)

来自http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

我明白了......

定向距离

如果球体定义如下

float sdSphere( vec3 p, float s )
{
    return length(p)-s;
}

鉴于任何一点

vec3 a

在空间中,定向距离将有方向

a - p

有签名距离

sdSphere(a, s)

标量距离

Sphere - signed - exact

float sdSphere( vec3 p, float s )
{
    return length(p)-s;
}

Sphere - unsigned - exact

float sdSphere( vec3 p, float s )
{
  return abs(length(p)-s);
}
相关问题