环境

使用Custom Node来include自己写的ush文件。

节点:DebugScalarValues

数值计算

Untitled

float3用起来包含float2和float(也就是可以当这俩用),但是是个三维向量。

函数列表

  • max(x)

  • min(x)

  • abs(x)

  • fmod(x, y) = x mod y

  • round(x) = 与x最近的整数

  • pow(x, y)

  • sqrt(x)

  • rsqrt(x) = 1 / sqrt(x)

  • degrees(x) = 弧度x的角度值

  • radians(x) = 角度x的弧度值

  • noise(x) 传入坐标(?)产生[0, 1]随机值

  • log(x) = $lnx$

  • log2(x) = $log_2x$

  • log10(x) = $log_{10}x$

  • cos(x) x为弧度

  • acos(x)

  • sin(x) x为弧度

  • asin(x)

  • tan(x) x为弧度

  • atan(x)

  • atan2(x, y) x/y的反整切

  • 双曲线:

    Untitled (1)

  • ceil(x) = y if y is Integer and y ≥ x

  • floor(x) = y if y is Integer and y ≤ x

  • smoothstep(min, max, x) 如果min ≤ x ≤ max, 则返回一个介于[0, 1]的平滑Hermite插值,通过smoothstep在两个值之间做平滑过渡插值。

  • saturate(x) 保持x在[0, 1]之间

  • clamp(x, min, max) 保持x在[min, max]之间

  • step(x, y) = 1 if x ≤ y, otherwise = 0

  • lerp(x, y, alpha) 从x到y针对混合程度alpha插值

  • frac(x) 取x的小数部分但是貌似x是1.几的时候frac(x)总是1

  • length(v) = 向量v的长度

  • distance(v1, v2) = v1 与 v2之间的距离