4 years agoUnittest: Update background set test to test for proper flag
Dalai Felinto [Fri, 24 Nov 2017 13:40:52 +0000 (11:40 -0200)]
Unittest: Update background set test to test for proper flag

This test will fail until depsgraph is fixed.
But introduced on 87c821ff26be.

4 years agoObject RNA: expose base_flag settings:
Dalai Felinto [Fri, 24 Nov 2017 13:24:37 +0000 (11:24 -0200)]
Object RNA: expose base_flag settings:


We need them for the unittests, and users can benefit from it as well.
Note, this only makes sense when reading objects from depsgraph:


4 years agoLayers Unittest: Background set
Dalai Felinto [Fri, 24 Nov 2017 12:54:13 +0000 (10:54 -0200)]
Layers Unittest: Background set

This is an incomplete test since we cannot check for the
depsgraph selection value with the current API, nor can we
see if the relationship lines are being drawn.

4 years agoDepsgraph: Re-build relations when changing set scene
Sergey Sharybin [Fri, 24 Nov 2017 12:02:19 +0000 (13:02 +0100)]
Depsgraph: Re-build relations when changing set scene

Set scene is a part of dependency graph, so need to tag relations for update
after changing set scene/

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Fri, 24 Nov 2017 09:58:28 +0000 (10:58 +0100)]
Merge branch 'master' into blender2.8

4 years agoCorrect sensor fit use
Campbell Barton [Fri, 24 Nov 2017 09:59:35 +0000 (20:59 +1100)]
Correct sensor fit use

4 years agoCleanup leftover timing debug prints from own recent commits.
Bastien Montagne [Fri, 24 Nov 2017 09:43:29 +0000 (10:43 +0100)]
Cleanup leftover timing debug prints from own recent commits.

Sorry about that...

4 years agoDepsgraph: Flush flags from base to object as an evaluation step
Sergey Sharybin [Fri, 24 Nov 2017 09:18:16 +0000 (10:18 +0100)]
Depsgraph: Flush flags from base to object as an evaluation step

Previously it was done during depsgraph iteration, which is not good at all,
since after evaluation nobody should really modify how object was evaluated.

4 years agoDepsgraph: Add special cases to deal with multiple objects selection update
Sergey Sharybin [Fri, 24 Nov 2017 08:54:09 +0000 (09:54 +0100)]
Depsgraph: Add special cases to deal with multiple objects selection update

The idea then is to avoid doing depsgraph tag for each of the object which
selection is changed (which could be tricky to do anyway due to lots of areas
of selection code where this could happen), and simply tag scene's with
selection update tag.

This will involve synchronization of flags from base to objects, which is
rather cheap anyway.

4 years agoDepsgraph: Add base flag flush operation definition
Sergey Sharybin [Fri, 24 Nov 2017 09:08:30 +0000 (10:08 +0100)]
Depsgraph: Add base flag flush operation definition

4 years agoDepsgraph: Pass base to build_object()
Sergey Sharybin [Fri, 24 Nov 2017 09:06:26 +0000 (10:06 +0100)]
Depsgraph: Pass base to build_object()

4 years agoDepsgraph: Create CoW copy of scene early on
Sergey Sharybin [Fri, 24 Nov 2017 09:04:20 +0000 (10:04 +0100)]
Depsgraph: Create CoW copy of scene early on

Originally this only needed for view collections, but it will be needed for
bases really soon as well.

4 years agoDepsgraph: Use depsgraph to handle edit mode selection
Sergey Sharybin [Thu, 23 Nov 2017 15:03:44 +0000 (16:03 +0100)]
Depsgraph: Use depsgraph to handle edit mode selection

This is crucial bit since batch cache is stored in the evaluated object,
meaning we can't tag it's hatch cache dirty from the notifier system.
Not easily at least. Better to leave this job to depsgraph, it knows
all the copies of data.

4 years agoManipulator: fix camera lens update glitch
Campbell Barton [Fri, 24 Nov 2017 09:28:13 +0000 (20:28 +1100)]
Manipulator: fix camera lens update glitch

Property range setup initially used values that can change.

4 years agoEevee: Fix SSR adding too much light.
Clément Foucault [Fri, 24 Nov 2017 05:17:09 +0000 (06:17 +0100)]
Eevee: Fix SSR adding too much light.

Basically the probes were rendered twice.

4 years agoEevee: Refactor of lit_surface_frag.glsl
Clément Foucault [Fri, 24 Nov 2017 05:15:42 +0000 (06:15 +0100)]
Eevee: Refactor of lit_surface_frag.glsl

This cleanup removes the need of gigantic code duplication for each closure.

This also make some preformance improvement since it removes some branches and duplicated loops.

It also fix some mismatch (between cycles and eevee) with the principled shader.

4 years agoEevee: SSS: Principled Shader: Add a workaround the lack of scale input
Clément Foucault [Thu, 23 Nov 2017 02:39:06 +0000 (03:39 +0100)]
Eevee: SSS: Principled Shader: Add a workaround the lack of scale input

This is a hack to make the user control the SSS radius even though the profile is baked with the default radius values.

This is completly against UI principles since you cannot edit the profile radiuses while there is something plugged into the radius socket.
Better solution will be to either have a dedicated node value for RGB radiuses and a SSS scale socket only for eevee.

4 years agoMerge branch 'master' into blender2.8
Campbell Barton [Fri, 24 Nov 2017 03:30:36 +0000 (14:30 +1100)]
Merge branch 'master' into blender2.8

4 years agoCleanup: -Wnonnull-compare GCC warning
Campbell Barton [Fri, 24 Nov 2017 03:28:35 +0000 (14:28 +1100)]
Cleanup: -Wnonnull-compare GCC warning

4 years agoCycles: add object level holdout property, to replace Z mask layer.
Brecht Van Lommel [Sat, 18 Nov 2017 05:06:27 +0000 (06:06 +0100)]
Cycles: add object level holdout property, to replace Z mask layer.

4 years agoFix unneeded legacy OpenGL call in Cycles viewport drawing.
Brecht Van Lommel [Sat, 18 Nov 2017 05:08:35 +0000 (06:08 +0100)]
Fix unneeded legacy OpenGL call in Cycles viewport drawing.

4 years agoMinor cleanup for own recent commits.
Bastien Montagne [Thu, 23 Nov 2017 21:43:11 +0000 (22:43 +0100)]
Minor cleanup for own recent commits.

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Thu, 23 Nov 2017 20:36:27 +0000 (21:36 +0100)]
Merge branch 'master' into blender2.8

4 years agoGetting rid of OMP: first usage of new parallel BMesh items iteration instead.
Bastien Montagne [Thu, 23 Nov 2017 20:21:32 +0000 (21:21 +0100)]
Getting rid of OMP: first usage of new parallel BMesh items iteration instead.

`BM_mesh_normals_update` was converted from OMP to new parallel iterator code,
basic test with heavily subdivided cube (24.5k faces) gives:
    - old OMP code: average 10ms per run.
    - new BLI_task code: average 6ms per run.

So new code seems to be easily 40% quicker, in addition to getting rid of OMP. ;)

Reviewers: sergey, campbellbarton

Differential Revision:

4 years agoBMesh: add limited support for parallelization over some basic iterators.
Bastien Montagne [Thu, 23 Nov 2017 20:19:54 +0000 (21:19 +0100)]
BMesh: add limited support for parallelization over some basic iterators.

This merely uses new memloop/task looper over vertex/edge/face mempools.

Quite obviously, only BM_VERTS/EDGES/FACES_OF_MESH iterators are

4 years agoatomic_ops: add `atomic_cas_float` helper.
Bastien Montagne [Thu, 23 Nov 2017 20:17:16 +0000 (21:17 +0100)]
atomic_ops: add `atomic_cas_float` helper.

4 years agoAdd a new parallel looper for MemPool items to BLI_task.
Bastien Montagne [Thu, 23 Nov 2017 20:14:43 +0000 (21:14 +0100)]
Add a new parallel looper for MemPool items to BLI_task.

It merely uses the new thread-safe iterators system of mempool, quite
straight forward.

Note that to avoid possible confusion with two void pointers as
parameters of the callback, a dummy opaque struct pointer is used
instead for the second parameter (pointer generated by iteration over
mempool), callback functions must explicitely convert it to expected
real type.

Also added a basic gtest for this new feature.

4 years agoAdd ability to use more than one mempool iterator simultaneously.
Bastien Montagne [Thu, 23 Nov 2017 20:12:00 +0000 (21:12 +0100)]
Add ability to use more than one mempool iterator simultaneously.

This will allow threaded tasks to 'consume' all mempool items in
parallel tasks, each one working on a whole chunk at once (to reduce
concurrency managing overhead).

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Thu, 23 Nov 2017 19:34:03 +0000 (20:34 +0100)]
Merge branch 'master' into blender2.8

4 years agoatomic_ops: Copy/adapt static assert macro from BLI_utildefines, and use it.
Bastien Montagne [Thu, 23 Nov 2017 19:18:21 +0000 (20:18 +0100)]
atomic_ops: Copy/adapt static assert macro from BLI_utildefines, and use it.

Checking for type sizes is much nicer with a static assert!

4 years agoAdd non-gcc variant of static assert macro.
Bastien Montagne [Thu, 23 Nov 2017 19:15:15 +0000 (20:15 +0100)]
Add non-gcc variant of static assert macro.

Adapted from

Note that this macro just discards error message, so error when building
is much less nice than with gcc's _Static_assert... But error log will
point to right place in code, so should still be OK.

4 years agoFix T53145: bevel tool fails when used a second time.
Brecht Van Lommel [Thu, 23 Nov 2017 19:14:31 +0000 (20:14 +0100)]
Fix T53145: bevel tool fails when used a second time.

Pixel size was not initial early enough. For first time this was not a problem
because the bevel amount starts at 0 then, and after the mouse moves the pixel
size is initialized. For the second time the bevel amount starts at a non-zero
value, and it failed then.

4 years agoMerge branch 'master' into blender2.8
Brecht Van Lommel [Thu, 23 Nov 2017 18:16:11 +0000 (19:16 +0100)]
Merge branch 'master' into blender2.8

4 years agoFix T53171: lamp specials strength tweak fails with renamed emission nodes.
Brecht Van Lommel [Thu, 23 Nov 2017 18:13:31 +0000 (19:13 +0100)]
Fix T53171: lamp specials strength tweak fails with renamed emission nodes.

4 years agoFix T53360: crash with GLSL bump mapping and missing group output node.
Brecht Van Lommel [Thu, 23 Nov 2017 17:12:32 +0000 (18:12 +0100)]
Fix T53360: crash with GLSL bump mapping and missing group output node.

4 years agoCleanup: Rename ViewLayer *sl > ViewLayer *view_layer
Dalai Felinto [Thu, 23 Nov 2017 15:51:49 +0000 (13:51 -0200)]
Cleanup: Rename ViewLayer *sl > ViewLayer *view_layer

4 years agoFix T53276: encoding output quality UI clarification.
Brecht Van Lommel [Thu, 23 Nov 2017 16:55:25 +0000 (17:55 +0100)]
Fix T53276: encoding output quality UI clarification.

4 years agoFix T53357: harmless assert after recent addition of render time pass.
Brecht Van Lommel [Thu, 23 Nov 2017 16:00:18 +0000 (17:00 +0100)]
Fix T53357: harmless assert after recent addition of render time pass.

4 years agoFix inaccuracy when storing material ID pass in half float multilayer EXR.
Brecht Van Lommel [Thu, 23 Nov 2017 15:27:22 +0000 (16:27 +0100)]
Fix inaccuracy when storing material ID pass in half float multilayer EXR.

These and other non-RGB passes should always be stored as full float, the
precision loss is too unpredictable.

Related to T53381, but that one is about file output nodes where we don't
know the type of data being saved currently.

4 years agoFix T53348: Cycles difference between gradient texture on CPU and GPU.
Brecht Van Lommel [Thu, 23 Nov 2017 15:10:38 +0000 (16:10 +0100)]
Fix T53348: Cycles difference between gradient texture on CPU and GPU.

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Thu, 23 Nov 2017 16:09:29 +0000 (17:09 +0100)]
Merge branch 'master' into blender2.8

4 years agoMoar attempt to fix bloody MSVC intrinsic mess...
Bastien Montagne [Thu, 23 Nov 2017 15:58:20 +0000 (16:58 +0100)]
Moar attempt to fix bloody MSVC intrinsic mess...

4 years agoAttempt to fix bloody MSVC atomic intrinsic mess...
Bastien Montagne [Thu, 23 Nov 2017 15:53:03 +0000 (16:53 +0100)]
Attempt to fix bloody MSVC atomic intrinsic mess...

4 years agoFix specific 2.8 broken files
Dalai Felinto [Thu, 23 Nov 2017 14:54:52 +0000 (12:54 -0200)]
Fix specific 2.8 broken files

Short of checking for types (SceneLayer) this is the only reliable
way of getting all 2.80 files to date.

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Thu, 23 Nov 2017 15:29:00 +0000 (16:29 +0100)]
Merge branch 'master' into blender2.8

4 years agoatomic_ops: add char versions of uint8_t atomic primitives.
Bastien Montagne [Thu, 23 Nov 2017 15:23:45 +0000 (16:23 +0100)]
atomic_ops: add char versions of uint8_t atomic primitives.

4 years agoCleanup: use signed atomic ops when needed.
Bastien Montagne [Thu, 23 Nov 2017 15:14:53 +0000 (16:14 +0100)]
Cleanup: use signed atomic ops when needed.

4 years agoatomic_ops: add signed versions of primitives.
Bastien Montagne [Thu, 23 Nov 2017 15:13:23 +0000 (16:13 +0100)]
atomic_ops: add signed versions of primitives.

Reason is motsly that dealing with type conversion in calling code is
not great, makes it less readable, and can generate hidden bugs in case
original type changes and atomic primitive calls are not updated

4 years agoMerge branch 'master' into blender2.8
Sergey Sharybin [Thu, 23 Nov 2017 14:26:53 +0000 (15:26 +0100)]
Merge branch 'master' into blender2.8

4 years agoDepsgraph: Cleanup, deduplicate code around component registration
Sergey Sharybin [Thu, 23 Nov 2017 14:23:19 +0000 (15:23 +0100)]
Depsgraph: Cleanup, deduplicate code around component registration

4 years agoDepsgraph: Cleanup, don't use view layer name
Sergey Sharybin [Thu, 23 Nov 2017 11:20:31 +0000 (12:20 +0100)]
Depsgraph: Cleanup, don't use view layer name

Dependency graph is only built per-view-layer now, so no need to store names.
Will speed up operation lookup as well,.

4 years agoTag properties of transform operators as 'advanced'
Julian Eisel [Thu, 23 Nov 2017 13:21:40 +0000 (14:21 +0100)]
Tag properties of transform operators as 'advanced'

Sets the 'advanced' tag for some properties of following transform operators:
* Create Orientation
* Translate
* Resize
* Skin Resize
* Trackball
* Rotate
* Tilt
* Bend
* Shear
* Push/Pull
* Shrink/Flatten
* To Sphere
* Edge Slide
* Vertex Slide
* Edge Crease
* Edge Bevel Weight
* Sequence Slide
* Transform

4 years agoTag properties of some mesh editing operators as 'advanced'
Julian Eisel [Thu, 23 Nov 2017 13:14:34 +0000 (14:14 +0100)]
Tag properties of some mesh editing operators as 'advanced'

Sets the 'advanced' tag for some properties of following mesh edit operators:
* Loop Cut
* Subdivide
* Mark Seam
* Smooth Vertex
* Laplacian Smooth Vertex
* Merge

4 years agoSupport tagging operator properties as 'advanced'
Julian Eisel [Thu, 23 Nov 2017 12:58:05 +0000 (13:58 +0100)]
Support tagging operator properties as 'advanced'

This will later be used to show advanced operator properties separate from
basic (as in non-advanced) ones in the UI.

Tagging a single operator property in C should be done via
`WM_operatortype_prop_tag()`. It does additional checks for type safety
that `RNA_def_property_tags()` doesn't do.

To avoid having to tag each advanced property individually, multiple
ones can be tagged by wrapping them into
`WM_operatortype_props_advanced_bein()` and
`WM_operatortype_props_advanced_end()` calls. It's also possible to only
call `_begin()`, all properties added after this will get tagged then.
In most cases this last approach should be sufficient.

Example of Python usage:
`my_float = bpy.props.FloatProperty(name="Some Float", tags={'ADVANCED'})`

4 years agoRNA: Allow structs to define tags for their properties
Julian Eisel [Thu, 23 Nov 2017 12:41:07 +0000 (13:41 +0100)]
RNA: Allow structs to define tags for their properties

Adds support for defining a number of tags as part of the rna-struct
definition, which its properties can set similar to property-flags.
BPY supports setting these tags when defining custom properties too.

* To define tags for a struct (which its properties can use then), define the tags in an `EnumPropertyItem` array, and assign them to the struct using `RNA_def_struct_property_tags(...)`.
* To set tags for an RNA-property in C, use the new `RNA_def_property_tags(...)`.
* To set tags for an RNA-property in Python, use the newly added tags parameter. E.g. `bpy.props.FloatProperty(name="Some Float", tags={'SOME_TAG', 'ANOTHER_TAG'})`.

Actual usage of this will be added in a follow-up commit.

4 years agoMerge branch 'master' into blender2.8
Sergey Sharybin [Thu, 23 Nov 2017 11:04:57 +0000 (12:04 +0100)]
Merge branch 'master' into blender2.8

4 years agoDepsgraph: Cleanup, split build_object() a bit
Sergey Sharybin [Thu, 23 Nov 2017 11:01:31 +0000 (12:01 +0100)]
Depsgraph: Cleanup, split build_object() a bit

4 years agoMerge branch 'master' into blender2.8
Sergey Sharybin [Thu, 23 Nov 2017 10:42:06 +0000 (11:42 +0100)]
Merge branch 'master' into blender2.8

4 years agoDepsgraph: Cleanup, always call full `object`
Sergey Sharybin [Thu, 23 Nov 2017 10:39:28 +0000 (11:39 +0100)]
Depsgraph: Cleanup, always call full `object`

4 years agoNew view layers should be named "View Layer" (not Render Layer)
Dalai Felinto [Thu, 23 Nov 2017 10:31:15 +0000 (08:31 -0200)]
New view layers should be named "View Layer" (not Render Layer)

4 years agoRename any instance of scene layer or render layer in code with view layer
Dalai Felinto [Wed, 22 Nov 2017 12:52:39 +0000 (10:52 -0200)]
Rename any instance of scene layer or render layer in code with view layer

The RenderResult struct still has a listbase of RenderLayer, but that's ok
since this is strictly for rendering.

* Subversion bump (to 2.80.2)
* DNA low level doversion (renames) - only for .blend created since 2.80 started

Note: We can't use DNA_struct_elem_find or get file version in init_structDNA,
so we are manually iterating over the array of the SDNA elements instead.

Note 2: This doversion change with renames can be reverted in a few months. But
so far it's required for 2.8 files created between October 2016 and now.

Reviewers: campbellbarton, sergey

Differential Revision:

4 years agoMerge branch 'master' into blender2.8
Campbell Barton [Thu, 23 Nov 2017 05:28:05 +0000 (16:28 +1100)]
Merge branch 'master' into blender2.8

4 years agoRevert "BLI_utildefines: Support SWAP macro with two args"
Campbell Barton [Thu, 23 Nov 2017 04:19:24 +0000 (15:19 +1100)]
Revert "BLI_utildefines: Support SWAP macro with two args"

This reverts commit d749320e3b10161430bc4cb7dd92edb63712bf8c.

It's possible the container struct is larger,
we could do sizeof checks that falls back to memmove
but rather avoid complicating things.

4 years agoUse custom SWAP macro for swapping userdef data
Campbell Barton [Thu, 23 Nov 2017 04:18:22 +0000 (15:18 +1100)]
Use custom SWAP macro for swapping userdef data

Avoids complicating the common case

4 years agoEevee : Fix error with volumetrics.
Clément Foucault [Wed, 22 Nov 2017 18:04:40 +0000 (19:04 +0100)]
Eevee : Fix error with volumetrics.

4 years agoFix doversion crash with 2.8 files that had freestyle 2.8
Dalai Felinto [Wed, 22 Nov 2017 17:36:52 +0000 (15:36 -0200)]
Fix doversion crash with 2.8 files that had freestyle 2.8

Crash introduced on: 3a95bdfc65d883e7db006fd
We can't decrease user count of freestyle linestyle IDs before linking.

Moving doversion for after linking.
And for the records we are simply removing the freestyle data altogether.
This is only for files created with 2.8, so it should be fine.

4 years agoMerge branch 'master' into blender2.8
Campbell Barton [Wed, 22 Nov 2017 16:26:00 +0000 (03:26 +1100)]
Merge branch 'master' into blender2.8

4 years agoFix T53274: Saving template prefs overwrites default prefs
Campbell Barton [Wed, 22 Nov 2017 16:10:58 +0000 (03:10 +1100)]
Fix T53274: Saving template prefs overwrites default prefs

4 years agoBLI_utildefines: Support SWAP macro with two args
Campbell Barton [Wed, 22 Nov 2017 15:44:02 +0000 (02:44 +1100)]
BLI_utildefines: Support SWAP macro with two args

4 years agoFix multi layer/multi pass render
Dalai Felinto [Wed, 22 Nov 2017 12:33:26 +0000 (10:33 -0200)]
Fix multi layer/multi pass render

But introduced on the SceneRenderLayer > RenderLayer commit:

Reported by Sergey Sharybin (over irc).

4 years agoMerge branch 'master' into blender2.8
Sergey Sharybin [Wed, 22 Nov 2017 11:50:17 +0000 (12:50 +0100)]
Merge branch 'master' into blender2.8

4 years agoDepsgraph: Remove debug only code
Sergey Sharybin [Wed, 22 Nov 2017 11:07:38 +0000 (12:07 +0100)]
Depsgraph: Remove debug only code

4 years agoFixup for last commit: flipped logic for disabling SceneLayer render
Dalai Felinto [Wed, 22 Nov 2017 10:53:46 +0000 (08:53 -0200)]
Fixup for last commit: flipped logic for disabling SceneLayer render

4 years agoLayers doversion: Don't set the Viewport created layer as renderable
Dalai Felinto [Wed, 22 Nov 2017 10:48:59 +0000 (08:48 -0200)]
Layers doversion: Don't set the Viewport created layer as renderable

4 years agoFix SceneRenderLayer memory leak for files created with 2.8
Dalai Felinto [Wed, 22 Nov 2017 10:41:06 +0000 (08:41 -0200)]
Fix SceneRenderLayer memory leak for files created with 2.8

4 years agoSceneRenderLayer Removal/Refactor
Dalai Felinto [Thu, 16 Nov 2017 15:39:25 +0000 (13:39 -0200)]
SceneRenderLayer Removal/Refactor

This patch moves all the functionality previously in SceneRenderLayer to SceneLayer.
If we want to rename some of these structs now would be a good time to do it, before they are in SceneLayer.

Everything should be working, though I will test things further tomorrow. Once this is committed depsgraph can get
rid of the workaround added in rna_Main_meshes_new_from_object and finish whatever this patch was preventing from being finished.

This patch also adds a few placeholders for the overrides (samples, ...). These are obviously not working, so some unittests that rely on 'lay', and 'zmask' will fail.

This patch does not addressed the change of moving samples to ViewRender (I have this as a separate patch and needs some separate discussion).

Following next is the individual note of the individual parts that were committed.

Note 1: It is up to Cycles to still get rid of exclude_layer internally.
Note 2: Cycles still need to handle its own doversion for the use_layer_samples cases and

(1) Remove the override as it is
(2) Add a new override (scene.cycles.samples) if scene.cycles.use_layer_samples != IGNORE

Respecting the expected behaviour when scene.cycles.use_layer_samples == BOUNDED.

Note 3: Cycles still need to implement the per-object holdout
(similar to how we do shadow catcher).

Note 4: There are parts of the old (Blender Internal) rendering pipeline that is still
using lay, e.g., in shi->lay.

Honestly it will be easier to purge the entire Blender Internal code away instead of taking things from it bit by bit.

Reviewers: sergey, campbellbarton, brecht

Differential Revision:

4 years agoSceneRenderLayer > SceneLayer: Convert Lay
Dalai Felinto [Wed, 15 Nov 2017 17:01:57 +0000 (15:01 -0200)]
SceneRenderLayer > SceneLayer: Convert Lay

There are parts of the old (Blender Internal) rendering pipeline that is still
using lay, e.g., in shi->lay.

Honestly it will be easier to purge the entire Blender Internal code away instead
of taking things from it bit by bit.

4 years agoDoversion: We should always add the old RenderLayer
Dalai Felinto [Wed, 15 Nov 2017 15:52:47 +0000 (13:52 -0200)]
Doversion: We should always add the old RenderLayer

We cannot assume a render layer does not have a setting that was needed for
compositing. Even if:

(scene->lay & render_layer->lay) != (scene_lay) &&
(render_layer->lay | render_layer->lay_exclude) == 0))

Which would mean use the scene layers just as they are.

4 years agoBitflag tests simplification
Dalai Felinto [Wed, 15 Nov 2017 15:29:40 +0000 (13:29 -0200)]
Bitflag tests simplification

4 years agoSceneRenderLayer > SceneLayer: Convert Z-Mask
Dalai Felinto [Wed, 15 Nov 2017 14:08:59 +0000 (12:08 -0200)]
SceneRenderLayer > SceneLayer: Convert Z-Mask

Note: Cycles still need to implement the per-object holdout
(similar to how we do shadow catcher).

4 years agoSceneRenderLayer > SceneLayer: Convert samples_override
Dalai Felinto [Wed, 15 Nov 2017 14:17:54 +0000 (12:17 -0200)]
SceneRenderLayer > SceneLayer: Convert samples_override

Note: Cycles still need to handle its own doversion for theses cases and

(1) Remove the override as it is
(2) Add a new override (scene.cycles.samples) if scene.cycles.use_layer_samples != IGNORE

Respecting the expected behaviour when scene.cycles.use_layer_samples == BOUNDED.

4 years agoSceneRenderLayer > SceneLayer: Convert material_override
Dalai Felinto [Wed, 15 Nov 2017 13:44:36 +0000 (11:44 -0200)]
SceneRenderLayer > SceneLayer: Convert material_override

4 years agoSceneRenderLayer > SceneLayer: Remove light_override
Dalai Felinto [Tue, 14 Nov 2017 18:32:13 +0000 (16:32 -0200)]
SceneRenderLayer > SceneLayer: Remove light_override

4 years agoSceneRenderLayer > SceneLayer: Remove exclude_layer
Dalai Felinto [Tue, 14 Nov 2017 18:18:14 +0000 (16:18 -0200)]
SceneRenderLayer > SceneLayer: Remove exclude_layer

Note: It is up to Cycles to still get rid of exclude_layer internally:

4 years agoWM: minor correction to user-pref writing
Campbell Barton [Wed, 22 Nov 2017 06:11:03 +0000 (17:11 +1100)]
WM: minor correction to user-pref writing

When saving templates had wrong return value.

4 years agoEevee : SSS : Add Translucency support.
Clément Foucault [Wed, 22 Nov 2017 03:51:21 +0000 (04:51 +0100)]
Eevee : SSS : Add Translucency support.

This adds the possibility to simulate things like red ears with strong backlight or material with high scattering distances.

To enable it you need to turn on the "Subsurface Translucency" option in the "Options" tab of the Material Panel (and of course to have "regular" SSS enabled in both render settings and material options).
Since the effect is adding another overhead I prefer to make it optional. But this is open to discussion.

Be aware that the effect only works for direct lights (so no indirect/world lighting) that have shadowmaps, and is affected by the "softness" of the shadowmap and resolution.

Technical notes:

This is inspired by but goes a bit beyond that.
We do not use a sum of gaussian to apply in regards to the object thickness but we precompute a 1D kernel texture.
This texture stores the light transmited to a point at the back of an infinite slab of material of variying thickness.
We make the assumption that the slab is perpendicular to the light so that no fresnel or diffusion term is taken into account.
The light is considered constant.
If the setup is similar to the one assume during the profile baking, the realtime render matches cycles reference.
Due to these assumptions the computed transmitted light is in most cases too bright for curvy objects.

Finally we jitter the shadow map sample per pixel so we can simulate dispersion inside the medium.
Radius of the dispersion is in world space and derived by from the "soft" shadowmap parameter.
Idea for this come from this presentation (slide 164).

4 years agoFix T53313: bevel shader with transmission render artifacts.
Brecht Van Lommel [Tue, 21 Nov 2017 23:49:12 +0000 (00:49 +0100)]
Fix T53313: bevel shader with transmission render artifacts.

4 years agoRemoving OMP: get rid of usages in /bmesh/ area.
Bastien Montagne [Tue, 21 Nov 2017 16:55:07 +0000 (17:55 +0100)]
Removing OMP: get rid of usages in /bmesh/ area.

Just removing it, such cases are not bottlenecks and not worth the
complication of doing real threading with own BLI_task.

Other (remaining) usages may be relevant, need case-by-case check.

4 years agoRemoving OMP: get rid of last bit in /editors/ area.
Bastien Montagne [Tue, 21 Nov 2017 16:52:25 +0000 (17:52 +0100)]
Removing OMP: get rid of last bit in /editors/ area.

Just removing it, such cases are not bottlenecks and not worth the
complication of doing real threading with own BLI_task.

4 years agoCleanup: We do not use camel case in Blender code
Sergey Sharybin [Tue, 21 Nov 2017 16:34:44 +0000 (17:34 +0100)]
Cleanup: We do not use camel case in Blender code

At least not for variables.

4 years agoFix T53371: Keying Node fails with values above 1
Sergey Sharybin [Tue, 21 Nov 2017 16:31:45 +0000 (17:31 +0100)]
Fix T53371: Keying Node fails with values above 1

This was expected behavior for over-exposured lamps when the mode was originally
created for Tears of Steel. Turns out, there could be really bad green screen in
real production which will only have green (or rather screen) channel over

Tweaked condition now so we use least bright channel to see if the area has
proper exposure or not.

Seems to work fine in tests, but further tweaks are possible.

4 years agoShows all Cycles panels based on scene, not context engine
Dalai Felinto [Tue, 21 Nov 2017 15:16:24 +0000 (13:16 -0200)]
Shows all Cycles panels based on scene, not context engine

This is tricky since we may want granular polling depending on the setting.
Or an option to pick whether we want the context or the scene to drive the
panels to prevent too many panels when mixing Eevee and Cycles for example.

4 years agoDepsgraph: Fix warning with Empty objects
Sergey Sharybin [Tue, 21 Nov 2017 14:47:47 +0000 (15:47 +0100)]
Depsgraph: Fix warning with Empty objects

4 years agoDepsgraph: Use evaluation context to get time from
Sergey Sharybin [Tue, 21 Nov 2017 14:40:24 +0000 (15:40 +0100)]
Depsgraph: Use evaluation context to get time from

This way we don't modify scene to get current frame from. Will also let us to
hopefully get rid of Scene stored in ModifierData.

Only did for Wave modifier for now, maybe someone is around to check on another
modifiers? :)

4 years agoDepsgraph: Fix/workaround crash when toggling edit mode
Sergey Sharybin [Tue, 21 Nov 2017 14:34:13 +0000 (15:34 +0100)]
Depsgraph: Fix/workaround crash when toggling edit mode

4 years agoDepsgraph: Tag evaluated mesh as such
Sergey Sharybin [Tue, 21 Nov 2017 14:33:48 +0000 (15:33 +0100)]
Depsgraph: Tag evaluated mesh as such

Helps troubleshooting.

4 years agoDepsgraph: Report pointer from object evaluation functions
Sergey Sharybin [Tue, 21 Nov 2017 13:46:02 +0000 (14:46 +0100)]
Depsgraph: Report pointer from object evaluation functions

4 years agoDepsgraph: Fix crash removing object when CoW is enabled
Sergey Sharybin [Mon, 20 Nov 2017 11:45:51 +0000 (12:45 +0100)]
Depsgraph: Fix crash removing object when CoW is enabled

Not sure why that check was even done there. Maybe some residue of debug.

4 years agoDepsgraph: Remove workarounds used for cyclic dependencies
Sergey Sharybin [Mon, 20 Nov 2017 11:37:11 +0000 (12:37 +0100)]
Depsgraph: Remove workarounds used for cyclic dependencies

This was dangerous to do such calculations, and now it is solvable by making
dependency graph more granular in this case. Removing the workaround also saves
us a hassle of passing lots of extra arguments down the evaluation routines.

In theory, we can also remove EvaluationCOntext from constraints evaluation as
well now. But probably better to wait with such removal for now.

This commit effectively reverts 1130c53. Will do a proper fix in dependency
graph itself.

4 years agoCycles: Fixed compilation of CUDA kernels. Follow-up fix for my last commit.
Stefan Werner [Tue, 21 Nov 2017 09:43:40 +0000 (10:43 +0100)]
Cycles: Fixed compilation of CUDA kernels. Follow-up fix for my last commit.