Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-01-21 01:27:04 +0300
committerHans Goudey <h.goudey@me.com>2022-01-21 01:27:04 +0300
commitb2155ed15dfbf9c94ba04228e0eb18a2cdc274a3 (patch)
tree22cfb272f33b9333bc01c42ed02afaee6213ca6a
parent2d1cb2968ed7455664f638b0701a7f29f043c1ac (diff)
parent5fca280c803b6841e4ef3c162fc3a8a483971089 (diff)
Merge branch 'master' into temp-geometry-nodes-extrude-mesh
-rw-r--r--intern/cycles/integrator/pass_accessor.cpp7
-rw-r--r--intern/cycles/kernel/film/read.h15
-rw-r--r--intern/cycles/kernel/integrator/shade_surface.h2
-rw-r--r--intern/cycles/kernel/integrator/shade_volume.h2
-rw-r--r--intern/cycles/kernel/svm/attribute.h12
-rw-r--r--source/blender/editors/space_node/node_intern.hh5
-rw-r--r--source/blender/editors/space_node/space_node.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc13
-rw-r--r--source/blender/nodes/intern/node_socket_declarations.cc3
9 files changed, 48 insertions, 17 deletions
diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp
index 4479442df56..9fa5aab9ea9 100644
--- a/intern/cycles/integrator/pass_accessor.cpp
+++ b/intern/cycles/integrator/pass_accessor.cpp
@@ -141,6 +141,7 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
const PassType type = pass_access_info_.type;
const PassMode mode = pass_access_info_.mode;
const PassInfo pass_info = Pass::get_info(type, pass_access_info_.include_albedo);
+ int num_written_components = pass_info.num_components;
if (pass_info.num_components == 1) {
/* Single channel passes. */
@@ -188,8 +189,10 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
else if ((pass_info.divide_type != PASS_NONE || pass_info.direct_type != PASS_NONE ||
pass_info.indirect_type != PASS_NONE) &&
mode != PassMode::DENOISED) {
- /* RGB lighting passes that need to divide out color and/or sum direct and indirect. */
+ /* RGB lighting passes that need to divide out color and/or sum direct and indirect.
+ * These can also optionally write alpha like the combined pass. */
get_pass_light_path(render_buffers, buffer_params, destination);
+ num_written_components = 4;
}
else {
/* Passes that need no special computation, or denoised passes that already
@@ -215,7 +218,7 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
}
}
- pad_pixels(buffer_params, destination, pass_info.num_components);
+ pad_pixels(buffer_params, destination, num_written_components);
return true;
}
diff --git a/intern/cycles/kernel/film/read.h b/intern/cycles/kernel/film/read.h
index 18a593a75b1..ba895fd8909 100644
--- a/intern/cycles/kernel/film/read.h
+++ b/intern/cycles/kernel/film/read.h
@@ -214,6 +214,21 @@ ccl_device_inline void film_get_pass_pixel_light_path(
pixel[0] = f.x;
pixel[1] = f.y;
pixel[2] = f.z;
+
+ /* Optional alpha channel. */
+ if (kfilm_convert->num_components >= 4) {
+ if (kfilm_convert->pass_combined != PASS_UNUSED) {
+ float scale, scale_exposure;
+ film_get_scale_and_scale_exposure(kfilm_convert, buffer, &scale, &scale_exposure);
+
+ ccl_global const float *in_combined = buffer + kfilm_convert->pass_combined;
+ const float alpha = in_combined[3] * scale;
+ pixel[3] = film_transparency_to_alpha(alpha);
+ }
+ else {
+ pixel[3] = 1.0f;
+ }
+ }
}
ccl_device_inline void film_get_pass_pixel_float3(ccl_global const KernelFilmConvert *ccl_restrict
diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h
index 3d5b65458c7..9f6077e5d66 100644
--- a/intern/cycles/kernel/integrator/shade_surface.h
+++ b/intern/cycles/kernel/integrator/shade_surface.h
@@ -188,7 +188,7 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg,
const uint16_t transparent_bounce = INTEGRATOR_STATE(state, path, transparent_bounce);
uint32_t shadow_flag = INTEGRATOR_STATE(state, path, flag);
shadow_flag |= (is_light) ? PATH_RAY_SHADOW_FOR_LIGHT : 0;
- shadow_flag |= PATH_RAY_SURFACE_PASS;
+ shadow_flag |= (shadow_flag & PATH_RAY_ANY_PASS) ? 0 : PATH_RAY_SURFACE_PASS;
const float3 throughput = INTEGRATOR_STATE(state, path, throughput) * bsdf_eval_sum(&bsdf_eval);
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
diff --git a/intern/cycles/kernel/integrator/shade_volume.h b/intern/cycles/kernel/integrator/shade_volume.h
index 712c22357b8..00fa256d894 100644
--- a/intern/cycles/kernel/integrator/shade_volume.h
+++ b/intern/cycles/kernel/integrator/shade_volume.h
@@ -797,7 +797,7 @@ ccl_device_forceinline void integrate_volume_direct_light(
const uint16_t transparent_bounce = INTEGRATOR_STATE(state, path, transparent_bounce);
uint32_t shadow_flag = INTEGRATOR_STATE(state, path, flag);
shadow_flag |= (is_light) ? PATH_RAY_SHADOW_FOR_LIGHT : 0;
- shadow_flag |= PATH_RAY_VOLUME_PASS;
+ shadow_flag |= (shadow_flag & PATH_RAY_ANY_PASS) ? 0 : PATH_RAY_VOLUME_PASS;
const float3 throughput_phase = throughput * bsdf_eval_sum(&phase_eval);
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
diff --git a/intern/cycles/kernel/svm/attribute.h b/intern/cycles/kernel/svm/attribute.h
index e9de0164c7a..17301028528 100644
--- a/intern/cycles/kernel/svm/attribute.h
+++ b/intern/cycles/kernel/svm/attribute.h
@@ -87,7 +87,9 @@ ccl_device_noinline void svm_node_attr(KernelGlobals kg,
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
/* No generated attribute, fall back to object coordinates. */
float3 f = sd->P;
- object_inverse_position_transform(kg, sd, &f);
+ if (sd->object != OBJECT_NONE) {
+ object_inverse_position_transform(kg, sd, &f);
+ }
if (type == NODE_ATTR_OUTPUT_FLOAT) {
stack_store_float(stack, out_offset, average(f));
}
@@ -179,7 +181,9 @@ ccl_device_noinline void svm_node_attr_bump_dx(KernelGlobals kg,
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
/* No generated attribute, fall back to object coordinates. */
float3 f = sd->P + sd->dP.dx;
- object_inverse_position_transform(kg, sd, &f);
+ if (sd->object != OBJECT_NONE) {
+ object_inverse_position_transform(kg, sd, &f);
+ }
if (type == NODE_ATTR_OUTPUT_FLOAT) {
stack_store_float(stack, out_offset, average(f));
}
@@ -275,7 +279,9 @@ ccl_device_noinline void svm_node_attr_bump_dy(KernelGlobals kg,
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
/* No generated attribute, fall back to object coordinates. */
float3 f = sd->P + sd->dP.dy;
- object_inverse_position_transform(kg, sd, &f);
+ if (sd->object != OBJECT_NONE) {
+ object_inverse_position_transform(kg, sd, &f);
+ }
if (type == NODE_ATTR_OUTPUT_FLOAT) {
stack_store_float(stack, out_offset, average(f));
}
diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh
index 9bd5c0ba00b..c161fc70402 100644
--- a/source/blender/editors/space_node/node_intern.hh
+++ b/source/blender/editors/space_node/node_intern.hh
@@ -45,6 +45,9 @@ struct wmGizmoGroupType;
struct wmKeyConfig;
struct wmWindow;
+/* Outside of blender namespace to avoid Python documentation build error with `ctypes`. */
+extern const char *node_context_dir[];
+
namespace blender::ed::space_node {
/** Temporary data used in node link drag modal operator. */
@@ -325,8 +328,6 @@ void node_geometry_add_attribute_search_button(const bContext &C,
PointerRNA &socket_ptr,
uiLayout &layout);
-extern const char *node_context_dir[];
-
/* Nodes draw without dpi - the view zoom is flexible. */
#define HIDDEN_RAD (0.75f * U.widget_unit)
#define BASIS_RAD (0.2f * U.widget_unit)
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index 40a7e3e616e..f794a8ce294 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -816,8 +816,14 @@ static void node_region_listener(const wmRegionListenerParams *params)
}
}
+} // namespace blender::ed::space_node
+
+/* Outside of blender namespace to avoid Python documentation build error with `ctypes`. */
const char *node_context_dir[] = {
"selected_nodes", "active_node", "light", "material", "world", nullptr};
+
+namespace blender::ed::space_node {
+
static int /*eContextResult*/ node_context(const bContext *C,
const char *member,
bContextDataResult *result)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
index 5131cb965aa..3f6298168a2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
@@ -285,12 +285,12 @@ static std::unique_ptr<CurveEval> create_arc_curve_from_points(const int resolut
return curve;
}
-std::unique_ptr<CurveEval> create_arc_curve_from_radius(const int resolution,
- const float radius,
- const float start_angle,
- const float sweep_angle,
- const bool connect_center,
- const bool invert_arc)
+static std::unique_ptr<CurveEval> create_arc_curve_from_radius(const int resolution,
+ const float radius,
+ const float start_angle,
+ const float sweep_angle,
+ const bool connect_center,
+ const bool invert_arc)
{
std::unique_ptr<CurveEval> curve = std::make_unique<CurveEval>();
std::unique_ptr<PolySpline> spline = std::make_unique<PolySpline>();
@@ -357,7 +357,6 @@ static void node_geo_exec(GeoNodeExecParams params)
}
case GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_RADIUS: {
std::unique_ptr<CurveEval> curve;
- const bool use_circle = false;
curve = create_arc_curve_from_radius(std::max(params.extract_input<int>("Resolution"), 2),
params.extract_input<float>("Radius"),
params.extract_input<float>("Start Angle"),
diff --git a/source/blender/nodes/intern/node_socket_declarations.cc b/source/blender/nodes/intern/node_socket_declarations.cc
index 4fef5b96e9f..1e6b77a9620 100644
--- a/source/blender/nodes/intern/node_socket_declarations.cc
+++ b/source/blender/nodes/intern/node_socket_declarations.cc
@@ -509,7 +509,8 @@ bool Shader::can_connect(const bNodeSocket &socket) const
}
/* Basic types can convert to shaders, but not the other way around. */
if (in_out_ == SOCK_IN) {
- return ELEM(socket.type, SOCK_VECTOR, SOCK_RGBA, SOCK_FLOAT, SOCK_INT, SOCK_BOOLEAN);
+ return ELEM(
+ socket.type, SOCK_VECTOR, SOCK_RGBA, SOCK_FLOAT, SOCK_INT, SOCK_BOOLEAN, SOCK_SHADER);
}
return socket.type == SOCK_SHADER;
}