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

@@ -176,7 +176,7 @@ enum {
VAR_MAT_MESH = (1 << 0),
VAR_MAT_VOLUME = (1 << 1),
VAR_MAT_HAIR = (1 << 2),
/* VAR_MAT_PROBE = (1 << 3), UNUSED */
VAR_MAT_POINTCLOUD = (1 << 3),
VAR_MAT_BLEND = (1 << 4),
VAR_MAT_LOOKDEV = (1 << 5),
VAR_MAT_HOLDOUT = (1 << 6),

View File

@@ -1357,6 +1357,9 @@ static char *eevee_get_defines(int options)
if ((options & VAR_MAT_HAIR) != 0) {
BLI_dynstr_append(ds, "#define HAIR_SHADER\n");
}
if ((options & VAR_MAT_POINTCLOUD) != 0) {
BLI_dynstr_append(ds, "#define POINTCLOUD_SHADER\n");
}
if ((options & VAR_WORLD_PROBE) != 0) {
BLI_dynstr_append(ds, "#define PROBE_CAPTURE\n");
}

View File

@@ -26,6 +26,9 @@ void main()
worldNormal = cross(hairTangent, binor);
vec3 world_pos = pos;
#elif defined(POINTCLOUD_SHADER)
pointcloud_get_pos_and_radius(pointPosition, pointRadius);
pointID = gl_VertexID;
#else
vec3 world_pos = point_object_to_world(pos);
#endif

View File

@@ -42,3 +42,13 @@ IN_OUT ShaderHairInterface
flat int hairStrandID;
};
#endif
#ifdef POINTCLOUD_SHADER
IN_OUT ShaderPointCloudInterface
{
/* world space */
float pointRadius;
float pointPosition;
flat int pointID;
};
#endif

View File

@@ -31,6 +31,9 @@ void main()
hairThickTime);
worldNormal = cross(hairTangent, binor);
vec3 world_pos = pos;
#elif defined(POINTCLOUD_SHADER)
pointcloud_get_pos_and_radius(pointPosition, pointRadius);
pointID = gl_VertexID;
#else
vec3 world_pos = point_object_to_world(pos);
#endif