Merge branch 'master' into blender2.8
This commit is contained in:
@@ -411,6 +411,7 @@ static void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
|
||||
}
|
||||
}
|
||||
|
||||
mesh->resize_mesh(mesh->verts.size(), mesh->triangles.size());
|
||||
mesh->attributes.remove(ATTR_STD_VERTEX_NORMAL);
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
mesh->add_face_normals();
|
||||
@@ -434,8 +435,8 @@ static void ExportCurveTriangleGeometry(Mesh *mesh,
|
||||
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
|
||||
continue;
|
||||
|
||||
numverts += (CData->curve_keynum[curve] - 2)*2*resolution + resolution;
|
||||
numtris += (CData->curve_keynum[curve] - 2)*resolution;
|
||||
numverts += (CData->curve_keynum[curve] - 1)*resolution + resolution;
|
||||
numtris += (CData->curve_keynum[curve] - 1)*2*resolution;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,6 +546,7 @@ static void ExportCurveTriangleGeometry(Mesh *mesh,
|
||||
}
|
||||
}
|
||||
|
||||
mesh->resize_mesh(mesh->verts.size(), mesh->triangles.size());
|
||||
mesh->attributes.remove(ATTR_STD_VERTEX_NORMAL);
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
mesh->add_face_normals();
|
||||
@@ -890,7 +892,7 @@ void BlenderSync::sync_curves(Mesh *mesh,
|
||||
}
|
||||
|
||||
/* obtain general settings */
|
||||
bool use_curves = scene->curve_system_manager->use_curves;
|
||||
const bool use_curves = scene->curve_system_manager->use_curves;
|
||||
|
||||
if(!(use_curves && b_ob.mode() != b_ob.mode_PARTICLE_EDIT)) {
|
||||
if(!motion)
|
||||
@@ -898,11 +900,11 @@ void BlenderSync::sync_curves(Mesh *mesh,
|
||||
return;
|
||||
}
|
||||
|
||||
int primitive = scene->curve_system_manager->primitive;
|
||||
int triangle_method = scene->curve_system_manager->triangle_method;
|
||||
int resolution = scene->curve_system_manager->resolution;
|
||||
size_t vert_num = mesh->verts.size();
|
||||
size_t tri_num = mesh->num_triangles();
|
||||
const int primitive = scene->curve_system_manager->primitive;
|
||||
const int triangle_method = scene->curve_system_manager->triangle_method;
|
||||
const int resolution = scene->curve_system_manager->resolution;
|
||||
const size_t vert_num = mesh->verts.size();
|
||||
const size_t tri_num = mesh->num_triangles();
|
||||
int used_res = 1;
|
||||
|
||||
/* extract particle hair data - should be combined with connecting to mesh later*/
|
||||
|
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <climits>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "util_sky_model.h"
|
||||
#include "util_foreach.h"
|
||||
#include "util_logging.h"
|
||||
#include "util_transform.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -1931,21 +1932,38 @@ GlossyBsdfNode::GlossyBsdfNode()
|
||||
void GlossyBsdfNode::simplify_settings(Scene *scene)
|
||||
{
|
||||
if(distribution_orig == NBUILTIN_CLOSURES) {
|
||||
roughness_orig = roughness;
|
||||
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;
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
if(integrator->filter_glossy == 0.0f) {
|
||||
/* Fallback to Sharp closure for Roughness close to 0.
|
||||
* Note: Keep the epsilon in sync with kernel!
|
||||
*/
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
if(!roughness_input->link && roughness <= 1e-4f) {
|
||||
VLOG(1) << "Using sharp glossy BSDF.";
|
||||
distribution = CLOSURE_BSDF_REFLECTION_ID;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Rollback to original distribution when filter glossy is used. */
|
||||
distribution = distribution_orig;
|
||||
/* If filter glossy is used we replace Sharp glossy with GGX so we can
|
||||
* benefit from closure blur to remove unwanted noise.
|
||||
*/
|
||||
if(roughness_input->link == NULL &&
|
||||
distribution == CLOSURE_BSDF_REFLECTION_ID)
|
||||
{
|
||||
VLOG(1) << "Using GGX glossy with filter glossy.";
|
||||
distribution = CLOSURE_BSDF_MICROFACET_GGX_ID;
|
||||
roughness = 0.0f;
|
||||
}
|
||||
}
|
||||
closure = distribution;
|
||||
}
|
||||
@@ -1953,7 +1971,8 @@ void GlossyBsdfNode::simplify_settings(Scene *scene)
|
||||
bool GlossyBsdfNode::has_integrator_dependency()
|
||||
{
|
||||
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)
|
||||
@@ -2008,21 +2027,38 @@ GlassBsdfNode::GlassBsdfNode()
|
||||
void GlassBsdfNode::simplify_settings(Scene *scene)
|
||||
{
|
||||
if(distribution_orig == NBUILTIN_CLOSURES) {
|
||||
roughness_orig = roughness;
|
||||
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;
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
if(integrator->filter_glossy == 0.0f) {
|
||||
/* Fallback to Sharp closure for Roughness close to 0.
|
||||
* Note: Keep the epsilon in sync with kernel!
|
||||
*/
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
if(!roughness_input->link && roughness <= 1e-4f) {
|
||||
VLOG(1) << "Using sharp glass BSDF.";
|
||||
distribution = CLOSURE_BSDF_SHARP_GLASS_ID;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Rollback to original distribution when filter glossy is used. */
|
||||
distribution = distribution_orig;
|
||||
/* If filter glossy is used we replace Sharp glossy with GGX so we can
|
||||
* benefit from closure blur to remove unwanted noise.
|
||||
*/
|
||||
if(roughness_input->link == NULL &&
|
||||
distribution == CLOSURE_BSDF_SHARP_GLASS_ID)
|
||||
{
|
||||
VLOG(1) << "Using GGX glass with filter glossy.";
|
||||
distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
|
||||
roughness = 0.0f;
|
||||
}
|
||||
}
|
||||
closure = distribution;
|
||||
}
|
||||
@@ -2030,7 +2066,8 @@ void GlassBsdfNode::simplify_settings(Scene *scene)
|
||||
bool GlassBsdfNode::has_integrator_dependency()
|
||||
{
|
||||
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)
|
||||
@@ -2085,21 +2122,38 @@ RefractionBsdfNode::RefractionBsdfNode()
|
||||
void RefractionBsdfNode::simplify_settings(Scene *scene)
|
||||
{
|
||||
if(distribution_orig == NBUILTIN_CLOSURES) {
|
||||
roughness_orig = roughness;
|
||||
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;
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
if(integrator->filter_glossy == 0.0f) {
|
||||
/* Fallback to Sharp closure for Roughness close to 0.
|
||||
* Note: Keep the epsilon in sync with kernel!
|
||||
*/
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
if(!roughness_input->link && roughness <= 1e-4f) {
|
||||
VLOG(1) << "Using sharp refraction BSDF.";
|
||||
distribution = CLOSURE_BSDF_REFRACTION_ID;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Rollback to original distribution when filter glossy is used. */
|
||||
distribution = distribution_orig;
|
||||
/* If filter glossy is used we replace Sharp glossy with GGX so we can
|
||||
* benefit from closure blur to remove unwanted noise.
|
||||
*/
|
||||
if(roughness_input->link == NULL &&
|
||||
distribution == CLOSURE_BSDF_REFRACTION_ID)
|
||||
{
|
||||
VLOG(1) << "Using GGX refraction with filter glossy.";
|
||||
distribution = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
|
||||
roughness = 0.0f;
|
||||
}
|
||||
}
|
||||
closure = distribution;
|
||||
}
|
||||
@@ -2107,7 +2161,8 @@ void RefractionBsdfNode::simplify_settings(Scene *scene)
|
||||
bool RefractionBsdfNode::has_integrator_dependency()
|
||||
{
|
||||
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)
|
||||
|
@@ -388,7 +388,7 @@ public:
|
||||
bool has_integrator_dependency();
|
||||
ClosureType get_closure_type() { return distribution; }
|
||||
|
||||
float roughness;
|
||||
float roughness, roughness_orig;
|
||||
ClosureType distribution, distribution_orig;
|
||||
};
|
||||
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
bool has_integrator_dependency();
|
||||
ClosureType get_closure_type() { return distribution; }
|
||||
|
||||
float roughness, IOR;
|
||||
float roughness, roughness_orig, IOR;
|
||||
ClosureType distribution, distribution_orig;
|
||||
};
|
||||
|
||||
@@ -412,7 +412,7 @@ public:
|
||||
bool has_integrator_dependency();
|
||||
ClosureType get_closure_type() { return distribution; }
|
||||
|
||||
float roughness, IOR;
|
||||
float roughness, roughness_orig, IOR;
|
||||
ClosureType distribution, distribution_orig;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user