制作一个动态的cycle的动画材质
首先我们使用hlsl来写一个圆
// The below expression will get compiled
// into the output of this node
float result = 0.0f;
for(int i = 0; i < nSize; i++)
{float angle = 2 * (i / nSize) * 3.14;float2 pos = center + radius * float2(cos(angle), sin(angle));result += length(pos - uv) < size;
}
return float3(result, result, result);
加入偏移让圆动起来
float result = 0.0f;
for(int i = 0; i < nSize; i++)
{float angle = 2 * (i / nSize) * time * 3.14;float2 pos = center + radius * float2(cos(angle), sin(angle));result += length(pos - uv) < size;
}
return float3(result, result, result);
多指针旋转
也就是沿着半径去增加点的数量
float result = 0.0f;
for(int i = 0; i < nSize; i++)
{for(int j = 0; j < nCopy; j++){float angle = 2 * (i / nSize) * time * 3.14;float2 pos = center + radius * (j / nCopy) * float2(cos(angle), sin(angle));result += length(pos - uv) < size;}
}
return float3(result, result, result);
后续可以按照自己的需求修改