diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-01 19:53:36 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-01 19:53:36 +0400 |
commit | df625253ac0dec5be70701e2694c1e0358343fbf (patch) | |
tree | 10b216af9eb607023a3b280b8641acf336e34b10 /intern/cycles/render | |
parent | 1e741b3a52cc44b7a3ee173f180fd3d99c958efc (diff) |
Cycles:
* Add max diffuse/glossy/transmission bounces
* Add separate min/max for transparent depth
* Updated/added some presets that use these options
* Add ray visibility options for objects, to hide them from
camera/diffuse/glossy/transmission/shadow rays
* Is singular ray output for light path node
Details here:
http://wiki.blender.org/index.php/Dev:2.5/Source/Render/Cycles/LightPaths
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/integrator.cpp | 49 | ||||
-rw-r--r-- | intern/cycles/render/integrator.h | 15 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/render/object.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/render/object.h | 1 | ||||
-rw-r--r-- | intern/cycles/render/scene.h | 1 |
7 files changed, 73 insertions, 11 deletions
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp index 30736670cc3..57689be3965 100644 --- a/intern/cycles/render/integrator.cpp +++ b/intern/cycles/render/integrator.cpp @@ -25,8 +25,19 @@ CCL_NAMESPACE_BEGIN Integrator::Integrator() { - minbounce = 2; - maxbounce = 7; + min_bounce = 2; + max_bounce = 7; + + max_diffuse_bounce = max_bounce; + max_glossy_bounce = max_bounce; + max_transmission_bounce = max_bounce; + probalistic_termination = true; + + transparent_min_bounce = min_bounce; + transparent_max_bounce = max_bounce; + transparent_probalistic = true; + transparent_shadows = false; + no_caustics = false; blur_caustics = 0.0f; @@ -47,13 +58,29 @@ void Integrator::device_update(Device *device, DeviceScene *dscene) KernelIntegrator *kintegrator = &dscene->data.integrator; /* integrator parameters */ - kintegrator->minbounce = minbounce + 1; - kintegrator->maxbounce = maxbounce + 1; + kintegrator->max_bounce = max_bounce + 1; + if(probalistic_termination) + kintegrator->min_bounce = min_bounce + 1; + else + kintegrator->min_bounce = kintegrator->max_bounce; + + kintegrator->max_diffuse_bounce = max_diffuse_bounce + 1; + kintegrator->max_glossy_bounce = max_glossy_bounce + 1; + kintegrator->max_transmission_bounce = max_transmission_bounce + 1; + + kintegrator->transparent_max_bounce = transparent_max_bounce + 1; + if(transparent_probalistic) + kintegrator->transparent_min_bounce = transparent_min_bounce + 1; + else + kintegrator->transparent_min_bounce = kintegrator->transparent_max_bounce; + + kintegrator->transparent_shadows = transparent_shadows; + kintegrator->no_caustics = no_caustics; kintegrator->blur_caustics = blur_caustics; /* sobol directions table */ - int dimensions = PRNG_BASE_NUM + (maxbounce + 2)*PRNG_BOUNCE_NUM; + int dimensions = PRNG_BASE_NUM + (max_bounce + 2)*PRNG_BOUNCE_NUM; uint *directions = dscene->sobol_directions.resize(SOBOL_BITS*dimensions); sobol_generate_direction_vectors((uint(*)[SOBOL_BITS])directions, dimensions); @@ -71,8 +98,16 @@ void Integrator::device_free(Device *device, DeviceScene *dscene) bool Integrator::modified(const Integrator& integrator) { - return !(minbounce == integrator.minbounce && - maxbounce == integrator.maxbounce && + return !(min_bounce == integrator.min_bounce && + max_bounce == integrator.max_bounce && + max_diffuse_bounce == integrator.max_diffuse_bounce && + max_glossy_bounce == integrator.max_glossy_bounce && + max_transmission_bounce == integrator.max_transmission_bounce && + probalistic_termination == integrator.probalistic_termination && + transparent_min_bounce == integrator.transparent_min_bounce && + transparent_max_bounce == integrator.transparent_max_bounce && + transparent_probalistic == integrator.transparent_probalistic && + transparent_shadows == integrator.transparent_shadows && no_caustics == integrator.no_caustics && blur_caustics == integrator.blur_caustics); } diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h index b7d0c48131f..5bab4470089 100644 --- a/intern/cycles/render/integrator.h +++ b/intern/cycles/render/integrator.h @@ -27,8 +27,19 @@ class Scene; class Integrator { public: - int minbounce; - int maxbounce; + int min_bounce; + int max_bounce; + + int max_diffuse_bounce; + int max_glossy_bounce; + int max_transmission_bounce; + bool probalistic_termination; + + int transparent_min_bounce; + int transparent_max_bounce; + bool transparent_probalistic; + bool transparent_shadows; + bool no_caustics; float blur_caustics; bool need_update; diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index b9163309652..b73013fc378 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -576,6 +576,10 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene * dscene->tri_woop.reference(&pack.tri_woop[0], pack.tri_woop.size()); device->tex_alloc("__tri_woop", dscene->tri_woop); } + if(pack.prim_visibility.size()) { + dscene->prim_visibility.reference((uint*)&pack.prim_visibility[0], pack.prim_visibility.size()); + device->tex_alloc("__prim_visibility", dscene->prim_visibility); + } if(pack.prim_index.size()) { dscene->prim_index.reference((uint*)&pack.prim_index[0], pack.prim_index.size()); device->tex_alloc("__prim_index", dscene->prim_index); @@ -686,6 +690,7 @@ void MeshManager::device_free(Device *device, DeviceScene *dscene) device->tex_free(dscene->bvh_nodes); device->tex_free(dscene->object_node); device->tex_free(dscene->tri_woop); + device->tex_free(dscene->prim_visibility); device->tex_free(dscene->prim_index); device->tex_free(dscene->prim_object); device->tex_free(dscene->tri_normal); @@ -699,6 +704,7 @@ void MeshManager::device_free(Device *device, DeviceScene *dscene) dscene->bvh_nodes.clear(); dscene->object_node.clear(); dscene->tri_woop.clear(); + dscene->prim_visibility.clear(); dscene->prim_index.clear(); dscene->prim_object.clear(); dscene->tri_normal.clear(); diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 5ffc3fbbabb..900115d2231 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1117,7 +1117,7 @@ GlassBsdfNode::GlassBsdfNode() { distribution = ustring("Sharp"); - add_input("Roughness", SHADER_SOCKET_FLOAT, 0.2f); + add_input("Roughness", SHADER_SOCKET_FLOAT, 0.0f); add_input("Fresnel", SHADER_SOCKET_FLOAT, 0.3f); } @@ -1490,8 +1490,8 @@ LightPathNode::LightPathNode() add_output("Is Shadow Ray", SHADER_SOCKET_FLOAT); add_output("Is Diffuse Ray", SHADER_SOCKET_FLOAT); add_output("Is Glossy Ray", SHADER_SOCKET_FLOAT); - add_output("Is Reflection Ray", SHADER_SOCKET_FLOAT); add_output("Is Transmission Ray", SHADER_SOCKET_FLOAT); + add_output("Is Singular Ray", SHADER_SOCKET_FLOAT); } void LightPathNode::compile(SVMCompiler& compiler) @@ -1522,12 +1522,19 @@ void LightPathNode::compile(SVMCompiler& compiler) compiler.add_node(NODE_LIGHT_PATH, NODE_LP_glossy, out->stack_offset); } + out = output("Is Singular Ray"); + if(!out->links.empty()) { + compiler.stack_assign(out); + compiler.add_node(NODE_LIGHT_PATH, NODE_LP_singular, out->stack_offset); + } + out = output("Is Reflection Ray"); if(!out->links.empty()) { compiler.stack_assign(out); compiler.add_node(NODE_LIGHT_PATH, NODE_LP_reflection, out->stack_offset); } + out = output("Is Transmission Ray"); if(!out->links.empty()) { compiler.stack_assign(out); diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index 06c93e48b89..4ba2de6e61b 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -33,6 +33,7 @@ Object::Object() name = ""; mesh = NULL; tfm = transform_identity(); + visibility = ~0; } Object::~Object() diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h index 7a12a06853b..7fe83cf7d91 100644 --- a/intern/cycles/render/object.h +++ b/intern/cycles/render/object.h @@ -42,6 +42,7 @@ public: BoundBox bounds; ustring name; vector<ParamValue> attributes; + uint visibility; Object(); ~Object(); diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index 9d475cd9fa5..5772a9d7268 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -57,6 +57,7 @@ public: device_vector<float4> bvh_nodes; device_vector<uint> object_node; device_vector<float4> tri_woop; + device_vector<uint> prim_visibility; device_vector<uint> prim_index; device_vector<uint> prim_object; |