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/shaders | |
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/shaders')
-rw-r--r-- | intern/cycles/kernel/shaders/node_geometry.osl | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |