Cycles: add Point Info node

With (center) position, radius and random value outputs.

Eevee does not yet support rendering point clouds, but an untested
implementation of this node was added for when it does.

Ref T92573
This commit is contained in:
2022-01-25 13:25:33 +01:00
parent eab066cbf2
commit c813a1b358
33 changed files with 339 additions and 47 deletions

View File

@@ -1,15 +1,4 @@
float wang_hash_noise(uint s)
{
s = (s ^ 61u) ^ (s >> 16u);
s *= 9u;
s = s ^ (s >> 4u);
s *= 0x27d4eb2du;
s = s ^ (s >> 15u);
return fract(float(s) / 4294967296.0);
}
void node_hair_info(float hair_length,
out float is_strand,
out float intercept,

View File

@@ -215,3 +215,14 @@ float integer_noise(int n)
nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
return 0.5 * (float(nn) / 1073741824.0);
}
float wang_hash_noise(uint s)
{
s = (s ^ 61u) ^ (s >> 16u);
s *= 9u;
s = s ^ (s >> 4u);
s *= 0x27d4eb2du;
s = s ^ (s >> 15u);
return fract(float(s) / 4294967296.0);
}

View File

@@ -0,0 +1,13 @@
void node_point_info(out vec3 position, out float radius, out float random)
{
#ifdef POINTCLOUD_SHADER
position = pointPosition;
radius = pointRadius;
random = wang_hash_noise(uint(pointID));
#else
position = vec3(0.0, 0.0, 0.0);
radius = 0.0;
random = 0.0;
#endif
}