diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2017-11-05 23:59:17 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2017-11-14 06:17:54 +0300 |
commit | 212a8d9e5ae78a30ed4c35161d91eeca35eaa41f (patch) | |
tree | c66ac95d5787511a0c27580e6c03c231a1756b90 /intern/cycles/render | |
parent | d8066fb0f145395594d0a952a4c0f70206dc0214 (diff) |
Cycles: Make per-object random value output also work for Lamps
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/light.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/light.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index b37a0768b53..b62453cf5fc 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -134,6 +134,7 @@ NODE_DEFINE(Light) SOCKET_INT(samples, "Samples", 1); SOCKET_INT(max_bounces, "Max Bounces", 1024); + SOCKET_UINT(random_id, "Random ID", 0); SOCKET_BOOLEAN(is_portal, "Is Portal", false); SOCKET_BOOLEAN(is_enabled, "Is Enabled", true); @@ -638,6 +639,7 @@ void LightManager::device_update_points(Device *, int shader_id = scene->shader_manager->get_shader_id(shader); float samples = __int_as_float(light->samples); float max_bounces = __int_as_float(light->max_bounces); + float random = (float)light->random_id * (1.0f/(float)0xFFFFFFFF); if(!light->cast_shadow) shader_id &= ~SHADER_CAST_SHADOW; @@ -758,7 +760,7 @@ void LightManager::device_update_points(Device *, light_data[light_index*LIGHT_SIZE + 3] = make_float4(samples, 0.0f, 0.0f, 0.0f); } - light_data[light_index*LIGHT_SIZE + 4] = make_float4(max_bounces, 0.0f, 0.0f, 0.0f); + light_data[light_index*LIGHT_SIZE + 4] = make_float4(max_bounces, random, 0.0f, 0.0f); Transform tfm = light->tfm; Transform itfm = transform_inverse(tfm); diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h index 7e9014eb823..97b7b971c73 100644 --- a/intern/cycles/render/light.h +++ b/intern/cycles/render/light.h @@ -70,6 +70,7 @@ public: Shader *shader; int samples; int max_bounces; + uint random_id; void tag_update(Scene *scene); |