[Bf-blender-cvs] [dbb8222] master: Fix missing properties editor update when changing 3D View camera

2016-09-27 Thread Julian Eisel
Commit: dbb8222baa408eb1c1ebb47fc7b7c52bf2fbdd35
Author: Julian Eisel
Date:   Wed Sep 28 00:44:31 2016 +0200
Branches: master
https://developer.blender.org/rBdbb8222baa408eb1c1ebb47fc7b7c52bf2fbdd35

Fix missing properties editor update when changing 3D View camera

Actually two errors here:
* Properties editor wasn't refreshing on (NC_SCENE | ND_RENDER_OPTIONS) 
notifiers
* Was using notifier info bits wrongly, needs to send two separate notifiers

Decided to remove ND_RENDER_OPTIONS rather than adding properties editor scene 
context refresh for it, this is more than a render option change.

===

M   source/blender/editors/space_view3d/view3d_view.c

===

diff --git a/source/blender/editors/space_view3d/view3d_view.c 
b/source/blender/editors/space_view3d/view3d_view.c
index bc7a998..af86fb7 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -627,7 +627,10 @@ static int view3d_setobjectascamera_exec(bContext *C, 
wmOperator *op)
.dist = >dist, .lens = >lens});
}
 
-   WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS | 
NC_OBJECT | ND_DRAW, CTX_data_scene(C));
+   if (v3d->scenelock) {
+   WM_event_add_notifier(C, NC_SCENE, scene);
+   }
+   WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
}

return OPERATOR_FINISHED;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [23aabf5] fracture_modifier: Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78-release' into fracture_modifier

2016-09-27 Thread Martin Felke
Commit: 23aabf5c81626e374fe100559c24e66fd26e7072
Author: Martin Felke
Date:   Tue Sep 27 21:46:27 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rB23aabf5c81626e374fe100559c24e66fd26e7072

Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78-release' into 
fracture_modifier

Conflicts:
CMakeLists.txt
build_files/build_environment/install_deps.sh
build_files/cmake/macros.cmake
doc/python_api/sphinx_doc_gen.sh
intern/cycles/app/CMakeLists.txt
intern/cycles/blender/addon/properties.py
intern/cycles/blender/blender_sync.cpp
intern/cycles/kernel/bvh/bvh.h
intern/cycles/kernel/geom/geom_bvh_volume.h
intern/cycles/kernel/geom/geom_bvh_volume_all.h
intern/cycles/kernel/kernel_volume.h
intern/cycles/kernel/kernels/opencl/kernel.cl
intern/cycles/kernel/shaders/node_subsurface_scattering.osl
intern/cycles/kernel/svm/svm_closure.h
intern/cycles/util/util_vector.h
release/datafiles/splash.png
release/datafiles/splash_2x.png
release/scripts/addons
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_mesh_mapping.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/particle_distribute.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/speaker.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/editors/gpencil/gpencil_brush.c
source/blender/editors/gpencil/gpencil_ops.c
source/blender/editors/object/object_relations.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/transform/transform_snap.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/modifiers/MOD_modifiertypes.h
source/blender/modifiers/intern/MOD_util.c
source/blender/nodes/shader/nodes/node_shader_bump.c
source/blender/nodes/shader/nodes/node_shader_fresnel.c
source/blender/nodes/shader/nodes/node_shader_normal_map.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/render_texture.c
source/blender/windowmanager/WM_api.h
source/creator/CMakeLists.txt

===



===

diff --cc CMakeLists.txt
index 066ee1e,e061fab..ff0a19b
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -226,9 -234,13 +234,14 @@@ option(WITH_BULLET"Enable Bulle
  option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently 
unsupported due to missing features in upstream!)" )
  mark_as_advanced(WITH_SYSTEM_BULLET)
  option(WITH_GAMEENGINE"Enable Game Engine" ${_init_GAMEENGINE})
+ if(APPLE)
+   set(WITH_GAMEENGINE_DECKLINK OFF)
+ else()
+   option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink 
cards in the Game Engine" ON)
+ endif()
  option(WITH_PLAYER"Build Player" OFF)
  option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" 
${_init_OPENCOLORIO})
 +option(WITH_VORO"Enable Voronoi Fracture based on Voro++" ON)
  
  # Compositor
  option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@@ -3036,8 -1714,8 +1715,9 @@@ if(FIRST_RUN
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
 +  info_cfg_option(WITH_VORO)
info_cfg_option(WITH_OPENVDB)
+   info_cfg_option(WITH_ALEMBIC)
  
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)
diff --cc build_files/cmake/macros.cmake
index 25a93fe,5a67ac9..900a9c7
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@@ -691,11 -737,15 +737,19 @@@ function(SETUP_BLENDER_SORTED_LIBS
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" 
"extern_bullet")
endif()
  
+   if(WITH_GAMEENGINE_DECKLINK)
+   list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
+   endif()
+ 
+   if(WIN32)
+   list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
+   endif()
+ 
 +  if(WITH_VORO)
 +  

[Bf-blender-cvs] [07e45ea] fracture_modifier: merge compile fixes

2016-09-27 Thread Martin Felke
Commit: 07e45ea86c6e90ba7a77def67fb8f4b3a509a517
Author: Martin Felke
Date:   Tue Sep 27 21:46:59 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rB07e45ea86c6e90ba7a77def67fb8f4b3a509a517

merge compile fixes

===

M   source/blender/blenkernel/intern/rigidbody.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/object/object_modifier.c
M   source/blender/editors/physics/rigidbody_constraint.c

===

diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 37c185c..6c0fbb0 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -76,9 +76,6 @@
 #include "BKE_scene.h"
 #include "PIL_time.h"
 
-#include "WM_types.h"
-#include "WM_api.h"
-
 #ifdef WITH_BULLET
 
 static void resetDynamic(RigidBodyWorld *rbw, bool do_reset_always);
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index 93050b7..14e59d1 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1695,10 +1695,10 @@ static void write_shard(WriteData* wd, Shard* s)
CustomDataLayer *llayers = NULL, llayers_buff[CD_TEMP_CHUNK_SIZE];
CustomDataLayer *players = NULL, players_buff[CD_TEMP_CHUNK_SIZE];
 
-   writestruct(wd, DATA, "Shard", 1, s);
-   writestruct(wd, DATA, "MVert", s->totvert, s->mvert);
-   writestruct(wd, DATA, "MPoly", s->totpoly, s->mpoly);
-   writestruct(wd, DATA, "MLoop", s->totloop, s->mloop);
+   writestruct(wd, DATA, Shard, 1, s);
+   writestruct(wd, DATA, MVert, s->totvert, s->mvert);
+   writestruct(wd, DATA, MPoly, s->totpoly, s->mpoly);
+   writestruct(wd, DATA, MLoop, s->totloop, s->mloop);
 
CustomData_file_write_prepare(>vertData, , vlayers_buff, 
ARRAY_SIZE(vlayers_buff));
CustomData_file_write_prepare(>loopData, , llayers_buff, 
ARRAY_SIZE(llayers_buff));
@@ -1726,13 +1726,13 @@ static void write_shard(WriteData* wd, Shard* s)
 
 static void write_meshIsland(WriteData* wd, MeshIsland* mi)
 {
-   writestruct(wd, DATA, "MeshIsland", 1, mi);
+   writestruct(wd, DATA, MeshIsland, 1, mi);
writedata(wd, DATA, sizeof(float) * 3 * mi->vertex_count, mi->vertco);
writedata(wd, DATA, sizeof(short) * 3 * mi->vertex_count, mi->vertno);
 
-   writestruct(wd, DATA, "RigidBodyOb", 1, mi->rigidbody);
+   writestruct(wd, DATA, RigidBodyOb, 1, mi->rigidbody);
writedata(wd, DATA, sizeof(int) * mi->neighbor_count, mi->neighbor_ids);
-   writestruct(wd, DATA, "BoundBox", 1, mi->bb);
+   writestruct(wd, DATA, BoundBox, 1, mi->bb);
writedata(wd, DATA, sizeof(int) * mi->vertex_count, mi->vertex_indices);
 
writedata(wd, DATA, sizeof(float) * 3 * mi->frame_count, mi->locs);
@@ -1891,7 +1891,7 @@ static void write_modifiers(WriteData *wd, ListBase 
*modbase)
{
if (mode)
{
-   writestruct(wd, DATA, 
"FracMesh", 1, fm);
+   writestruct(wd, DATA, FracMesh, 
1, fm);
 
for (s = fm->shard_map.first; 
s; s = s->next) {
write_shard(wd, s);
@@ -1907,7 +1907,7 @@ static void write_modifiers(WriteData *wd, ListBase 
*modbase)
 
for (con = 
fmd->meshConstraints.first; con; con = con->next)
{
-   writestruct(wd, DATA, 
"RigidBodyShardCon", 1, con);
+   writestruct(wd, DATA, 
RigidBodyShardCon, 1, con);
}
}
}
@@ -1919,8 +1919,8 @@ static void write_modifiers(WriteData *wd, ListBase 
*modbase)
 
for (ssq = fmd->shard_sequence.first; ssq; ssq 
= ssq->next)
{
-   writestruct(wd, DATA, "ShardSequence", 
1, ssq);
-   writestruct(wd, DATA, "FracMesh", 1, 
ssq->frac_mesh);
+   writestruct(wd, DATA, ShardSequence, 1, 
ssq);
+   writestruct(wd, DATA, FracMesh, 1, 
ssq->frac_mesh);
for (s = 
ssq->frac_mesh->shard_map.first; s; s = s->next) {
write_shard(wd, s);
 

[Bf-blender-cvs] [192a18a] fracture_modifier: added new bmesh boolean solver to fracture modifier as well

2016-09-27 Thread Martin Felke
Commit: 192a18a99d17b2d1ea6fc9bf7ee2d6b3606356f2
Author: Martin Felke
Date:   Wed Sep 28 00:01:28 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rB192a18a99d17b2d1ea6fc9bf7ee2d6b3606356f2

added new bmesh boolean solver to fracture modifier as well

===

M   release/scripts/startup/bl_ui/properties_physics_fracture.py
M   source/blender/blenkernel/BKE_fracture.h
M   source/blender/blenkernel/BKE_fracture_util.h
M   source/blender/blenkernel/intern/fracture.c
M   source/blender/blenkernel/intern/fracture_util.c
M   source/blender/blenlib/BLI_math_geom.h
M   source/blender/blenloader/intern/readfile.c
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/CMakeLists.txt
M   source/blender/modifiers/intern/MOD_boolean.c
M   source/blender/modifiers/intern/MOD_boolean_util.h
A   source/blender/modifiers/intern/MOD_boolean_util_bmesh.c
R100source/blender/modifiers/intern/MOD_boolean_util.c  
source/blender/modifiers/intern/MOD_boolean_util_carve.c
M   source/blender/modifiers/intern/MOD_fracture.c

===

diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py 
b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index e151343..297529a 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -96,6 +96,12 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
 layout.prop(md, "limit_impact")
 
 layout.prop(md, "frac_algorithm")
+if md.frac_algorithm in {'BOOLEAN', 'BOOLEAN_FRACTAL'}:
+col = layout.column(align=True)
+col.label(text="Boolean Solver:")
+col.prop(md, "boolean_solver", text="")
+if md.boolean_solver == 'BMESH':
+col.prop(md, "boolean_double_threshold")
 col = layout.column(align=True)
 col.prop(md, "shard_count")
 col.prop(md, "cluster_count")
diff --git a/source/blender/blenkernel/BKE_fracture.h 
b/source/blender/blenkernel/BKE_fracture.h
index 514845a..77c005e 100644
--- a/source/blender/blenkernel/BKE_fracture.h
+++ b/source/blender/blenkernel/BKE_fracture.h
@@ -92,7 +92,7 @@ struct DerivedMesh *BKE_shard_create_dm(struct Shard *s, bool 
doCustomData);
 void BKE_fracture_shard_by_points(struct FracMesh *fmesh, ShardID id, struct 
FracPointCloud *points, int algorithm,
   struct Object *obj, struct DerivedMesh *dm, 
short inner_material_index, float mat[4][4],
   int num_cuts, float fractal, bool smooth, 
int num_levels, int mode, bool reset, int active_setting,
-  int num_settings, char uv_layer[], bool 
threaded);
+  int num_settings, char uv_layer[], bool 
threaded, int solver, float thresh);
 
 /* create shards from a base mesh and a set of other objects / cutter planes */
 void BKE_fracture_shard_by_planes(struct FractureModifierData *fmd, struct 
Object *obj, short inner_material_index, float mat[4][4]);
diff --git a/source/blender/blenkernel/BKE_fracture_util.h 
b/source/blender/blenkernel/BKE_fracture_util.h
index 6b769f7..4736e4b 100644
--- a/source/blender/blenkernel/BKE_fracture_util.h
+++ b/source/blender/blenkernel/BKE_fracture_util.h
@@ -35,7 +35,8 @@
 
 #include "DNA_fracture_types.h"
 
-Shard *BKE_fracture_shard_boolean(Object *obj, DerivedMesh *dm_parent, Shard* 
child, short inner_material_index, int num_cuts, float fractal, Shard **other, 
float mat[4][4], float radius, bool use_smooth_inner, int num_levels, char 
uv_layer[]);
+Shard *BKE_fracture_shard_boolean(Object *obj, DerivedMesh *dm_parent, Shard* 
child, short inner_material_index, int num_cuts, float fractal,
+  Shard **other, float mat[4][4], float 
radius, bool use_smooth_inner, int num_levels, char uv_layer[], int solver, 
float thresh);
 Shard *BKE_fracture_shard_bisect(struct BMesh *bm_orig, Shard* child, float 
obmat[4][4], bool use_fill,
  bool clear_inner, bool clear_outer, int 
cutlimit, float centroid[],
  short inner_mat_index, char uv_layer[], 
struct KDTree *preselect_tree);
diff --git a/source/blender/blenkernel/intern/fracture.c 
b/source/blender/blenkernel/intern/fracture.c
index 595b486..de88b68 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -116,8 +116,9 @@ static BMesh *shard_to_bmesh(Shard *s)
BMIter iter;
BMFace *f;
 
+   bm_parent = BM_mesh_create(_mesh_allocsize_default,  &((struct 
BMeshCreateParams){.use_toolflags = true,}));
dm_parent = BKE_shard_create_dm(s, true);
-   

[Bf-blender-cvs] [83d5a91] blender2.8: modernize basic shader a tiny bit

2016-09-27 Thread Mike Erwin
Commit: 83d5a919e26affaa4e81258e629fe048215f6a04
Author: Mike Erwin
Date:   Tue Sep 27 21:25:31 2016 +0200
Branches: blender2.8
https://developer.blender.org/rB83d5a919e26affaa4e81258e629fe048215f6a04

modernize basic shader a tiny bit

"varying" is redundant here, all GS inputs & outputs vary.

Any code that uses this will be GLSL 1.3 or newer.

===

M   source/blender/gpu/shaders/gpu_shader_basic_geom.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl 
b/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
index a88681a..13f05b3 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
@@ -14,9 +14,9 @@ layout(line_strip, max_vertices = 10) out;
 layout(triangle_strip, max_vertices = 6) out;
 #endif
 
-varying out float t;
-varying in vec4 varying_vertex_color_line[];
-varying out vec4 varying_vertex_color;
+out float t;
+in vec4 varying_vertex_color_line[];
+out vec4 varying_vertex_color;
 
 uniform ivec4 viewport;
 uniform float line_width;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0ca2118] blender2.8: safety checks in GPU shader library

2016-09-27 Thread Mike Erwin
Commit: 0ca211885182bf9b07329eeac7e0a930a410984a
Author: Mike Erwin
Date:   Tue Sep 27 19:38:35 2016 +0200
Branches: blender2.8
https://developer.blender.org/rB0ca211885182bf9b07329eeac7e0a930a410984a

safety checks in GPU shader library

If shader compilation fails, or for some other reason the shader is NULL or 0, 
we need to know.

===

M   source/blender/gpu/intern/gpu_shader.c

===

diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index 41a4537..6a730f3 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -470,6 +470,8 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
 
 void GPU_shader_bind(GPUShader *shader)
 {
+   BLI_assert(shader && shader->program);
+
glUseProgram(shader->program);
 }
 
@@ -480,6 +482,8 @@ void GPU_shader_unbind(void)
 
 void GPU_shader_free(GPUShader *shader)
 {
+   BLI_assert(shader);
+
if (shader->vertex)
glDeleteShader(shader->vertex);
if (shader->geometry)
@@ -497,6 +501,8 @@ void GPU_shader_free(GPUShader *shader)
 
 int GPU_shader_get_uniform(GPUShader *shader, const char *name)
 {
+   BLI_assert(shader && shader->program);
+
return glGetUniformLocation(shader->program, name);
 }
 
@@ -584,6 +590,8 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), 
int location, GPUText
 
 int GPU_shader_get_attribute(GPUShader *shader, const char *name)
 {
+   BLI_assert(shader && shader->program);
+
return glGetAttribLocation(shader->program, name);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ad32b77] blender2.8: fix basic shader syntax when drawing lines

2016-09-27 Thread Mike Erwin
Commit: ad32b774cbfe5470a5d3cd074e16b325c5393a07
Author: Mike Erwin
Date:   Tue Sep 27 21:05:48 2016 +0200
Branches: blender2.8
https://developer.blender.org/rBad32b774cbfe5470a5d3cd074e16b325c5393a07

fix basic shader syntax when drawing lines

Fixed on GL 3.2+, Mac still lays an egg due to the geometry shader.

===

M   source/blender/gpu/shaders/gpu_shader_basic_frag.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl 
b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
index 01a335a..ed23397 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
@@ -58,7 +58,7 @@ uniform sampler2D_default texture_map;
 #ifdef USE_STIPPLE
 uniform int stipple_id;
 #if defined(DRAW_LINE)
-varying in float t;
+varying float t;
 uniform int stipple_pattern;
 #endif
 #endif

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [13a4147] master: Dynamic Paint: Don't store duplicate adjacency links.

2016-09-27 Thread Alexander Gavrilov
Commit: 13a4147c17f82681c29fcc25cce86aff1702f2d1
Author: Alexander Gavrilov
Date:   Tue Sep 27 12:21:44 2016 +0300
Branches: master
https://developer.blender.org/rB13a4147c17f82681c29fcc25cce86aff1702f2d1

Dynamic Paint: Don't store duplicate adjacency links.

Duplicates can happen at UV seams in case of resolution mismatch
or other complications. It's better not to store them in case it
confuses some math later on.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D2261

===

M   source/blender/blenkernel/intern/dynamicpaint.c

===

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 2a01a7a..c739904 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2673,6 +2673,7 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface, flo
const int index = tx + w * ty;
 
if (tempPoints[index].tri_index 
!= -1) {
+   int start_pos = n_pos;

ed->n_index[final_index[index]] = n_pos;

ed->n_num[final_index[index]] = 0;
 
@@ -2681,10 +2682,20 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface, flo
const int 
n_target = dynamic_paint_find_neighbour_pixel(

 , vert_to_looptri_map, w, h, tx, ty, i);
 
-   if (n_target >= 
0) {
-   
ed->n_target[n_pos] = final_index[n_target];
-   
ed->n_num[final_index[index]]++;
-   n_pos++;
+   if (n_target >= 
0 && n_target != index) {
+   bool 
duplicate = false;
+   for 
(int j = start_pos; j < n_pos; j++) {
+   
if (ed->n_target[j] == final_index[n_target]) {
+   
duplicate = true;
+   
break;
+   
}
+   }
+
+   if 
(!duplicate) {
+   
ed->n_target[n_pos] = final_index[n_target];
+   
ed->n_num[final_index[index]]++;
+   
n_pos++;
+   }
}
else if 
(n_target == ON_MESH_EDGE || n_target == OUT_OF_TEXTURE) {

ed->flags[final_index[index]] |= ADJ_ON_MESH_EDGE;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9a66d0a] master: Dynamic Paint: Fix adjacency computations at UV seams.

2016-09-27 Thread Alexander Gavrilov
Commit: 9a66d0ad1b18f02a486a9e691f71896275ea1cdc
Author: Alexander Gavrilov
Date:   Tue Sep 27 11:13:04 2016 +0300
Branches: master
https://developer.blender.org/rB9a66d0ad1b18f02a486a9e691f71896275ea1cdc

Dynamic Paint: Fix adjacency computations at UV seams.

1. When adding one pixel border to UV islands prefer grid directions.
   This is more logical as it means neighbor pixels will commonly
   share a border, opposed to just corners.
2. Don't subtract 0.5 when converting float UVs to int in computing
   adjacency across a UV seam. Pixels cover a square with corners
   at int positions and adding/subtracting 0.5 is only for dealing
   with the center point of a pixel.
3. Use the neighbour_pixel field from the correct pixel, and check
   it's not back to the origin point.
4. In the connected UV case, ensure that the returned index actually
   refers to a valid active pixel.

This fixes paint spread not traversing some UV seams, while at the
same time spreading to random unrelated points on other seams.
The first problem is primarily fixed by 2, while the second one
is addressed by item 4.

Differential Revision: https://developer.blender.org/D2261

===

M   source/blender/blenkernel/intern/dynamicpaint.c

===

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 51bc5fc..2a01a7a 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -101,6 +101,10 @@ static const float gaussianTotal = 3.309425f;
 static int neighX[8] = {1, 1, 0, -1, -1, -1, 0, 1};
 static int neighY[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
+/* Neighbor x/y list that prioritizes grid directions over diagonals */
+static int neighStraightX[8] = {1, 0, -1,  0, 1, -1, -1,  1};
+static int neighStraightY[8] = {0, 1,  0, -1, 1,  1, -1, -1};
+
 /* subframe_updateObject() flags */
 #define SUBFRAME_RECURSION 5
 /* surface_getBrushFlags() return vals */
@@ -2233,9 +2237,12 @@ static void 
dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const in
point[0] = ((float)tx + 0.5f) / w;
point[1] = ((float)ty + 0.5f) / h;
 
-   /* search through defined area for neighbor */
-   for (int u = u_min; u <= u_max; u++) {
-   for (int v = v_min; v <= v_max; v++) {
+   /* search through defined area for neighbor, checking 
grid directions first */
+   for (int ni = 0; ni < 8; ni++) {
+   int u = neighStraightX[ni];
+   int v = neighStraightY[ni];
+
+   if (u >= u_min && u <= u_max && v >= v_min && v 
<= v_max) {
/* if not this pixel itself */
if (u != 0 || v != 0) {
const int ind = (tx + u) + w * 
(ty + v);
@@ -2273,7 +2280,6 @@ static void 
dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const in
tPoint->v2 = 
mloop[mlooptri[i].tri[1]].v;
tPoint->v3 = 
mloop[mlooptri[i].tri[2]].v;
 
-   u = u_max + 1;  /* make 
sure we exit outer loop as well */
break;
}
}
@@ -2445,7 +2451,22 @@ static int dynamic_paint_find_neighbour_pixel(
((s_uv2[0] == t_uv1[0] && s_uv2[1] == t_uv1[1]) &&
 (s_uv1[0] == t_uv2[0] && s_uv1[1] == t_uv2[1])))
{
-   return ((px + neighX[n_index]) + w * (py + 
neighY[n_index]));
+   final_index = x + w * y;
+
+   /* If not an active pixel, bail out */
+   if (tempPoints[final_index].tri_index == -1)
+   return NOT_FOUND;
+
+   /* If final point is an "edge pixel", use it's "real" 
neighbor instead */
+   if (tempPoints[final_index].neighbour_pixel != -1) {
+   final_index = 
tempPoints[final_index].neighbour_pixel;
+
+   /* If we ended up to our origin point */
+   if (final_index == (px + w * py))
+   return NOT_FOUND;
+   }
+
+   return final_index;
}
 
/*
@@ -2467,8 +2488,8 @@ static int dynamic_paint_find_neighbour_pixel(
 
copy_v2_v2(pixel, 
mloopuv[mlooptri[target_tri].tri[target_uv1]].uv);
   

[Bf-blender-cvs] [bde5eb8] master: [Windows/MSVC] Blosc doesn't require debug libraries.

2016-09-27 Thread lazydodo
Commit: bde5eb8b6303d8d92b7c41d4a3f041bbb73c162d
Author: lazydodo
Date:   Tue Sep 27 10:24:09 2016 -0600
Branches: master
https://developer.blender.org/rBbde5eb8b6303d8d92b7c41d4a3f041bbb73c162d

[Windows/MSVC] Blosc doesn't require debug libraries.

===

M   build_files/cmake/platform/platform_win32_msvc.cmake

===

diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake 
b/build_files/cmake/platform/platform_win32_msvc.cmake
index 5efda52..961cada 100644
--- a/build_files/cmake/platform/platform_win32_msvc.cmake
+++ b/build_files/cmake/platform/platform_win32_msvc.cmake
@@ -414,7 +414,7 @@ if(WITH_OPENCOLORIO)
 endif()
 
 if(WITH_OPENVDB)
-   set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug 
${LIBDIR}/blosc/lib/libblosc_d.lib)
+   set(BLOSC_LIBRARIES ${LIBDIR}/blosc/lib/libblosc.lib )
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug 
${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(OPENVDB ${LIBDIR}/openvdb)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dd0de53] master: Fix T49466: Stupid typo in logicbricks new copy code from rB776a8548f03a

2016-09-27 Thread Bastien Montagne
Commit: dd0de53d29681987baca8ac1a9e1011c11402685
Author: Bastien Montagne
Date:   Tue Sep 27 17:55:12 2016 +0200
Branches: master
https://developer.blender.org/rBdd0de53d29681987baca8ac1a9e1011c11402685

Fix T49466: Stupid typo in logicbricks new copy code from rB776a8548f03a

Moved that code forth and back a few times while creating rB776a8548f03a fix,
ended up forgetting to update it correctly for function where it layed down in 
the end.

Last-minute fixes are never a good thing... Now we already have real reason for 
2.78 'a' release :(

===

M   source/blender/blenkernel/intern/sca.c

===

diff --git a/source/blender/blenkernel/intern/sca.c 
b/source/blender/blenkernel/intern/sca.c
index 61aa8c7..c7f4060 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -789,7 +789,7 @@ void BKE_sca_logic_copy(Object *ob_new, Object *ob)
copy_controllers(_new->controllers, >controllers);
copy_actuators(_new->actuators, >actuators);
 
-   for (bSensor *sens = ob->sensors.first; sens; sens = sens->next) {
+   for (bSensor *sens = ob_new->sensors.first; sens; sens = sens->next) {
if (sens->flag & SENS_NEW) {
for (int a = 0; a < sens->totlinks; a++) {
if (sens->links[a] && sens->links[a]->mynew) {
@@ -799,7 +799,7 @@ void BKE_sca_logic_copy(Object *ob_new, Object *ob)
}
}
 
-   for (bController *cont = ob->controllers.first; cont; cont = 
cont->next) {
+   for (bController *cont = ob_new->controllers.first; cont; cont = 
cont->next) {
if (cont->flag & CONT_NEW) {
for (int a = 0; a < cont->totlinks; a++) {
if (cont->links[a] && cont->links[a]->mynew) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b63e9a9] master: Fix T49423: Data Preview of group containing only group instances is empty.

2016-09-27 Thread Bastien Montagne
Commit: b63e9a96dfabc63500d821603ca500ccd69af9d1
Author: Bastien Montagne
Date:   Tue Sep 27 17:03:03 2016 +0200
Branches: master
https://developer.blender.org/rBb63e9a96dfabc63500d821603ca500ccd69af9d1

Fix T49423: Data Preview of group containing only group instances is empty.

Code was not getting correct boundbox in some cases (group only instancing 
other groups e.g.), now
compute our own bbox in those cases.

Based on patch by @lichtwerk, but extended the fix to include linked datablocks 
in some cases
(linked objects in local groups, linked objects in local scene, etc.), this was 
also broken in existing code.

Reviewers: mont29

Subscribers: duarteframos

Differential Revision: https://developer.blender.org/D2257

===

M   release/scripts/modules/bl_previews_utils/bl_previews_render.py

===

diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py 
b/release/scripts/modules/bl_previews_utils/bl_previews_render.py
index f731718..b4f0b8d 100644
--- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py
+++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py
@@ -236,8 +236,8 @@ def do_previews(do_objects, do_groups, do_scenes, 
do_data_intern):
 return success
 
 def objects_render_engine_guess(obs):
-for obname in obs:
-ob = bpy.data.objects[obname, None]
+for obname, libpath in obs:
+ob = bpy.data.objects[obname, libpath]
 for matslot in ob.material_slots:
 mat = matslot.material
 if mat and mat.use_nodes and mat.node_tree:
@@ -247,10 +247,20 @@ def do_previews(do_objects, do_groups, do_scenes, 
do_data_intern):
 return 'BLENDER_RENDER'
 
 def object_bbox_merge(bbox, ob, ob_space, offset_matrix):
-if ob.bound_box:
+# Take group instances into account (including linked one in this 
case).
+if ob.type == 'EMPTY' and ob.dupli_type == 'GROUP':
+grp_objects = tuple((ob.name, ob.library.filepath if ob.library 
else None) for ob in ob.dupli_group.objects)
+if (len(grp_objects) == 0):
+ob_bbox = ob.bound_box
+else:
+coords = objects_bbox_calc(ob_space, grp_objects,
+   
Matrix.Translation(ob.dupli_group.dupli_offset).inverted())
+ob_bbox = ((coords[0], coords[1], coords[2]), (coords[21], 
coords[22], coords[23]))
+elif ob.bound_box:
 ob_bbox = ob.bound_box
 else:
 ob_bbox = ((-ob.scale.x, -ob.scale.y, -ob.scale.z), (ob.scale.x, 
ob.scale.y, ob.scale.z))
+
 for v in ob_bbox:
 v = offset_matrix * Vector(v) if offset_matrix is not None else 
Vector(v)
 v = ob_space.matrix_world.inverted() * ob.matrix_world * v
@@ -269,8 +279,8 @@ def do_previews(do_objects, do_groups, do_scenes, 
do_data_intern):
 
 def objects_bbox_calc(camera, objects, offset_matrix):
 bbox = (Vector((1e9, 1e9, 1e9)), Vector((-1e9, -1e9, -1e9)))
-for obname in objects:
-ob = bpy.data.objects[obname, None]
+for obname, libpath in objects:
+ob = bpy.data.objects[obname, libpath]
 object_bbox_merge(bbox, ob, camera, offset_matrix)
 # Our bbox has been generated in camera local space, bring it back in 
world one
 bbox[0][:] = camera.matrix_world * bbox[0]
@@ -333,7 +343,7 @@ def do_previews(do_objects, do_groups, do_scenes, 
do_data_intern):
 continue
 if root.type not in OBJECT_TYPES_RENDER:
 continue
-objects = (root.name,)
+objects = ((root.name, None),)
 
 render_engine = objects_render_engine_guess(objects)
 render_context = render_contexts.get(render_engine, None)
@@ -344,8 +354,8 @@ def do_previews(do_objects, do_groups, do_scenes, 
do_data_intern):
 scene = bpy.data.scenes[render_context.scene, None]
 bpy.context.screen.scene = scene
 
-for obname in objects:
-ob = bpy.data.objects[obname, None]
+for obname, libpath in objects:
+ob = bpy.data.objects[obname, libpath]
 if obname not in scene.objects:
 scene.objects.link(ob)
 ob.hide_render = False
@@ -363,8 +373,8 @@ def do_previews(do_objects, do_groups, do_scenes, 
do_data_intern):
 # OverflowError: Python int too large to convert to C long
 #... :(
 scene = bpy.data.scenes[render_context.scene, None]
-for obname in objects:
-ob = bpy.data.objects[obname, None]
+for obname, libpath in objects:
+ob = bpy.data.objects[obname, libpath]
 scene.objects.unlink(ob)
 

[Bf-blender-cvs] [5d0de39] master: fix Mac build for Xcode < 8

2016-09-27 Thread Mike Erwin
Commit: 5d0de39238998da025ca2f6ee73b4c0fa0051c28
Author: Mike Erwin
Date:   Tue Sep 27 16:16:47 2016 +0200
Branches: master
https://developer.blender.org/rB5d0de39238998da025ca2f6ee73b4c0fa0051c28

fix Mac build for Xcode < 8

We need a long-term fix, but this will get 2.78 out the door.

===

M   intern/ghost/intern/GHOST_SystemCocoa.mm

===

diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm 
b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 880cb07..173f59c 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -283,7 +283,17 @@ extern "C" int GHOST_HACK_getFirstFile(char 
buf[FIRSTFILEBUFLG])
  * CocoaAppDelegate
  * ObjC object to capture applicationShouldTerminate, and send quit event
  **/
+#if defined(__clang_major__) && __clang_major__ <= 7
+/* FIXME(merwin & Juicyfruit): long-term fix for proper protocol to use
+ * merwin thinks NSApplicationDelegate is the correct protocol here. Has been 
around since 10.6 so we should be good... what's the problem?
+ * 
https://developer.apple.com/reference/appkit/nsapplicationdelegate?language=objc
+ */
+@interface CocoaAppDelegate : NSObject  {
+#else
+/* for Xcode 8 */
 @interface CocoaAppDelegate : NSObject  {
+#endif
+
GHOST_SystemCocoa *systemCocoa;
 }
 - (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2ebb367] master: cleanup: spacing & alignment

2016-09-27 Thread Mike Erwin
Commit: 2ebb367b0f3428b79c7517f22db9d03ac791501b
Author: Mike Erwin
Date:   Tue Sep 27 14:56:58 2016 +0200
Branches: master
https://developer.blender.org/rB2ebb367b0f3428b79c7517f22db9d03ac791501b

cleanup: spacing & alignment

===

M   intern/ghost/intern/GHOST_SystemCocoa.mm

===

diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm 
b/intern/ghost/intern/GHOST_SystemCocoa.mm
index f31cba4..880cb07 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -90,8 +90,7 @@ static GHOST_TButtonMask convertButton(int button)
  * \return Ghost key code
  */
 static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) 
-{  
-   
+{
//printf("\nrecvchar %c 0x%x",recvChar,recvChar);
switch (rawCode) {
/*Physical keycodes not used due to map changes in int'l 
keyboards
@@ -121,7 +120,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, 
UInt16 keyAction)
case kVK_ANSI_X:return GHOST_kKeyX;
case kVK_ANSI_Y:return GHOST_kKeyY;
case kVK_ANSI_Z:return GHOST_kKeyZ;*/
-   
+
/* Numbers keys mapped to handle some int'l keyboard (e.g. 
French)*/
case kVK_ISO_Section: returnGHOST_kKeyUnknown;
case kVK_ANSI_1:return GHOST_kKey1;
@@ -134,7 +133,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, 
UInt16 keyAction)
case kVK_ANSI_8:return GHOST_kKey8;
case kVK_ANSI_9:return GHOST_kKey9;
case kVK_ANSI_0:return GHOST_kKey0;
-   
+
case kVK_ANSI_Keypad0:  return 
GHOST_kKeyNumpad0;
case kVK_ANSI_Keypad1:  return 
GHOST_kKeyNumpad1;
case kVK_ANSI_Keypad2:  return 
GHOST_kKeyNumpad2;
@@ -173,24 +172,24 @@ static GHOST_TKey convertKey(int rawCode, unichar 
recvChar, UInt16 keyAction)
case kVK_F18:   return GHOST_kKeyF18;
case kVK_F19:   return GHOST_kKeyF19;
case kVK_F20:   return GHOST_kKeyF20;
-   
+
case kVK_UpArrow:   return 
GHOST_kKeyUpArrow;
case kVK_DownArrow: return 
GHOST_kKeyDownArrow;
case kVK_LeftArrow: return 
GHOST_kKeyLeftArrow;
case kVK_RightArrow:return GHOST_kKeyRightArrow;
-   
+
case kVK_Return:return GHOST_kKeyEnter;
case kVK_Delete:return 
GHOST_kKeyBackSpace;
case kVK_ForwardDelete: return GHOST_kKeyDelete;
case kVK_Escape:return GHOST_kKeyEsc;
case kVK_Tab:   return GHOST_kKeyTab;
case kVK_Space: return GHOST_kKeySpace;
-   
+
case kVK_Home:  return GHOST_kKeyHome;
case kVK_End:   return GHOST_kKeyEnd;
case kVK_PageUp:return GHOST_kKeyUpPage;
case kVK_PageDown:  return 
GHOST_kKeyDownPage;
-   
+
/*case kVK_ANSI_Minus:  return GHOST_kKeyMinus;
case kVK_ANSI_Equal:return GHOST_kKeyEqual;
case kVK_ANSI_Comma:return GHOST_kKeyComma;
@@ -202,12 +201,12 @@ static GHOST_TKey convertKey(int rawCode, unichar 
recvChar, UInt16 keyAction)
case kVK_ANSI_LeftBracket:  return GHOST_kKeyLeftBracket;
case kVK_ANSI_RightBracket: return GHOST_kKeyRightBracket;
case kVK_ANSI_Grave:return GHOST_kKeyAccentGrave;*/
-   
+
case kVK_VolumeUp:
case kVK_VolumeDown:
case kVK_Mute:
return GHOST_kKeyUnknown;
-   
+
default:
{
/* alphanumerical or punctuation key that is remappable 
in int'l keyboards */
@@ -221,11 +220,11 @@ static GHOST_TKey convertKey(int rawCode, unichar 
recvChar, UInt16 keyAction)
/* Leopard and Snow Leopard 64bit compatible 
API*/
CFDataRef uchrHandle; /*the keyboard layout*/
TISInputSourceRef kbdTISHandle;
-   
+
kbdTISHandle = 
TISCopyCurrentKeyboardLayoutInputSource();
 

[Bf-blender-cvs] [54ed22c] master: Fix T49461: Dynamic paint wetmap flickers.

2016-09-27 Thread Bastien Montagne
Commit: 54ed22c8433eaff4278ec9f1deb33976168cd265
Author: Bastien Montagne
Date:   Tue Sep 27 13:54:26 2016 +0200
Branches: master
https://developer.blender.org/rB54ed22c8433eaff4278ec9f1deb33976168cd265

Fix T49461: Dynamic paint wetmap flickers.

Regression from rBa4a968f, we would adjust current point's wetness without 
actually protecting it
in new multi-threaded context, leading to concurrent access mess.

Now delay applying wetness reduction to current point to end of function, 
allows us to avoid having
to lock current point twice together with neighbor one (and reducing spinlock 
awainting too).

To be backported to 2.78a.

===

M   source/blender/blenkernel/intern/dynamicpaint.c

===

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 2442572..51bc5fc 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -4779,6 +4779,8 @@ static void dynamic_paint_effect_drip_cb(void *userdata, 
const int index)
return;
CLAMP(w_factor, 0.0f, 1.0f);
 
+   float ppoint_wetness_diff = 0.0f;
+
/* get force affect points */
surface_determineForceTargetPoints(sData, index, [index * 4], 
closest_d, closest_id);
 
@@ -4800,9 +4802,9 @@ static void dynamic_paint_effect_drip_cb(void *userdata, 
const int index)
/* Sort of spinlock, but only for given ePoint.
 * Since the odds a same ePoint is modified at the same 
time by several threads is very low, this is
 * much more efficient than a global spin lock. */
-   const unsigned int pointlock_idx = n_trgt / 8;
-   const uint8_t pointlock_bitmask = 1 << (n_trgt & 7);  
/* 7 == 0b111 */
-   while 
(atomic_fetch_and_or_uint8(_locks[pointlock_idx], pointlock_bitmask) & 
pointlock_bitmask);
+   const unsigned int epointlock_idx = n_trgt / 8;
+   const uint8_t epointlock_bitmask = 1 << (n_trgt & 7);  
/* 7 == 0b111 */
+   while 
(atomic_fetch_and_or_uint8(_locks[epointlock_idx], epointlock_bitmask) & 
epointlock_bitmask);
 
PaintPoint *ePoint = &((PaintPoint 
*)sData->type_data)[n_trgt];
const float e_wet = ePoint->wetness;
@@ -4823,18 +4825,38 @@ static void dynamic_paint_effect_drip_cb(void 
*userdata, const int index)
CLAMP_MAX(ePoint->e_color[3], 
pPoint_prev->e_color[3]);
}
 
-   /* decrease paint wetness on current point */
-   pPoint->wetness -= (ePoint->wetness - e_wet);
-   CLAMP(pPoint->wetness, 0.0f, MAX_WETNESS);
+   /* Decrease paint wetness on current point
+* (just store diff here, that way we can only lock 
current point once at the end to apply it). */
+   ppoint_wetness_diff += (ePoint->wetness - e_wet);
 
 #ifndef NDEBUG
-   uint8_t ret = 
atomic_fetch_and_and_uint8(_locks[pointlock_idx], ~pointlock_bitmask);
-   BLI_assert(ret & pointlock_bitmask);
+   {
+   uint8_t ret = 
atomic_fetch_and_and_uint8(_locks[epointlock_idx], ~epointlock_bitmask);
+   BLI_assert(ret & epointlock_bitmask);
+   }
 #else
-   atomic_fetch_and_and_uint8(_locks[pointlock_idx], 
~pointlock_bitmask);
+   
atomic_fetch_and_and_uint8(_locks[epointlock_idx], ~epointlock_bitmask);
 #endif
}
}
+
+   {
+   const unsigned int ppointlock_idx = index / 8;
+   const uint8_t ppointlock_bitmask = 1 << (index & 7);  /* 7 == 
0b111 */
+   while (atomic_fetch_and_or_uint8(_locks[ppointlock_idx], 
ppointlock_bitmask) & ppointlock_bitmask);
+
+   pPoint->wetness -= ppoint_wetness_diff;
+   CLAMP(pPoint->wetness, 0.0f, MAX_WETNESS);
+
+#ifndef NDEBUG
+   {
+   uint8_t ret = 
atomic_fetch_and_and_uint8(_locks[ppointlock_idx], ~ppointlock_bitmask);
+   BLI_assert(ret & ppointlock_bitmask);
+   }
+#else
+   atomic_fetch_and_and_uint8(_locks[ppointlock_idx], 
~ppointlock_bitmask);
+#endif
+   }
 }
 
 static void dynamicPaint_doEffectStep(

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e6dda51] master: Fix T49464: Data Transfer modifier slows down redraw of window.

2016-09-27 Thread Bastien Montagne
Commit: e6dda514bae1aa53724ac59afc5c98177bbdbdba
Author: Bastien Montagne
Date:   Tue Sep 27 12:03:18 2016 +0200
Branches: master
https://developer.blender.org/rBe6dda514bae1aa53724ac59afc5c98177bbdbdba

Fix T49464: Data Transfer modifier slows down redraw of window.

Never call function that might recompute a DM in an RNA itemf callback (or any 
UI-related func in general)!
There was an XXX comment asking if this was OK - well, no, it was not. :P

Could be ported back to some 2.78 flavour should we need it.

===

M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 0b55c19..34ca6a1 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -932,17 +932,18 @@ static EnumPropertyItem 
*rna_DataTransferModifier_layers_select_src_itemf(bConte
CustomData *pdata;
int num_data, i;
 
-   /* XXX Is this OK? */
-   dm_src = mesh_get_derived_final(dtmd->modifier.scene, 
ob_src, CD_MASK_BAREMESH | CD_MTEXPOLY);
-   pdata = dm_src->getPolyDataLayout(dm_src);
-   num_data = CustomData_number_of_layers(pdata, 
CD_MTEXPOLY);
+   dm_src = object_get_derived_final(ob_src, false);
+   if (dm_src != NULL) {
+   pdata = dm_src->getPolyDataLayout(dm_src);
+   num_data = CustomData_number_of_layers(pdata, 
CD_MTEXPOLY);
 
-   RNA_enum_item_add_separator(, );
+   RNA_enum_item_add_separator(, );
 
-   for (i = 0; i < num_data; i++) {
-   tmp_item.value = i;
-   tmp_item.identifier = tmp_item.name = 
CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
-   RNA_enum_item_add(, , _item);
+   for (i = 0; i < num_data; i++) {
+   tmp_item.value = i;
+   tmp_item.identifier = tmp_item.name = 
CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
+   RNA_enum_item_add(, , 
_item);
+   }
}
}
}
@@ -954,17 +955,18 @@ static EnumPropertyItem 
*rna_DataTransferModifier_layers_select_src_itemf(bConte
CustomData *ldata;
int num_data, i;
 
-   /* XXX Is this OK? */
-   dm_src = mesh_get_derived_final(dtmd->modifier.scene, 
ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL);
-   ldata = dm_src->getLoopDataLayout(dm_src);
-   num_data = CustomData_number_of_layers(ldata, 
CD_MLOOPCOL);
+   dm_src = object_get_derived_final(ob_src, false);
+   if (dm_src != NULL) {
+   ldata = dm_src->getLoopDataLayout(dm_src);
+   num_data = CustomData_number_of_layers(ldata, 
CD_MLOOPCOL);
 
-   RNA_enum_item_add_separator(, );
+   RNA_enum_item_add_separator(, );
 
-   for (i = 0; i < num_data; i++) {
-   tmp_item.value = i;
-   tmp_item.identifier = tmp_item.name = 
CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
-   RNA_enum_item_add(, , _item);
+   for (i = 0; i < num_data; i++) {
+   tmp_item.value = i;
+   tmp_item.identifier = tmp_item.name = 
CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
+   RNA_enum_item_add(, , 
_item);
+   }
}
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3cd5eb5] cycles_disney_brdf: Fixed a bug in the Disney BSDF that caused specular reflections to be too bright and diffuse is now reacting to the roughness again

2016-09-27 Thread Pascal Schoen
Commit: 3cd5eb56cf5c9006837f111c8866e4c6e1c2a6fd
Author: Pascal Schoen
Date:   Fri Sep 16 08:47:56 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB3cd5eb56cf5c9006837f111c8866e4c6e1c2a6fd

Fixed a bug in the Disney BSDF that caused specular reflections to be too
bright and diffuse is now reacting to the roughness again

- A normalization for the fresnel was missing which caused the specular
  reflections to become too bright for the single-scatter GGX
- The roughness value for the diffuse BSSRDF part has always been
  overwritten and thus always 0
- Also the performance for refractive materials with roughness=0.0 has
  been improved

===

M   intern/cycles/kernel/closure/bsdf_disney_specular.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_reflection.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/osl/osl_closures.cpp
M   intern/cycles/kernel/osl/osl_closures.h
M   intern/cycles/kernel/svm/svm_closure.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_disney_specular.h 
b/intern/cycles/kernel/closure/bsdf_disney_specular.h
index 7e8139f..b83bb29 100644
--- a/intern/cycles/kernel/closure/bsdf_disney_specular.h
+++ b/intern/cycles/kernel/closure/bsdf_disney_specular.h
@@ -35,34 +35,39 @@
 
 CCL_NAMESPACE_BEGIN
 
+typedef ccl_addr_space struct DisneySpecularExtra {
+   float3 T, baseColor, cspec0;
+   bool alpha_x, alpha_y, rough_g, ior;
+} DisneySpecularExtra;
+
 typedef ccl_addr_space struct DisneySpecularBsdf {
SHADER_CLOSURE_BASE;
 
-   float specular, specularTint, roughness, metallic, anisotropic, 
alpha_x, alpha_y, rough_g;
-   float3 N, T;
-   float3 baseColor, cspec0;
+   float specular, specularTint, roughness, metallic, anisotropic;
+   float3 N;
+   DisneySpecularExtra *extra;
 } DisneySpecularBsdf;
 
 ccl_device int bsdf_disney_specular_setup(DisneySpecularBsdf *bsdf)
 {
-   float m_cdlum = 0.3f * bsdf->baseColor.x + 0.6f * bsdf->baseColor.y + 
0.1f * bsdf->baseColor.z; // luminance approx.
+   float m_cdlum = 0.3f * bsdf->extra->baseColor.x + 0.6f * 
bsdf->extra->baseColor.y + 0.1f * bsdf->extra->baseColor.z; // luminance approx.
 
-   float3 m_ctint = m_cdlum > 0.0f ? bsdf->baseColor / m_cdlum : 
make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
+   float3 m_ctint = m_cdlum > 0.0f ? bsdf->extra->baseColor / m_cdlum : 
make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
 
float3 tmp_col = make_float3(1.0f, 1.0f, 1.0f) * (1.0f - 
bsdf->specularTint) + m_ctint * bsdf->specularTint; // lerp(make_float3(1.0f, 
1.0f, 1.0f), m_ctint, sc->data2/*specularTint*/);
-   bsdf->cspec0 = (bsdf->specular * 0.08f * tmp_col) * (1.0f - 
bsdf->metallic) + bsdf->baseColor * bsdf->metallic; // 
lerp(sc->data1/*specular*/ * 0.08f * tmp_col, sc->color0/*baseColor*/, 
sc->data0/*metallic*/);
+   bsdf->extra->cspec0 = (bsdf->specular * 0.08f * tmp_col) * (1.0f - 
bsdf->metallic) + bsdf->extra->baseColor * bsdf->metallic; // 
lerp(sc->data1/*specular*/ * 0.08f * tmp_col, sc->color0/*baseColor*/, 
sc->data0/*metallic*/);
 
float aspect = safe_sqrtf(1.0f - bsdf->anisotropic * 0.9f);
float r2 = sqr(bsdf->roughness);

/* ax */
-   bsdf->alpha_x = fmaxf(0.001f, r2 / aspect);
+   bsdf->extra->alpha_x = fmaxf(0.001f, r2 / aspect);
 
/* ay */
-   bsdf->alpha_y = fmaxf(0.001f, r2 * aspect);
+   bsdf->extra->alpha_y = fmaxf(0.001f, r2 * aspect);
 
/* rough_g */
-   bsdf->rough_g = sqr(bsdf->roughness * 0.5f + 0.5f);
+   bsdf->extra->rough_g = sqr(bsdf->roughness * 0.5f + 0.5f);
 
 bsdf->type = CLOSURE_BSDF_DISNEY_SPECULAR_ID;
 return SD_BSDF|SD_BSDF_HAS_EVAL;
@@ -75,7 +80,7 @@ ccl_device float3 bsdf_disney_specular_eval_reflect(const 
ShaderClosure *sc, con
 
float3 N = bsdf->N;
 
-   if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f)
+   if (bsdf->extra->alpha_x*bsdf->extra->alpha_y <= 1e-7f)
return make_float3(0.0f, 0.0f, 0.0f);
 
float cosNO = dot(N, I);
@@ -84,10 +89,10 @@ ccl_device float3 bsdf_disney_specular_eval_reflect(const 
ShaderClosure *sc, con
if (cosNI > 0 && cosNO > 0) {
/* get half vector */
float3 m = normalize(omega_in + I);
-   float alpha2 = bsdf->alpha_x * bsdf->alpha_y;
+   float alpha2 = bsdf->extra->alpha_x * bsdf->extra->alpha_y;
float D, G1o, G1i;
 
-   if (bsdf->alpha_x == bsdf->alpha_y) {
+   if (bsdf->extra->alpha_x == bsdf->extra->alpha_y) {
/* isotropic
 * eq. 20: (F*G*D)/(4*in*on)
 * eq. 33: first we calculate D(m) */
@@ -104,12 +109,12 @@ ccl_device float3 

[Bf-blender-cvs] [7cb37d7] cycles_disney_brdf: Added selection field to the Disney BSDF node for switching between "Multiscatter GGX" and "GGX"

2016-09-27 Thread Pascal Schoen
Commit: 7cb37d711938e5626651db21f20da50edd96abaf
Author: Pascal Schoen
Date:   Thu Sep 8 12:24:43 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB7cb37d711938e5626651db21f20da50edd96abaf

Added selection field to the Disney BSDF node for switching between
"Multiscatter GGX" and "GGX"

In the "GGX" mode there is an additional parameter for changing the
refraction roughness for materials with smooth surfaces and rough interns
(e.g. honey). With the "Multiscatter GGX" this effect can't be produced at
the moment and so here will be no separation of the two roughness values.

===

M   intern/cycles/blender/blender_shader.cpp
M   intern/cycles/kernel/osl/osl_closures.cpp
M   intern/cycles/kernel/shaders/node_disney_bsdf.osl
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/graph.cpp
M   intern/cycles/render/nodes.cpp
M   intern/cycles/render/nodes.h
M   source/blender/editors/space_node/drawnode.c
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/shader/nodes/node_shader_bsdf_disney.c

===

diff --git a/intern/cycles/blender/blender_shader.cpp 
b/intern/cycles/blender/blender_shader.cpp
index 171b824..fc13fae 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -518,7 +518,17 @@ static ShaderNode *add_node(Scene *scene,
node = hair;
}
else if(b_node.is_a(_ShaderNodeBsdfDisney)) {
-   node = new DisneyBsdfNode();
+   BL::ShaderNodeBsdfDisney b_disney_node(b_node);
+   DisneyBsdfNode *disney = new DisneyBsdfNode();
+   switch (b_disney_node.distribution()) {
+   case BL::ShaderNodeBsdfDisney::distribution_GGX:
+   disney->distribution = 
CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
+   break;
+   case BL::ShaderNodeBsdfDisney::distribution_MULTI_GGX:
+   disney->distribution = 
CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
+   break;
+   }
+   node = disney;
 }
else if(b_node.is_a(_ShaderNodeBsdfTranslucent)) {
node = new TranslucentBsdfNode();
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp 
b/intern/cycles/kernel/osl/osl_closures.cpp
index 2e5e289..9711f91 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -830,7 +830,7 @@ public:
void setup(ShaderData *sd, int path_flag, float3 weight)
{
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
-   sd->flag |= (bsdf) ? 
bsdf_microfacet_multi_ggx_glass_setup(bsdf, false) : 0;
+   sd->flag |= (bsdf) ? 
bsdf_microfacet_multi_ggx_glass_setup(bsdf, true) : 0;
}
 };
 
diff --git a/intern/cycles/kernel/shaders/node_disney_bsdf.osl 
b/intern/cycles/kernel/shaders/node_disney_bsdf.osl
index 8296ce5..ceadcb7 100644
--- a/intern/cycles/kernel/shaders/node_disney_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_disney_bsdf.osl
@@ -18,6 +18,7 @@
 #include "node_fresnel.h"
 
 shader node_disney_bsdf(
+   string distribution = "Multiscatter GGX",
color BaseColor = color(0.6427, 0.41514809, 0.01698805),
color SubsurfaceColor = color(0.6427, 0.41514809, 0.01698805),
 float Metallic = 0.0,
@@ -41,7 +42,7 @@ shader node_disney_bsdf(
float f = max(IOR, 1e-5);
float eta = backfacing() ? 1.0 / f : f;
float cosNO = dot(Normal, I);
-   //float Fr = fresnel_dielectric_cos(cosNO, eta);
+   float Fr = fresnel_dielectric_cos(cosNO, eta);
 float diffuse_weight = (1.0 - clamp(Metallic, 0.0, 1.0)) * (1.0 - 
clamp(Transparency, 0.0, 1.0));
 float transp = clamp(Transparency, 0.0, 1.0) * (1.0 - clamp(Metallic, 0.0, 
1.0));
 float specular_weight = (1.0 - transp);
@@ -75,8 +76,12 @@ shader node_disney_bsdf(
 if (transp > 1e-5) {
 color Cspec0 = BaseColor * SpecularTint + color(1.0, 1.0, 1.0) * (1.0 
- SpecularTint);
 
-//BSDF = BaseColor * microfacet_multi_ggx_glass(Normal, Roughness, 
eta, BaseColor);
-BSDF = BSDF + transp * microfacet_multi_ggx_glass_fresnel(Normal, 
Roughness * Roughness, eta, BaseColor, Cspec0);
+if (distribution == "Multiscatter GGX") {
+BSDF = BSDF + transp * microfacet_multi_ggx_glass_fresnel(Normal, 
Roughness * Roughness, eta, BaseColor, Cspec0);
+} else {
+BSDF = BSDF + transp * (Fr * microfacet_ggx_fresnel(Normal, 
Roughness, eta, BaseColor, Cspec0) +
+   (1.0 - Fr) * 
microfacet_ggx_refraction_fresnel(Normal, Roughness, eta, 

[Bf-blender-cvs] [cdd29d06] cycles_disney_brdf: Merge branch 'master' into cycles_disney_brdf

2016-09-27 Thread Pascal Schoen
Commit: cdd29d06bb86672ed0779eefb8eee95796b8f939
Author: Pascal Schoen
Date:   Tue Sep 6 15:59:05 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rBcdd29d06bb86672ed0779eefb8eee95796b8f939

Merge branch 'master' into cycles_disney_brdf

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4d3a003] cycles_disney_brdf: Enhanced performance for Disney materials without subsurface scattering

2016-09-27 Thread Pascal Schoen
Commit: 4d3a0032ecea99031979f342bfd5f66ea5a8625a
Author: Pascal Schoen
Date:   Mon Sep 26 12:35:36 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB4d3a0032ecea99031979f342bfd5f66ea5a8625a

Enhanced performance for Disney materials without subsurface scattering

===

M   intern/cycles/kernel/svm/svm_closure.h

===

diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index d3ed0bd..8aca266 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -149,7 +149,25 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
if (path_flag & PATH_RAY_DIFFUSE_ANCESTOR)
subsurface = 0.0f;
 
-   if (subsurf_sample_weight > CLOSURE_WEIGHT_CUTOFF) {
+   if (subsurface < CLOSURE_WEIGHT_CUTOFF) {
+   /* diffuse */
+   if (diffuse_weight > CLOSURE_WEIGHT_CUTOFF && 
fabsf(average(baseColor)) > CLOSURE_WEIGHT_CUTOFF) {
+   float3 diff_weight = weight * 
diffuse_weight;
+   float diff_sample_weight = 
fabsf(average(diff_weight));
+
+   DisneyDiffuseBsdf *bsdf = 
(DisneyDiffuseBsdf*)bsdf_alloc(sd, sizeof(DisneyDiffuseBsdf), diff_weight);
+
+   if (bsdf) {
+   bsdf->N = N;
+   bsdf->baseColor = baseColor;
+   bsdf->roughness = roughness;
+
+   /* setup bsdf */
+   ccl_fetch(sd, flag) |= 
bsdf_disney_diffuse_setup(bsdf);
+   }
+   }
+   }
+   else if (subsurf_sample_weight > CLOSURE_WEIGHT_CUTOFF) 
{
/* radius * scale */
float3 radius = make_float3(1.0f, 1.0f, 1.0f) * 
subsurface;
/* sharpness */
@@ -239,7 +257,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
 #ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_reflective || 
(path_flag & PATH_RAY_DIFFUSE) == 0) {
 #endif
-   if (specular > CLOSURE_WEIGHT_CUTOFF || 
metallic > CLOSURE_WEIGHT_CUTOFF) {
+   if (specular_weight > CLOSURE_WEIGHT_CUTOFF && 
(specular > CLOSURE_WEIGHT_CUTOFF || metallic > CLOSURE_WEIGHT_CUTOFF)) {
float3 spec_weight = weight * 
specular_weight/* * (specular * (1.0f - metallic) + metallic)*/;
 
MicrofacetBsdf *bsdf = 
(MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), spec_weight);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3f4fc82] cycles_disney_brdf: Unified the OSL implementation of the Disney clearcoat as a simple microfacet shader like it was previously done in SVM

2016-09-27 Thread Pascal Schoen
Commit: 3f4fc826bd9c1f47c694c0f6b2947daf5b524b1a
Author: Pascal Schoen
Date:   Tue Sep 27 08:36:07 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB3f4fc826bd9c1f47c694c0f6b2947daf5b524b1a

Unified the OSL implementation of the Disney clearcoat as a simple
microfacet shader like it was previously done in SVM

===

M   intern/cycles/kernel/osl/osl_closures.cpp
M   intern/cycles/kernel/shaders/node_disney_bsdf.osl

===

diff --git a/intern/cycles/kernel/osl/osl_closures.cpp 
b/intern/cycles/kernel/osl/osl_closures.cpp
index 4418da3..8f22218 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -192,190 +192,27 @@ BSDF_CLOSURE_CLASS_BEGIN(DisneySheen, disney_sheen, 
DisneySheenBsdf, LABEL_DIFFU
CLOSURE_FLOAT_PARAM(DisneySheenClosure, params.sheenTint),
 BSDF_CLOSURE_CLASS_END(DisneySheen, disney_sheen)
 
-/*BSDF_CLOSURE_CLASS_BEGIN(DisneySpecular, disney_specular, 
DisneySpecularBsdf, LABEL_GLOSSY | LABEL_REFLECT)
-   CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, params.N),
-   CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, params.T),
-   CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, params.extra->baseColor),
-   CLOSURE_FLOAT_PARAM(DisneySpecularClosure, params.metallic),
-   CLOSURE_FLOAT_PARAM(DisneySpecularClosure, params.specular),
-   CLOSURE_FLOAT_PARAM(DisneySpecularClosure, params.specularTint),
-   CLOSURE_FLOAT_PARAM(DisneySpecularClosure, params.roughness),
-   CLOSURE_FLOAT_PARAM(DisneySpecularClosure, params.anisotropic),
-BSDF_CLOSURE_CLASS_END(DisneySpecular, disney_specular)*/
-
-BSDF_CLOSURE_CLASS_BEGIN(DisneyClearcoat, disney_clearcoat, 
DisneyClearcoatBsdf, LABEL_GLOSSY|LABEL_REFLECT)
-   CLOSURE_FLOAT3_PARAM(DisneyClearcoatClosure, params.N),
-   CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, params.clearcoat),
-   CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, params.clearcoatGloss),
-BSDF_CLOSURE_CLASS_END(DisneyClearcoat, disney_clearcoat)
-
 /* DISNEY CLEARCOAT */
-/*class DisneyClearcoatClosure : public CBSDFClosure {
-public:
-   DisneyClearcoatClosure() : CBSDFClosure(LABEL_REFLECT | LABEL_GLOSSY)
-   {}
-
-   void setup()
-   {
-   sc.prim = this;
-   m_shaderdata_flag = bsdf_disney_clearcoat_setup();
-   }
-
-   void blur(float roughness)
-   {
-   }
-
-   float3 eval_reflect(const float3 _out, const float3 _in, 
float& pdf) const
-   {
-   return bsdf_disney_clearcoat_eval_reflect(, omega_out, 
omega_in, );
-   }
-
-   float3 eval_transmit(const float3 _out, const float3 _in, 
float& pdf) const
-   {
-   return bsdf_disney_clearcoat_eval_transmit(, omega_out, 
omega_in, );
-   }
-
-   int sample(const float3 ,
-   const float3 _out, const float3 _out_dx, const 
float3 _out_dy,
-   float randu, float randv,
-   float3 _in, float3 _in_dx, float3 _in_dy,
-   float , float3 ) const
-   {
-   return bsdf_disney_clearcoat_sample(, Ng, omega_out, 
domega_out_dx, domega_out_dy,
-   randu, randv, , _in, _in_dx, 
_in_dy, );
-   }
-};
-
-ClosureParam *bsdf_disney_clearcoat_params()
-{
-   static ClosureParam params[] = {
-   CLOSURE_FLOAT3_PARAM(DisneyClearcoatClosure, sc.N),
-   CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, sc.data0), // 
clearcoat
-   CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, sc.data1), // 
clearcoatGloss
-   CLOSURE_STRING_KEYPARAM(DisneyClearcoatClosure, label, "label"),
-   CLOSURE_FINISH_PARAM(DisneyClearcoatClosure)
-   };
-   return params;
-}
-
-CCLOSURE_PREPARE(bsdf_disney_clearcoat_prepare, DisneyClearcoatClosure)
-*/
-
-/* DISNEY DIFFUSE */
-/*class DisneyDiffuseClosure : public CBSDFClosure {
-public:
-   DisneyDiffuseClosure() : CBSDFClosure(LABEL_DIFFUSE)
-   {}
-
-   void setup()
-   {
-   sc.prim = this;
-   m_shaderdata_flag = bsdf_disney_diffuse_setup();
-   }
-
-   void blur(float roughness)
-   {
-   }
-
-   float3 eval_reflect(const float3 _out, const float3 _in, 
float& pdf) const
-   {
-   return bsdf_disney_diffuse_eval_reflect(, omega_out, 
omega_in, );
-   }
-
-   float3 eval_transmit(const float3 _out, const float3 _in, 
float& pdf) const
-   {
-   return bsdf_disney_diffuse_eval_transmit(, omega_out, 
omega_in, );
-   }
-
-   int sample(const float3 , const float3 _out, const float3 
_out_dx,
-   const float3 _out_dy, float randu, float randv, float3 
_in,
-   float3 _in_dx, float3 _in_dy, float , float3 
) const
-   {
-   return bsdf_disney_diffuse_sample(, Ng, omega_out, 
domega_out_dx, 

[Bf-blender-cvs] [e1fa862] cycles_disney_brdf: Merge branch 'master' into cycles_disney_brdf

2016-09-27 Thread Pascal Schoen
Commit: e1fa8623915407cea942a07fd0a106b04e113c09
Author: Pascal Schoen
Date:   Tue Sep 27 08:59:32 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rBe1fa8623915407cea942a07fd0a106b04e113c09

Merge branch 'master' into cycles_disney_brdf

===



===

diff --cc intern/cycles/kernel/closure/bsdf_microfacet_multi.h
index 25c635c,0a6dd4d..d271162
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
@@@ -433,7 -436,7 +447,7 @@@ ccl_device int bsdf_microfacet_multi_gg
  
  /* Multiscattering GGX Glass closure */
  
- ccl_device int bsdf_microfacet_multi_ggx_glass_setup(MicrofacetBsdf *bsdf, 
bool use_fresnel = false, bool initial_outside = true, bool only_refractions = 
false, bool only_reflections = false)
 -ccl_device int bsdf_microfacet_multi_ggx_glass_setup(MicrofacetBsdf *bsdf)
++ccl_device int bsdf_microfacet_multi_ggx_glass_setup(MicrofacetBsdf *bsdf, 
bool use_fresnel = false, bool initial_outside = true)
  {
bsdf->alpha_x = clamp(bsdf->alpha_x, 1e-4f, 1.0f);
bsdf->alpha_y = bsdf->alpha_x;
@@@ -441,13 -444,6 +455,11 @@@
bsdf->extra->color.x = saturate(bsdf->extra->color.x);
bsdf->extra->color.y = saturate(bsdf->extra->color.y);
bsdf->extra->color.z = saturate(bsdf->extra->color.z);
 +  bsdf->extra->use_fresnel = use_fresnel;
 +  bsdf->extra->cspec0.x = saturate(bsdf->extra->cspec0.x);
 +  bsdf->extra->cspec0.y = saturate(bsdf->extra->cspec0.y);
 +  bsdf->extra->cspec0.z = saturate(bsdf->extra->cspec0.z);
 +  bsdf->extra->initial_outside = initial_outside;
-   bsdf->extra->only_refractions = only_refractions;
-   bsdf->extra->only_reflections = only_reflections;
  
bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
  
@@@ -498,7 -530,7 +546,7 @@@ ccl_device int bsdf_microfacet_multi_gg
float3 localI = make_float3(dot(I, X), dot(I, Y), dot(I, Z));
float3 localO;
  
-   *eval = mf_sample_glass(localI, , bsdf->extra->color, 
bsdf->extra->cspec0, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, 
bsdf->extra->use_fresnel, bsdf->extra->initial_outside, 
bsdf->extra->only_refractions, bsdf->extra->only_reflections);
 -  *eval = mf_sample_glass(localI, , bsdf->extra->color, 
bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior);
++  *eval = mf_sample_glass(localI, , bsdf->extra->color, 
bsdf->extra->cspec0, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, 
bsdf->extra->use_fresnel, bsdf->extra->initial_outside);
*pdf = mf_glass_pdf(localI, localO, bsdf->alpha_x, bsdf->ior);
*eval *= *pdf;
  
diff --cc intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
index e0c,6ebe2f6..97af724
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
@@@ -246,17 -168,11 +246,15 @@@ ccl_device_inline float3 MF_FUNCTION_FU
   * escaped the surface in wo. The function returns the throughput between wi 
and wo.
   * Without reflection losses due to coloring or fresnel absorption in 
conductors, the sampling is optimal.
   */
 -ccl_device float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 wi, float3 *wo, 
const float3 color, const float alpha_x, const float alpha_y, ccl_addr_space 
uint *lcg_state
 +ccl_device float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 wi, float3 *wo, 
const float3 color, const float3 cspec0, const float alpha_x, const float 
alpha_y, ccl_addr_space uint *lcg_state
  #ifdef MF_MULTI_GLASS
, const float eta
 +  , bool use_fresnel = false
 +  , bool initial_outside = true
-   , bool only_refractions = false
-   , bool only_reflections = false
  #elif defined(MF_MULTI_GLOSSY)
, float3 *n, float3 *k
 +  , const float eta = 1.0f
 +  , bool use_fresnel = false
  #endif
  )
  {
@@@ -294,17 -191,7 +292,11 @@@
/* Sample microfacet height. */
if(!mf_sample_height(wr, , _r, _r, _r, 
lcg_step_float_addrspace(lcg_state))) {
/* The random walk has left the surface. */
- #ifdef MF_MULTI_GLASS
-   if ((only_refractions && outside/* && 
initial_outside*/) || (only_reflections && !outside)) {
-   *wo = make_float3(0.0f, 0.0f, 1.0f);
-   return make_float3(0.0f, 0.0f, 0.0f);
-   }
- #endif
*wo = outside? wr: -wr;
 +#if defined(MF_MULTI_GLASS) || defined(MF_MULTI_GLOSSY)
 +  if (use_fresnel)
 +  return throughput2;
 +#endif
return throughput;
}
/* Sample microfacet normal. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org

[Bf-blender-cvs] [2a5ac50] cycles_disney_brdf: Fixed a bug that caused transparency to be always white when using OSL and selecting GGX as distribution of the Disney BSDF

2016-09-27 Thread Pascal Schoen
Commit: 2a5ac509223c838285a00c4c12775567666e7154
Author: Pascal Schoen
Date:   Tue Sep 27 09:17:57 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB2a5ac509223c838285a00c4c12775567666e7154

Fixed a bug that caused transparency to be always white when using OSL and
selecting GGX as distribution of the Disney BSDF

===

M   intern/cycles/kernel/shaders/node_disney_bsdf.osl

===

diff --git a/intern/cycles/kernel/shaders/node_disney_bsdf.osl 
b/intern/cycles/kernel/shaders/node_disney_bsdf.osl
index cc6c63f..5372948 100644
--- a/intern/cycles/kernel/shaders/node_disney_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_disney_bsdf.osl
@@ -88,8 +88,8 @@ shader node_disney_bsdf(
 float cosNO = dot(Normal, I);
 float Fr = fresnel_dielectric_cos(cosNO, eta);
 
-BSDF = BSDF + transp * (Fr * microfacet_ggx_fresnel(Normal, 
Roughness, eta, BaseColor, Cspec0) +
-   (1.0 - Fr) * microfacet_ggx_refraction(Normal, 
Roughness, eta));
+BSDF = BSDF + transp * (Fr * microfacet_ggx_fresnel(Normal, 
Roughness * Roughness, eta, BaseColor, Cspec0) +
+   (1.0 - Fr) * BaseColor * 
microfacet_ggx_refraction(Normal, Roughness * Roughness, eta));
 }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d0530a8] cycles_disney_brdf: Cleanup the Disney BSDF implementation and removing unneeded files.

2016-09-27 Thread Pascal Schoen
Commit: d0530a8af0e076c0aca4c9a61b0a64cada45ac4d
Author: Pascal Schoen
Date:   Tue Sep 27 08:53:18 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rBd0530a8af0e076c0aca4c9a61b0a64cada45ac4d

Cleanup the Disney BSDF implementation and removing unneeded files.

===

M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/closure/bsdf.h
D   intern/cycles/kernel/closure/bsdf_disney_clearcoat.h
D   intern/cycles/kernel/closure/bsdf_disney_specular.h
D   intern/cycles/kernel/osl/bsdf_disney_clearcoat.cpp
D   intern/cycles/kernel/osl/bsdf_disney_diffuse.cpp
D   intern/cycles/kernel/osl/bsdf_disney_specular.cpp
M   intern/cycles/kernel/osl/osl_closures.cpp
M   intern/cycles/kernel/osl/osl_closures.h
M   intern/cycles/kernel/shaders/stdosl.h

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 80c732b..a0e2b28 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -109,8 +109,6 @@ set(SRC_CLOSURE_HEADERS
closure/volume.h
 closure/bsdf_disney_diffuse.h
 closure/bsdf_disney_sheen.h
-closure/bsdf_disney_specular.h
-closure/bsdf_disney_clearcoat.h
 )
 
 set(SRC_SVM_HEADERS
diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index ac4f528..97bdf9c 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -29,8 +29,6 @@
 #include "../closure/bsdf_hair.h"
 #include "../closure/bsdf_disney_diffuse.h"
 #include "../closure/bsdf_disney_sheen.h"
-#include "../closure/bsdf_disney_specular.h"
-#include "../closure/bsdf_disney_clearcoat.h"
 #ifdef __SUBSURFACE__
 #  include "../closure/bssrdf.h"
 #endif
@@ -144,14 +142,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
label = bsdf_disney_sheen_sample(sc, ccl_fetch(sd, Ng), 
ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
eval, omega_in, _in->dx, _in->dy, 
pdf);
break;
-   /*case CLOSURE_BSDF_DISNEY_SPECULAR_ID:
-   label = bsdf_disney_specular_sample(sc, ccl_fetch(sd, 
Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
-   eval, omega_in, _in->dx, _in->dy, 
pdf);
-   break;*/
-   case CLOSURE_BSDF_DISNEY_CLEARCOAT_ID:
-   label = bsdf_disney_clearcoat_sample(sc, ccl_fetch(sd, 
Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
-   eval, omega_in, _in->dx, _in->dy, 
pdf);
-   break;
 #endif
 #ifdef __VOLUME__
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
@@ -251,12 +241,6 @@ float3 bsdf_eval(KernelGlobals *kg,
case CLOSURE_BSDF_DISNEY_SHEEN_ID:
eval = bsdf_disney_sheen_eval_reflect(sc, 
ccl_fetch(sd, I), omega_in, pdf);
break;
-   /*case CLOSURE_BSDF_DISNEY_SPECULAR_ID:
-   eval = bsdf_disney_specular_eval_reflect(sc, 
ccl_fetch(sd, I), omega_in, pdf);
-   break;*/
-   case CLOSURE_BSDF_DISNEY_CLEARCOAT_ID:
-   eval = bsdf_disney_clearcoat_eval_reflect(sc, 
ccl_fetch(sd, I), omega_in, pdf);
-   break;
 #endif
 #ifdef __VOLUME__
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
@@ -333,12 +317,6 @@ float3 bsdf_eval(KernelGlobals *kg,
case CLOSURE_BSDF_DISNEY_SHEEN_ID:
eval = bsdf_disney_sheen_eval_transmit(sc, 
ccl_fetch(sd, I), omega_in, pdf);
break;
-   /*case CLOSURE_BSDF_DISNEY_SPECULAR_ID:
-   eval = bsdf_disney_specular_eval_transmit(sc, 
ccl_fetch(sd, I), omega_in, pdf);
-   break;*/
-   case CLOSURE_BSDF_DISNEY_CLEARCOAT_ID:
-   eval = bsdf_disney_clearcoat_eval_transmit(sc, 
ccl_fetch(sd, I), omega_in, pdf);
-   break;
 #endif
 #ifdef __VOLUME__
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
diff --git a/intern/cycles/kernel/closure/bsdf_disney_clearcoat.h 
b/intern/cycles/kernel/closure/bsdf_disney_clearcoat.h
deleted file mode 100644
index cdb8b3e..000
--- a/intern/cycles/kernel/closure/bsdf_disney_clearcoat.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender 

[Bf-blender-cvs] [630b80e] cycles_disney_brdf: Fresnel in the microfacet multiscatter implementation improved

2016-09-27 Thread Pascal Schoen
Commit: 630b80e08b6acf83834bc95264af4ccdbbc5f82c
Author: Pascal Schoen
Date:   Fri Sep 2 10:52:13 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB630b80e08b6acf83834bc95264af4ccdbbc5f82c

Fresnel in the microfacet multiscatter implementation improved

===

M   intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h 
b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
index 0412046..e0c 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
@@ -88,7 +88,7 @@ ccl_device_inline float3 MF_FUNCTION_FULL_NAME(mf_eval)(
float3 throughput2 = make_float3(1.0f, 1.0f, 1.0f);
float F0 = fresnel_dielectric_cos(1.0f, eta);
float F0_norm = 1.0f / (1.0f - F0);
-   if (use_fresnel && initial_outside) {
+   if (use_fresnel/* && initial_outside*/) {
float FH = (fresnel_dielectric_cos(dot(wi, normalize(wi + wo)), 
eta) - F0) * F0_norm; //schlick_fresnel(dot(wi, normalize(wi + wo))); //
throughput2 = cspec0 * (1.0f - FH) + make_float3(1.0f, 1.0f, 
1.0f) * FH;
 
@@ -167,7 +167,7 @@ ccl_device_inline float3 MF_FUNCTION_FULL_NAME(mf_eval)(
else
phase = mf_eval_phase_glass(wr, lambda_r, -wo, 
!wo_outside, alpha, 1.0f/eta);
 
-   if (use_fresnel && initial_outside)
+   if (use_fresnel/* && initial_outside*/)
eval2 += throughput2 * phase * mf_G1(wo_outside 
? wo : -wo, mf_C1((outside == wo_outside) ? hr : -hr), shadowing_lambda);
 #elif defined(MF_MULTI_DIFFUSE)
phase = mf_eval_phase_diffuse(wo, wm);
@@ -191,16 +191,16 @@ ccl_device_inline float3 MF_FUNCTION_FULL_NAME(mf_eval)(
hr = -hr;
}
 
-   if (use_fresnel && initial_outside && outside && 
next_outside) {
+   if (use_fresnel && !next_outside) {
+   throughput2 *= color;
+   }
+   else if (use_fresnel/* && initial_outside && outside && 
next_outside*/) {
float FH = (fresnel_dielectric_cos(dot(wi_prev, 
wm), eta) - F0) * F0_norm; //schlick_fresnel(dot(wi_prev, wm)); //
t_color = cspec0 * (1.0f - FH) + 
make_float3(1.0f, 1.0f, 1.0f) * FH;
 
if (order > 0)
throughput2 *= t_color;
}
-   else {
-   throughput2 *= color;
-   }
 #elif defined(MF_MULTI_DIFFUSE)
wr = mf_sample_phase_diffuse(wm,
 
lcg_step_float_addrspace(lcg_state),
@@ -274,7 +274,7 @@ ccl_device float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 
wi, float3 *wo, const
float3 throughput2 = make_float3(1.0f, 1.0f, 1.0f);
float F0 = fresnel_dielectric_cos(1.0f, eta);
float F0_norm = 1.0f / (1.0f - F0);
-   if (use_fresnel && initial_outside) {
+   if (use_fresnel/* && initial_outside*/) {
float FH = (fresnel_dielectric_cos(dot(wi, normalize(wi + wr)), 
eta) - F0) * F0_norm; //schlick_fresnel(dot(wi, normalize(wi + wr))); //
throughput2 = cspec0 * (1.0f - FH) + make_float3(1.0f, 1.0f, 
1.0f) * FH;
}
@@ -295,7 +295,7 @@ ccl_device float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 
wi, float3 *wo, const
if(!mf_sample_height(wr, , _r, _r, _r, 
lcg_step_float_addrspace(lcg_state))) {
/* The random walk has left the surface. */
 #ifdef MF_MULTI_GLASS
-   if ((only_refractions && outside && initial_outside) || 
(only_reflections && !outside)) {
+   if ((only_refractions && outside/* && 
initial_outside*/) || (only_reflections && !outside)) {
*wo = make_float3(0.0f, 0.0f, 1.0f);
return make_float3(0.0f, 0.0f, 0.0f);
}
@@ -327,7 +327,10 @@ ccl_device float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 
wi, float3 *wo, const
}
 
if (use_fresnel) {
-   if (initial_outside && outside && next_outside) {
+   if (!next_outside) {
+   throughput2 *= color;
+   }
+   else if (/*initial_outside && outside && 
next_outside*/true) {
float FH = (fresnel_dielectric_cos(dot(wi_prev, 
wm), eta) - F0) * F0_norm; //schlick_fresnel(dot(wi_prev, wm)); //

[Bf-blender-cvs] [02c315a] cycles_disney_brdf: Implemented the OSL part of the Disney shader

2016-09-27 Thread Pascal Schoen
Commit: 02c315aeb0f0d7bb429d4396912e03dbb8a77340
Author: Pascal Schoen
Date:   Tue Sep 6 15:16:09 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB02c315aeb0f0d7bb429d4396912e03dbb8a77340

Implemented the OSL part of the Disney shader

===

M   intern/cycles/kernel/closure/bsdf_disney_sheen.h
M   intern/cycles/kernel/osl/osl_bssrdf.cpp
M   intern/cycles/kernel/osl/osl_closures.cpp
M   intern/cycles/kernel/osl/osl_closures.h
M   intern/cycles/kernel/shaders/node_disney_bsdf.osl
M   intern/cycles/kernel/shaders/stdosl.h
M   source/blender/gpu/shaders/gpu_shader_material.glsl

===

diff --git a/intern/cycles/kernel/closure/bsdf_disney_sheen.h 
b/intern/cycles/kernel/closure/bsdf_disney_sheen.h
index 478ecab..9e25794 100644
--- a/intern/cycles/kernel/closure/bsdf_disney_sheen.h
+++ b/intern/cycles/kernel/closure/bsdf_disney_sheen.h
@@ -133,7 +133,7 @@ ccl_device int bsdf_disney_sheen_sample(const ShaderClosure 
*sc,
else {
*pdf = 0;
}
-   return LABEL_DIFFUSE;
+   return LABEL_REFLECT|LABEL_DIFFUSE;
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_bssrdf.cpp 
b/intern/cycles/kernel/osl/osl_bssrdf.cpp
index b76f2b4..3f944c4 100644
--- a/intern/cycles/kernel/osl/osl_bssrdf.cpp
+++ b/intern/cycles/kernel/osl/osl_bssrdf.cpp
@@ -80,6 +80,8 @@ public:
bssrdf->albedo = albedo.x;
bssrdf->sharpness = sharpness;
bssrdf->N = params.N;
+   bssrdf->baseColor = params.baseColor;
+   bssrdf->roughness = params.roughness;
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, 
(ClosureType)type);
}
 
@@ -91,6 +93,8 @@ public:
bssrdf->albedo = albedo.y;
bssrdf->sharpness = sharpness;
bssrdf->N = params.N;
+   bssrdf->baseColor = params.baseColor;
+   bssrdf->roughness = params.roughness;
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, 
(ClosureType)type);
}
 
@@ -102,6 +106,8 @@ public:
bssrdf->albedo = albedo.z;
bssrdf->sharpness = sharpness;
bssrdf->N = params.N;
+   bssrdf->baseColor = params.baseColor;
+   bssrdf->roughness = params.roughness;
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, 
(ClosureType)type);
}
}
@@ -182,5 +188,32 @@ ClosureParam *closure_bssrdf_burley_params()
 
 CCLOSURE_PREPARE(closure_bssrdf_burley_prepare, BurleyBSSRDFClosure)
 
+/* Disney */
+
+class DisneyBSSRDFClosure : public CBSSRDFClosure {
+public:
+   void setup(ShaderData *sd, int path_flag, float3 weight)
+   {
+   alloc(sd, path_flag, weight, CLOSURE_BSSRDF_DISNEY_ID);
+   }
+};
+
+ClosureParam *closure_bssrdf_disney_params()
+{
+   static ClosureParam params[] = {
+   CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, params.N),
+   CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, radius),
+   CLOSURE_FLOAT_PARAM(DisneyBSSRDFClosure, params.texture_blur),
+   CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, params.baseColor),
+   CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, albedo),
+   CLOSURE_FLOAT_PARAM(DisneyBSSRDFClosure, params.roughness),
+   CLOSURE_STRING_KEYPARAM(DisneyBSSRDFClosure, label, "label"),
+   CLOSURE_FINISH_PARAM(DisneyBSSRDFClosure)
+   };
+   return params;
+}
+
+CCLOSURE_PREPARE(closure_bssrdf_disney_prepare, DisneyBSSRDFClosure)
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp 
b/intern/cycles/kernel/osl/osl_closures.cpp
index 2c7772f..2e5e289 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -187,6 +187,7 @@ BSDF_CLOSURE_CLASS_END(DisneyDiffuse, disney_diffuse)
 
 BSDF_CLOSURE_CLASS_BEGIN(DisneySheen, disney_sheen, DisneySheenBsdf, 
LABEL_DIFFUSE)
CLOSURE_FLOAT3_PARAM(DisneySheenClosure, params.N),
+   CLOSURE_FLOAT3_PARAM(DisneySheenClosure, params.baseColor),
CLOSURE_FLOAT_PARAM(DisneySheenClosure, params.sheen),
CLOSURE_FLOAT_PARAM(DisneySheenClosure, params.sheenTint),
 BSDF_CLOSURE_CLASS_END(DisneySheen, disney_sheen)
@@ -455,6 +456,18 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
closure_bsdf_microfacet_multi_ggx_glass_params(), 
closure_bsdf_microfacet_multi_ggx_glass_prepare);
register_closure(ss, 

[Bf-blender-cvs] [0d9f4d7] cycles_disney_brdf: Fixed refraction roughness problem (refractions were always 100% rough) and set IOR of clearcoat to 1.5

2016-09-27 Thread Pascal Schoen
Commit: 0d9f4d7acb2de65d1c98d425cea4bf364795c155
Author: Pascal Schoen
Date:   Fri Aug 26 11:11:05 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB0d9f4d7acb2de65d1c98d425cea4bf364795c155

Fixed refraction roughness problem (refractions were always 100% rough)
and set IOR of clearcoat to 1.5

===

M   intern/cycles/kernel/svm/svm_closure.h

===

diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index d658ed2..c2d13aa 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -100,7 +100,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
float clearcoatGloss = stack_load_float(stack, 
clearcoatGloss_offset);
float transparency = stack_load_float(stack, 
transparency_offset);
float anisotropic_rotation = stack_load_float(stack, 
anisotropic_rotation_offset);
-   float refraction_roughness = 1.0f; // TODO: add 
parameter for this!
+   float refraction_roughness = 0.0f; // TODO: add 
parameter for this!
float eta = fmaxf(stack_load_float(stack, eta_offset), 
1e-5f);
 
/* rotate tangent */
@@ -366,7 +366,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
 
if (bsdf && extra) {
bsdf->N = CN;
-   bsdf->ior = 0.0f;
+   bsdf->ior = 1.5f;
bsdf->extra = extra;
 
bsdf->alpha_x = 0.1f * (1.0f - 
clearcoatGloss) + 0.001f * clearcoatGloss;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5f88029] cycles_disney_brdf: Merge branch 'master' into cycles_disney_brdf

2016-09-27 Thread Pascal Schoen
Commit: 5f880293aeeacf269032824248b46d613691a36c
Author: Pascal Schoen
Date:   Fri Sep 2 10:53:36 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB5f880293aeeacf269032824248b46d613691a36c

Merge branch 'master' into cycles_disney_brdf

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [da0f94d] experimental-build: Squashed commit of the following:

2016-09-27 Thread Pascal Schoen
Commit: da0f94d4c814358e3851e981a2e5c0469a3bcfa8
Author: Pascal Schoen
Date:   Tue Sep 27 09:20:41 2016 +0200
Branches: experimental-build
https://developer.blender.org/rBda0f94d4c814358e3851e981a2e5c0469a3bcfa8

Squashed commit of the following:

commit 2a5ac509223c838285a00c4c12775567666e7154
Author: Pascal Schoen 
Date:   Tue Sep 27 09:17:57 2016 +0200

Fixed a bug that caused transparency to be always white when using OSL and
selecting GGX as distribution of the Disney BSDF

commit e1fa8623915407cea942a07fd0a106b04e113c09
Merge: d0530a8 7f76f6f
Author: Pascal Schoen 
Date:   Tue Sep 27 08:59:32 2016 +0200

Merge branch 'master' into cycles_disney_brdf

commit d0530a8af0e076c0aca4c9a61b0a64cada45ac4d
Author: Pascal Schoen 
Date:   Tue Sep 27 08:53:18 2016 +0200

Cleanup the Disney BSDF implementation and removing unneeded files.

commit 3f4fc826bd9c1f47c694c0f6b2947daf5b524b1a
Author: Pascal Schoen 
Date:   Tue Sep 27 08:36:07 2016 +0200

Unified the OSL implementation of the Disney clearcoat as a simple
microfacet shader like it was previously done in SVM

commit 4d3a0032ecea99031979f342bfd5f66ea5a8625a
Author: Pascal Schoen 
Date:   Mon Sep 26 12:35:36 2016 +0200

Enhanced performance for Disney materials without subsurface scattering

commit 3cd5eb56cf5c9006837f111c8866e4c6e1c2a6fd
Author: Pascal Schoen 
Date:   Fri Sep 16 08:47:56 2016 +0200

Fixed a bug in the Disney BSDF that caused specular reflections to be too
bright and diffuse is now reacting to the roughness again

- A normalization for the fresnel was missing which caused the specular
  reflections to become too bright for the single-scatter GGX
- The roughness value for the diffuse BSSRDF part has always been
  overwritten and thus always 0
- Also the performance for refractive materials with roughness=0.0 has
  been improved

commit 7cb37d711938e5626651db21f20da50edd96abaf
Author: Pascal Schoen 
Date:   Thu Sep 8 12:24:43 2016 +0200

Added selection field to the Disney BSDF node for switching between
"Multiscatter GGX" and "GGX"

In the "GGX" mode there is an additional parameter for changing the
refraction roughness for materials with smooth surfaces and rough interns
(e.g. honey). With the "Multiscatter GGX" this effect can't be produced at
the moment and so here will be no separation of the two roughness values.

commit cdd29d06bb86672ed0779eefb8eee95796b8f939
Merge: 02c315a b40d1c1
Author: Pascal Schoen 
Date:   Tue Sep 6 15:59:05 2016 +0200

Merge branch 'master' into cycles_disney_brdf

commit 02c315aeb0f0d7bb429d4396912e03dbb8a77340
Author: Pascal Schoen 
Date:   Tue Sep 6 15:16:09 2016 +0200

Implemented the OSL part of the Disney shader

commit 5f880293aeeacf269032824248b46d613691a36c
Merge: 630b80e b399a6d
Author: Pascal Schoen 
Date:   Fri Sep 2 10:53:36 2016 +0200

Merge branch 'master' into cycles_disney_brdf

commit 630b80e08b6acf83834bc95264af4ccdbbc5f82c
Author: Pascal Schoen 
Date:   Fri Sep 2 10:52:13 2016 +0200

Fresnel in the microfacet multiscatter implementation improved

commit 0d9f4d7acb2de65d1c98d425cea4bf364795c155
Author: Pascal Schoen 
Date:   Fri Aug 26 11:11:05 2016 +0200

Fixed refraction roughness problem (refractions were always 100% rough)
and set IOR of clearcoat to 1.5

commit 9eed34c7d980e1b998df457c4f76021162c80f78
Merge: ef29aae ae475e3
Author: Pascal Schoen 
Date:   Tue Aug 16 15:22:32 2016 +0200

Merge branch 'master' into cycles_disney_brdf

commit ef29aaee1af8074e0228c480d962700e97ea5b36
Author: Pascal Schoen 
Date:   Tue Aug 16 15:17:12 2016 +0200

Implemented the fresnel in the multi-scatter GGX for the Disney BSDF

- The specular/metallic part uses the multi-scatter GGX
- The fresnel of the metallic part is controlled by the specular value
- The color of the reflection part when using transparency can be
  controlled by the specularTint value

commit 88567af085ac94119b98c95246b6d6f63161bc01
Merge: cc267e5 285e082
Author: Pascal Schoen 
Date:   Wed Aug 3 15:05:09 2016 +0200

Merge branch 'master' into cycles_disney_brdf

commit cc267e52f20d036a66aeeff127ee1c856f7c651b
Author: Pascal Schoen 
Date:   Wed Aug 3 15:00:25 2016 +0200

Implemented the Disney clearcoat as a variation of the microfacet bsdf,
removed the transparency roughness again and added an input for
anisotropic rotations

commit 81f6c06b1f53180bf32a5c11ac1fa64e2b6abf52
Merge: ece5a08 7065022
Author: Pascal Schoen 
Date:   Wed Aug 3 11:42:02 2016 +0200

Merge branch 'master' into cycles_disney_brdf


[Bf-blender-cvs] [17f015b] experimental-build: Revert "Squashed commit of the following:"

2016-09-27 Thread Pascal Schoen
Commit: 17f015bc6c5268b54517c5b9f6f604a84c7c42c7
Author: Pascal Schoen
Date:   Tue Sep 27 09:20:49 2016 +0200
Branches: experimental-build
https://developer.blender.org/rB17f015bc6c5268b54517c5b9f6f604a84c7c42c7

Revert "Squashed commit of the following:"

This reverts commit da0f94d4c814358e3851e981a2e5c0469a3bcfa8.

===

M   intern/cycles/blender/blender_shader.cpp
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/closure/bsdf.h
D   intern/cycles/kernel/closure/bsdf_disney_diffuse.h
D   intern/cycles/kernel/closure/bsdf_disney_sheen.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
M   intern/cycles/kernel/closure/bsdf_reflection.h
M   intern/cycles/kernel/closure/bsdf_util.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/kernel_subsurface.h
M   intern/cycles/kernel/osl/osl_bssrdf.cpp
M   intern/cycles/kernel/osl/osl_closures.cpp
M   intern/cycles/kernel/osl/osl_closures.h
M   intern/cycles/kernel/osl/osl_shader.cpp
M   intern/cycles/kernel/shaders/CMakeLists.txt
D   intern/cycles/kernel/shaders/node_disney_bsdf.osl
M   intern/cycles/kernel/shaders/stdosl.h
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/graph.cpp
M   intern/cycles/render/nodes.cpp
M   intern/cycles/render/nodes.h
M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.c
M   source/blender/editors/space_node/drawnode.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_shader.h
M   source/blender/nodes/NOD_static_types.h
D   source/blender/nodes/shader/nodes/node_shader_bsdf_disney.c

===

diff --git a/intern/cycles/blender/blender_shader.cpp 
b/intern/cycles/blender/blender_shader.cpp
index fc13fae..534bc6c 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -517,19 +517,6 @@ static ShaderNode *add_node(Scene *scene,
}
node = hair;
}
-   else if(b_node.is_a(_ShaderNodeBsdfDisney)) {
-   BL::ShaderNodeBsdfDisney b_disney_node(b_node);
-   DisneyBsdfNode *disney = new DisneyBsdfNode();
-   switch (b_disney_node.distribution()) {
-   case BL::ShaderNodeBsdfDisney::distribution_GGX:
-   disney->distribution = 
CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
-   break;
-   case BL::ShaderNodeBsdfDisney::distribution_MULTI_GGX:
-   disney->distribution = 
CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
-   break;
-   }
-   node = disney;
-}
else if(b_node.is_a(_ShaderNodeBsdfTranslucent)) {
node = new TranslucentBsdfNode();
}
diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index cad0a84..06089b4 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -108,8 +108,6 @@ set(SRC_CLOSURE_HEADERS
closure/bssrdf.h
closure/emissive.h
closure/volume.h
-closure/bsdf_disney_diffuse.h
-closure/bsdf_disney_sheen.h
 )
 
 set(SRC_SVM_HEADERS
diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 97bdf9c..1e7fbdb 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -27,8 +27,6 @@
 #include "../closure/bsdf_ashikhmin_shirley.h"
 #include "../closure/bsdf_toon.h"
 #include "../closure/bsdf_hair.h"
-#include "../closure/bsdf_disney_diffuse.h"
-#include "../closure/bsdf_disney_sheen.h"
 #ifdef __SUBSURFACE__
 #  include "../closure/bssrdf.h"
 #endif
@@ -93,7 +91,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
label = bsdf_microfacet_ggx_sample(kg, sc, 
ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, 
dI).dy, randu, randv,
eval, omega_in, _in->dx, _in->dy, 
pdf);
break;
-   case CLOSURE_BSDF_MICROFACET_MULTI_GGX_REFRACTION_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
label = bsdf_microfacet_multi_ggx_sample(kg, sc, 
ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, 
dI).dy, randu, randv,
eval, omega_in,  _in->dx, 
_in->dy, pdf, _fetch(sd, lcg_state));
@@ -133,15 

[Bf-blender-cvs] [d307e31] experimental-build: Merge branch 'master' into experimental-build

2016-09-27 Thread Pascal Schoen
Commit: d307e317bafe31f943b985c284cbc379c201f949
Author: Pascal Schoen
Date:   Tue Sep 27 09:19:21 2016 +0200
Branches: experimental-build
https://developer.blender.org/rBd307e317bafe31f943b985c284cbc379c201f949

Merge branch 'master' into experimental-build

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs