Merge branch 'master' into blender2.8
This commit is contained in:
@@ -1226,7 +1226,7 @@ void OpenCLDeviceBase::store_cached_kernel(
|
||||
}
|
||||
|
||||
string OpenCLDeviceBase::build_options_for_base_program(
|
||||
const DeviceRequestedFeatures& /*requested_features*/)
|
||||
const DeviceRequestedFeatures& requested_features)
|
||||
{
|
||||
/* TODO(sergey): By default we compile all features, meaning
|
||||
* mega kernel is not getting feature-based optimizations.
|
||||
@@ -1234,6 +1234,14 @@ string OpenCLDeviceBase::build_options_for_base_program(
|
||||
* Ideally we need always compile kernel with as less features
|
||||
* enabled as possible to keep performance at it's max.
|
||||
*/
|
||||
|
||||
/* For now disable baking when not in use as this has major
|
||||
* impact on kernel build times.
|
||||
*/
|
||||
if(!requested_features.use_baking) {
|
||||
return "-D__NO_BAKING__";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -423,6 +423,11 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b)
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
return bsdf_hair_merge(a, b);
|
||||
#ifdef __PRINCIPLED__
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID:
|
||||
return bsdf_principled_diffuse_merge(a, b);
|
||||
#endif
|
||||
#ifdef __VOLUME__
|
||||
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
||||
return volume_henyey_greenstein_merge(a, b);
|
||||
|
||||
@@ -58,6 +58,14 @@ ccl_device int bsdf_principled_diffuse_setup(PrincipledDiffuseBsdf *bsdf)
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device bool bsdf_principled_diffuse_merge(const ShaderClosure *a, const ShaderClosure *b)
|
||||
{
|
||||
const PrincipledDiffuseBsdf *bsdf_a = (const PrincipledDiffuseBsdf*)a;
|
||||
const PrincipledDiffuseBsdf *bsdf_b = (const PrincipledDiffuseBsdf*)b;
|
||||
|
||||
return (isequal_float3(bsdf_a->N, bsdf_b->N) && bsdf_a->roughness == bsdf_b->roughness);
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_principled_diffuse_eval_reflect(const ShaderClosure *sc, const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
|
||||
@@ -158,7 +158,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
}
|
||||
|
||||
/* diffuse */
|
||||
if(fabsf(average(base_color)) > CLOSURE_WEIGHT_CUTOFF) {
|
||||
if(fabsf(average(mixed_ss_base_color)) > CLOSURE_WEIGHT_CUTOFF) {
|
||||
if(subsurface < CLOSURE_WEIGHT_CUTOFF && diffuse_weight > CLOSURE_WEIGHT_CUTOFF) {
|
||||
float3 diff_weight = weight * base_color * diffuse_weight;
|
||||
|
||||
|
||||
@@ -374,9 +374,9 @@ ccl_device_inline bool isfinite3_safe(float3 v)
|
||||
|
||||
ccl_device_inline float3 ensure_finite3(float3 v)
|
||||
{
|
||||
if(!isfinite_safe(v.x)) v.x = 0.0;
|
||||
if(!isfinite_safe(v.y)) v.y = 0.0;
|
||||
if(!isfinite_safe(v.z)) v.z = 0.0;
|
||||
if(!isfinite_safe(v.x)) v.x = 0.0f;
|
||||
if(!isfinite_safe(v.y)) v.y = 0.0f;
|
||||
if(!isfinite_safe(v.z)) v.z = 0.0f;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "particletracer.h"
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef sun
|
||||
#include "ieeefp.h"
|
||||
@@ -25,6 +26,8 @@
|
||||
#define round(x) (x)
|
||||
#endif
|
||||
|
||||
using std::isfinite;
|
||||
|
||||
/******************************************************************************
|
||||
* Constructor
|
||||
*****************************************************************************/
|
||||
|
||||
@@ -1562,12 +1562,8 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
|
||||
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
|
||||
cache = rbw->pointcache;
|
||||
|
||||
if (ctime <= startframe) {
|
||||
rbw->ltime = startframe;
|
||||
return;
|
||||
}
|
||||
/* make sure we don't go out of cache frame range */
|
||||
else if (ctime > endframe) {
|
||||
if (ctime > endframe) {
|
||||
ctime = endframe;
|
||||
}
|
||||
|
||||
@@ -1583,7 +1579,6 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
|
||||
|
||||
if (BKE_ptcache_read(&pid, ctime, can_simulate)) {
|
||||
BKE_ptcache_validate(cache, (int)ctime);
|
||||
rbw->ltime = ctime;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2084,7 +2084,7 @@ void BKE_sequencer_proxy_set(struct Sequence *seq, bool value)
|
||||
}
|
||||
}
|
||||
else {
|
||||
seq->flag ^= SEQ_USE_PROXY;
|
||||
seq->flag &= ~SEQ_USE_PROXY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2107,9 +2107,11 @@ static void ui_update_color_picker_buts_rgb(uiBlock *block, ColorPicker *cpicker
|
||||
continue;
|
||||
|
||||
if (bt->rnaprop) {
|
||||
|
||||
ui_but_v3_set(bt, rgb);
|
||||
|
||||
/* original button that created the color picker already does undo
|
||||
* push, so disable it on RNA buttons in the color picker block */
|
||||
UI_but_flag_disable(bt, UI_BUT_UNDO);
|
||||
}
|
||||
else if (STREQ(bt->str, "Hex: ")) {
|
||||
float rgb_gamma[3];
|
||||
|
||||
@@ -335,6 +335,12 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int ed_undo_redo_poll(bContext *C)
|
||||
{
|
||||
wmOperator *last_op = WM_operator_last_redo(C);
|
||||
return last_op && ED_operator_screenactive(C) &&
|
||||
WM_operator_check_ui_enabled(C, last_op->type->name);
|
||||
}
|
||||
|
||||
/* ********************** */
|
||||
|
||||
@@ -386,7 +392,7 @@ void ED_OT_undo_redo(wmOperatorType *ot)
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = ed_undo_redo_exec;
|
||||
ot->poll = ED_operator_screenactive;
|
||||
ot->poll = ed_undo_redo_poll;
|
||||
}
|
||||
|
||||
/* ui callbacks should call this rather than calling WM_operator_repeat() themselves */
|
||||
|
||||
@@ -2690,7 +2690,7 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad
|
||||
|
||||
/* ambient light */
|
||||
// TODO: set ambient light to an appropriate value
|
||||
vec3 L = vec3(mix(0.1, 0.03, metallic)) * base_color.rgb;
|
||||
vec3 L = mix(0.1, 0.03, metallic) * mix(base_color.rgb, subsurface_color.rgb, subsurface * (1.0 - metallic));
|
||||
|
||||
float eta = (2.0 / (1.0 - sqrt(0.08 * specular))) - 1.0;
|
||||
|
||||
@@ -2704,10 +2704,11 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad
|
||||
/* directional lights */
|
||||
for (int i = 0; i < NUM_LIGHTS; i++) {
|
||||
vec3 light_position_world = glLightSource[i].position.xyz;
|
||||
vec3 light_position = normalize(NormalMatrix * light_position_world);
|
||||
vec3 light_position = normalize(light_position_world);
|
||||
|
||||
vec3 H = normalize(light_position + V);
|
||||
|
||||
vec3 light_diffuse = glLightSource[i].diffuse.rgb;
|
||||
vec3 light_specular = glLightSource[i].specular.rgb;
|
||||
|
||||
float NdotL = dot(N, light_position);
|
||||
@@ -2748,8 +2749,9 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad
|
||||
// sheen
|
||||
vec3 Fsheen = schlick_fresnel(LdotH) * sheen * Csheen;
|
||||
|
||||
diffuse_and_specular_bsdf = (M_1_PI * mix(Fd, ss, subsurface) * base_color.rgb + Fsheen)
|
||||
* (1.0 - metallic) + Gs * Fs * Ds;
|
||||
vec3 diffuse_bsdf = (mix(Fd * base_color.rgb, ss * subsurface_color.rgb, subsurface) + Fsheen) * light_diffuse;
|
||||
vec3 specular_bsdf = Gs * Fs * Ds * light_specular;
|
||||
diffuse_and_specular_bsdf = diffuse_bsdf * (1.0 - metallic) + specular_bsdf;
|
||||
}
|
||||
diffuse_and_specular_bsdf *= max(NdotL, 0.0);
|
||||
|
||||
@@ -2766,11 +2768,11 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad
|
||||
float Fr = fresnel_dielectric_cos(LdotH, 1.5); //mix(0.04, 1.0, FH);
|
||||
float Gr = smithG_GGX(CNdotL, 0.25) * smithG_GGX(CNdotV, 0.25);
|
||||
|
||||
clearcoat_bsdf = clearcoat * Gr * Fr * Dr * vec3(0.25);
|
||||
clearcoat_bsdf = clearcoat * Gr * Fr * Dr * vec3(0.25) * light_specular;
|
||||
}
|
||||
clearcoat_bsdf *= max(CNdotL, 0.0);
|
||||
|
||||
L += light_specular * (diffuse_and_specular_bsdf + clearcoat_bsdf);
|
||||
L += diffuse_and_specular_bsdf + clearcoat_bsdf;
|
||||
}
|
||||
|
||||
result = vec4(L, 1.0);
|
||||
|
||||
@@ -341,7 +341,7 @@ static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value)
|
||||
}
|
||||
}
|
||||
else {
|
||||
seq->flag ^= SEQ_USE_TRANSFORM;
|
||||
seq->flag &= ~SEQ_USE_TRANSFORM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value)
|
||||
}
|
||||
}
|
||||
else {
|
||||
seq->flag ^= SEQ_USE_CROP;
|
||||
seq->flag &= ~SEQ_USE_CROP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user