我在 aqsis renderman 中使用了 voroni 函数。当我在以下多边形上使用此函数时,它会生成看起来像星域的点:
Polygon "P" [ -70 -70 -1 70 -70 -1 70 70 -1 -70 70 -1]
但是这个多边形只生成了一堆线:
Polygon "P" [ -700 0 480 700 0 480 700 0 -170 -700 0 -170 ]
这是 voroni 函数:
void voronoi_f1_3d (float jitter; float frequency; output float f1)
{
point p=point(s*frequency,t*frequency,0);
point thiscell = point (floor(s*frequency)+0.5,floor(t*frequency)+0.5,0);
f1 = 1000;
uniform float i, j;
for (i = -1; i <= 1; i += 1) {
for (j = -1; j <= 1; j += 1) {
point testcell = thiscell + vector(i,j,0);
point pos = testcell+jitter*(vector cellnoise (testcell) - 0.5);
vector offset = pos - p;
float dist = offset . offset;
if (dist < f1) {
f1 = dist; //pos1 = pos;
}
}
}
f1 = sqrt(f1);
}
这是我使用它的方式:
voronoi_f1_3d(jidder,gfrq,pointy);
T = Cs*(1-smoothstep(0.1,1,pointy))*Nf;
Ci = T;
我认为不同之处在于多边形的面对方式,但我不知道如何补偿。