Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Show First 20 Lines • Show All 1,925 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| closure = CLOSURE_BSDF_MICROFACET_GGX_ID; | closure = CLOSURE_BSDF_MICROFACET_GGX_ID; | ||||
| distribution_orig = NBUILTIN_CLOSURES; | distribution_orig = NBUILTIN_CLOSURES; | ||||
| } | } | ||||
| void GlossyBsdfNode::simplify_settings(Scene *scene) | void GlossyBsdfNode::simplify_settings(Scene *scene) | ||||
| { | { | ||||
| if(distribution_orig == NBUILTIN_CLOSURES) { | if(distribution_orig == NBUILTIN_CLOSURES) { | ||||
| roughness_orig = roughness; | |||||
| distribution_orig = distribution; | distribution_orig = distribution; | ||||
| } | } | ||||
| else { | |||||
| /* By default we use original values, so we don't worry about restoring | |||||
| * defaults later one and can only do override when needed. | |||||
| */ | |||||
| roughness = roughness_orig; | |||||
| distribution = distribution_orig; | |||||
| } | |||||
| Integrator *integrator = scene->integrator; | Integrator *integrator = scene->integrator; | ||||
| ShaderInput *roughness_input = input("Roughness"); | |||||
| if(integrator->filter_glossy == 0.0f) { | if(integrator->filter_glossy == 0.0f) { | ||||
| /* Fallback to Sharp closure for Roughness close to 0. | /* Fallback to Sharp closure for Roughness close to 0. | ||||
| * Note: Keep the epsilon in sync with kernel! | * Note: Keep the epsilon in sync with kernel! | ||||
| */ | */ | ||||
| ShaderInput *roughness_input = input("Roughness"); | |||||
| if(!roughness_input->link && roughness <= 1e-4f) { | if(!roughness_input->link && roughness <= 1e-4f) { | ||||
| distribution = CLOSURE_BSDF_REFLECTION_ID; | distribution = CLOSURE_BSDF_REFLECTION_ID; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* Rollback to original distribution when filter glossy is used. */ | /* If filter glossy is used we replace Sharp glossy with GGX so we can | ||||
| distribution = distribution_orig; | * benefit from closure blur to remove unwanted noise. | ||||
| */ | |||||
| if(roughness_input->link == NULL && | |||||
| distribution == CLOSURE_BSDF_REFLECTION_ID) | |||||
| { | |||||
| distribution = CLOSURE_BSDF_MICROFACET_GGX_ID; | |||||
| roughness = 0.0f; | |||||
| } | |||||
| } | } | ||||
| closure = distribution; | closure = distribution; | ||||
| } | } | ||||
| bool GlossyBsdfNode::has_integrator_dependency() | bool GlossyBsdfNode::has_integrator_dependency() | ||||
| { | { | ||||
| ShaderInput *roughness_input = input("Roughness"); | ShaderInput *roughness_input = input("Roughness"); | ||||
| return !roughness_input->link && roughness <= 1e-4f; | return !roughness_input->link && | ||||
| (distribution == CLOSURE_BSDF_REFLECTION_ID || roughness <= 1e-4f); | |||||
| } | } | ||||
| void GlossyBsdfNode::compile(SVMCompiler& compiler) | void GlossyBsdfNode::compile(SVMCompiler& compiler) | ||||
| { | { | ||||
| closure = distribution; | closure = distribution; | ||||
| if(closure == CLOSURE_BSDF_REFLECTION_ID) | if(closure == CLOSURE_BSDF_REFLECTION_ID) | ||||
| BsdfNode::compile(compiler, NULL, NULL); | BsdfNode::compile(compiler, NULL, NULL); | ||||
| Show All 38 Lines | |||||
| { | { | ||||
| closure = CLOSURE_BSDF_SHARP_GLASS_ID; | closure = CLOSURE_BSDF_SHARP_GLASS_ID; | ||||
| distribution_orig = NBUILTIN_CLOSURES; | distribution_orig = NBUILTIN_CLOSURES; | ||||
| } | } | ||||
| void GlassBsdfNode::simplify_settings(Scene *scene) | void GlassBsdfNode::simplify_settings(Scene *scene) | ||||
| { | { | ||||
| if(distribution_orig == NBUILTIN_CLOSURES) { | if(distribution_orig == NBUILTIN_CLOSURES) { | ||||
| roughness_orig = roughness; | |||||
| distribution_orig = distribution; | distribution_orig = distribution; | ||||
| } | } | ||||
| else { | |||||
| /* By default we use original values, so we don't worry about restoring | |||||
| * defaults later one and can only do override when needed. | |||||
| */ | |||||
| roughness = roughness_orig; | |||||
| distribution = distribution_orig; | |||||
| } | |||||
| Integrator *integrator = scene->integrator; | Integrator *integrator = scene->integrator; | ||||
| ShaderInput *roughness_input = input("Roughness"); | |||||
| if(integrator->filter_glossy == 0.0f) { | if(integrator->filter_glossy == 0.0f) { | ||||
| /* Fallback to Sharp closure for Roughness close to 0. | /* Fallback to Sharp closure for Roughness close to 0. | ||||
| * Note: Keep the epsilon in sync with kernel! | * Note: Keep the epsilon in sync with kernel! | ||||
| */ | */ | ||||
| ShaderInput *roughness_input = input("Roughness"); | |||||
| if(!roughness_input->link && roughness <= 1e-4f) { | if(!roughness_input->link && roughness <= 1e-4f) { | ||||
| distribution = CLOSURE_BSDF_SHARP_GLASS_ID; | distribution = CLOSURE_BSDF_SHARP_GLASS_ID; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* Rollback to original distribution when filter glossy is used. */ | /* If filter glossy is used we replace Sharp glossy with GGX so we can | ||||
| distribution = distribution_orig; | * benefit from closure blur to remove unwanted noise. | ||||
| */ | |||||
| if(roughness_input->link == NULL && | |||||
| distribution == CLOSURE_BSDF_SHARP_GLASS_ID) | |||||
| { | |||||
| distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID; | |||||
| roughness = 0.0f; | |||||
| } | |||||
| } | } | ||||
| closure = distribution; | closure = distribution; | ||||
| } | } | ||||
| bool GlassBsdfNode::has_integrator_dependency() | bool GlassBsdfNode::has_integrator_dependency() | ||||
| { | { | ||||
| ShaderInput *roughness_input = input("Roughness"); | ShaderInput *roughness_input = input("Roughness"); | ||||
| return !roughness_input->link && roughness <= 1e-4f; | return !roughness_input->link && | ||||
| (distribution == CLOSURE_BSDF_SHARP_GLASS_ID || roughness <= 1e-4f); | |||||
| } | } | ||||
| void GlassBsdfNode::compile(SVMCompiler& compiler) | void GlassBsdfNode::compile(SVMCompiler& compiler) | ||||
| { | { | ||||
| closure = distribution; | closure = distribution; | ||||
| if(closure == CLOSURE_BSDF_SHARP_GLASS_ID) | if(closure == CLOSURE_BSDF_SHARP_GLASS_ID) | ||||
| BsdfNode::compile(compiler, NULL, input("IOR")); | BsdfNode::compile(compiler, NULL, input("IOR")); | ||||
| Show All 38 Lines | |||||
| { | { | ||||
| closure = CLOSURE_BSDF_REFRACTION_ID; | closure = CLOSURE_BSDF_REFRACTION_ID; | ||||
| distribution_orig = NBUILTIN_CLOSURES; | distribution_orig = NBUILTIN_CLOSURES; | ||||
| } | } | ||||
| void RefractionBsdfNode::simplify_settings(Scene *scene) | void RefractionBsdfNode::simplify_settings(Scene *scene) | ||||
| { | { | ||||
| if(distribution_orig == NBUILTIN_CLOSURES) { | if(distribution_orig == NBUILTIN_CLOSURES) { | ||||
| roughness_orig = roughness; | |||||
| distribution_orig = distribution; | distribution_orig = distribution; | ||||
| } | } | ||||
| else { | |||||
| /* By default we use original values, so we don't worry about restoring | |||||
| * defaults later one and can only do override when needed. | |||||
| */ | |||||
| roughness = roughness_orig; | |||||
| distribution = distribution_orig; | |||||
| } | |||||
| Integrator *integrator = scene->integrator; | Integrator *integrator = scene->integrator; | ||||
| ShaderInput *roughness_input = input("Roughness"); | |||||
| if(integrator->filter_glossy == 0.0f) { | if(integrator->filter_glossy == 0.0f) { | ||||
| /* Fallback to Sharp closure for Roughness close to 0. | /* Fallback to Sharp closure for Roughness close to 0. | ||||
| * Note: Keep the epsilon in sync with kernel! | * Note: Keep the epsilon in sync with kernel! | ||||
| */ | */ | ||||
| ShaderInput *roughness_input = input("Roughness"); | |||||
| if(!roughness_input->link && roughness <= 1e-4f) { | if(!roughness_input->link && roughness <= 1e-4f) { | ||||
| distribution = CLOSURE_BSDF_REFRACTION_ID; | distribution = CLOSURE_BSDF_REFRACTION_ID; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* Rollback to original distribution when filter glossy is used. */ | /* If filter glossy is used we replace Sharp glossy with GGX so we can | ||||
| distribution = distribution_orig; | * benefit from closure blur to remove unwanted noise. | ||||
| */ | |||||
| if(roughness_input->link == NULL && | |||||
| distribution == CLOSURE_BSDF_REFRACTION_ID) | |||||
| { | |||||
| distribution = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID; | |||||
| roughness = 0.0f; | |||||
| } | |||||
| } | } | ||||
| closure = distribution; | closure = distribution; | ||||
| } | } | ||||
| bool RefractionBsdfNode::has_integrator_dependency() | bool RefractionBsdfNode::has_integrator_dependency() | ||||
| { | { | ||||
| ShaderInput *roughness_input = input("Roughness"); | ShaderInput *roughness_input = input("Roughness"); | ||||
| return !roughness_input->link && roughness <= 1e-4f; | return !roughness_input->link && | ||||
| (distribution == CLOSURE_BSDF_REFRACTION_ID || roughness <= 1e-4f); | |||||
| } | } | ||||
| void RefractionBsdfNode::compile(SVMCompiler& compiler) | void RefractionBsdfNode::compile(SVMCompiler& compiler) | ||||
| { | { | ||||
| closure = distribution; | closure = distribution; | ||||
| if(closure == CLOSURE_BSDF_REFRACTION_ID) | if(closure == CLOSURE_BSDF_REFRACTION_ID) | ||||
| BsdfNode::compile(compiler, NULL, input("IOR")); | BsdfNode::compile(compiler, NULL, input("IOR")); | ||||
| ▲ Show 20 Lines • Show All 3,270 Lines • Show Last 20 Lines | |||||