diff options
author | OmarSquircleArt <mail@OmarEmara.dev> | 2019-11-27 13:07:20 +0300 |
---|---|---|
committer | OmarSquircleArt <mail@OmarEmara.dev> | 2019-11-27 13:07:20 +0300 |
commit | 1c2f7b022a56b034e3e24d8bd5bf03d3beb5ca94 (patch) | |
tree | c40ab4fb676efce962fe833f858c311af6c0c8e4 /intern/cycles/kernel | |
parent | fc1a073bcdc9d2a9ecd4b765724b0f4f4cab4d46 (diff) |
Cycles: Add Random Per Island attribute.
The Random Per Island attribute is a random float associated with each
connected component (island) of the mesh. It is particularly useful
when artists want to add variations to meshes composed of separate
units. Like tree leaves created using particle systems, wood planks
created using array modifiers, or abstract splines created using AN.
Reviewed By: Sergey Sharybin, Jacques Lucke
Differential Revision: https://developer.blender.org/D6154
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/shaders/node_geometry.osl | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 1e5534b0c17..7306c32d7c8 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -768,6 +768,7 @@ typedef enum AttributeStandard { ATTR_STD_VOLUME_TEMPERATURE, ATTR_STD_VOLUME_VELOCITY, ATTR_STD_POINTINESS, + ATTR_STD_RANDOM_PER_ISLAND, ATTR_STD_NUM, ATTR_STD_NOT_FOUND = ~0 diff --git a/intern/cycles/kernel/shaders/node_geometry.osl b/intern/cycles/kernel/shaders/node_geometry.osl index b5c1c6611c1..3cf2e974022 100644 --- a/intern/cycles/kernel/shaders/node_geometry.osl +++ b/intern/cycles/kernel/shaders/node_geometry.osl @@ -26,7 +26,8 @@ shader node_geometry(normal NormalIn = N, output vector Incoming = vector(0.0, 0.0, 0.0), output point Parametric = point(0.0, 0.0, 0.0), output float Backfacing = 0.0, - output float Pointiness = 0.0) + output float Pointiness = 0.0, + output float RandomPerIsland = 0.0) { Position = P; Normal = NormalIn; @@ -65,4 +66,6 @@ shader node_geometry(normal NormalIn = N, else if (bump_offset == "dy") { Pointiness += Dy(Pointiness); } + + getattribute("geom:random_per_island", RandomPerIsland); } |