非重叠平铺-houdiniUE
 Houdini UE特效学习站|houdiUE节点、工程、插件、资产世界

{{ tags.important.name }}非重叠平铺

{{ tag.name }}
优惠前:
已售{{ sales_count }}
原价:
已售{{ sales_count }}
{{ important_discount.small_badge }}
倒计时00分00秒
{{ important_discount.desc }}
{{ opt.name }}
{{ opt.view_mode === 'img' ? '列表' : '图片' }}
{{ item.name }}
{{ item.name }}
{{ item.value }}
{{ item.name }}

制作不重叠的tile而不跳过太多循环,确实是个挑战。

float s = chf('scale');
vector2 t = chu('offset');

vector2 uv = (set(v@P.x, v@P.z) + t) * s;

vector2 f = frac(uv);
vector2 c = floor(uv);
vector2 offset;
vector2 tile = c;

float r0 = rand(c);
int orient = (int(c.x) + int(c.y)) & 1;
tile[orient] += f[orient] > r0;
offset[orient] = f[orient] > r0 ? 1.0 : -1.0;

float r1 = rand(c + offset);
tile[orient ^ 1] += f[orient ^ 1] > r1;

u@tile = tile;

在 UV 中,我们会偏移并调整位置属性。结果被分为分数 f 和整数 c。在声明偏瓦片后,我们生成随机值 r0 和 r1,并将其与 f 进行比较。对于 方向,我们通过位和运算(1)来检查 c 中整数分量的和是偶数还是奇数。接下来,orient ^ 1 根据 c 中 x 和 y 坐标的和是偶数还是奇数,将 orient 存储的值翻转。

图元根据tile属性被拆分,分割节点会去除内边,这样我们就得到了干净的瓦片,可以投影到表面或作为贴图的基础。