[Bf-blender-cvs] [a29446da526] blender2.7: Cycles: sync various master changes to blender2.7.
Brecht Van Lommel
noreply at git.blender.org
Tue Mar 26 15:30:46 CET 2019
Commit: a29446da526d601a03c9083d19e3c18d7b470f20
Author: Brecht Van Lommel
Date: Tue Mar 26 14:34:18 2019 +0100
Branches: blender2.7
https://developer.blender.org/rBa29446da526d601a03c9083d19e3c18d7b470f20
Cycles: sync various master changes to blender2.7.
Many of these were left out accidentally. We will only do important bugfixes
in blender2.7 for Cycles from this point on.
===================================================================
M intern/cycles/app/CMakeLists.txt
M intern/cycles/app/io_export_cycles_xml.py
M intern/cycles/blender/addon/engine.py
M intern/cycles/device/device_cpu.cpp
M intern/cycles/device/opencl/opencl.h
M intern/cycles/device/opencl/opencl_split.cpp
M intern/cycles/kernel/filter/filter_reconstruction.h
M intern/cycles/kernel/kernel_light.h
M intern/cycles/render/film.cpp
M intern/cycles/render/image.cpp
M intern/cycles/render/image.h
M intern/cycles/render/light.cpp
M intern/cycles/render/light.h
M intern/cycles/render/nodes.cpp
M intern/cycles/render/nodes.h
M intern/cycles/render/scene.cpp
M intern/cycles/render/scene.h
M intern/cycles/render/shader.cpp
M intern/cycles/render/shader.h
M intern/cycles/util/util_ies.cpp
M intern/cycles/util/util_ies.h
M intern/cycles/util/util_math_intersect.h
===================================================================
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 689b8bc08e5..2d7db860b09 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -58,7 +58,12 @@ link_directories(${OPENIMAGEIO_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
- ${OPENEXR_LIBPATH})
+ ${OPENEXR_LIBPATH}
+ ${OPENJPEG_LIBPATH})
+
+if(WITH_OPENCOLORIO)
+ link_directories(${OPENCOLORIO_LIBPATH})
+endif()
add_definitions(${GL_DEFINITIONS})
@@ -84,13 +89,13 @@ macro(cycles_target_link_libraries target)
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
if(WITH_OPENCOLORIO)
- link_directories(${OPENCOLORIO_LIBPATH})
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
target_link_libraries(
${target}
${OPENIMAGEIO_LIBRARIES}
${OPENEXR_LIBRARIES}
+ ${OPENJPEG_LIBRARIES}
${PUGIXML_LIBRARIES}
${BOOST_LIBRARIES}
${CMAKE_DL_LIBS}
@@ -148,6 +153,7 @@ if(WITH_CYCLES_CUBIN_COMPILER)
extern_cuew
${OPENIMAGEIO_LIBRARIES}
${OPENEXR_LIBRARIES}
+ ${OPENJPEG_LIBRARIES}
${PUGIXML_LIBRARIES}
${BOOST_LIBRARIES}
${PLATFORM_LINKLIBS}
diff --git a/intern/cycles/app/io_export_cycles_xml.py b/intern/cycles/app/io_export_cycles_xml.py
index 816536c0071..e7ef182120f 100644
--- a/intern/cycles/app/io_export_cycles_xml.py
+++ b/intern/cycles/app/io_export_cycles_xml.py
@@ -16,7 +16,6 @@
# XML exporter for generating test files, not intended for end users
-import os
import xml.etree.ElementTree as etree
import xml.dom.minidom as dom
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index 83b9a8eee0c..82372538aa8 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -253,8 +253,6 @@ def register_passes(engine, scene, srl):
if crl.use_pass_volume_direct: engine.register_pass(scene, srl, "VolumeDir", 3, "RGB", 'COLOR')
if crl.use_pass_volume_indirect: engine.register_pass(scene, srl, "VolumeInd", 3, "RGB", 'COLOR')
- cscene = scene.cycles
-
if crl.use_pass_crypto_object:
for i in range(0, crl.pass_crypto_depth, 2):
engine.register_pass(scene, srl, "CryptoObject" + '{:02d}'.format(i), 4, "RGBA", 'COLOR')
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 370bc48f9f7..73f1fc02b08 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -968,6 +968,7 @@ protected:
kg.decoupled_volume_steps[i] = NULL;
}
kg.decoupled_volume_steps_index = 0;
+ kg.coverage_asset = kg.coverage_object = kg.coverage_material = NULL;
#ifdef WITH_OSL
OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
#endif
diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index a8ad4a935f7..89761293638 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -296,9 +296,9 @@ public:
const string& get_log() const { return log; }
void report_error();
- /* Wait until this kernel is available to be used
+ /* Wait until this kernel is available to be used
* It will return true when the kernel is available.
- * It will return false when the kernel is not available
+ * It will return false when the kernel is not available
* or could not be loaded. */
bool wait_for_availability();
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index fd7eebf0221..489d10b7087 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -396,8 +396,8 @@ public:
OpenCLDevice::OpenCLProgram(device,
program_name,
device->get_opencl_program_filename(kernel_name),
- device->get_build_options(requested_features,
- program_name,
+ device->get_build_options(requested_features,
+ program_name,
device->use_preview_kernels));
kernel->program.add_kernel(ustring("path_trace_" + kernel_name));
@@ -770,7 +770,7 @@ bool OpenCLDevice::load_kernels(const DeviceRequestedFeatures& requested_feature
/* Verify we have right opencl version. */
if(!opencl_version_check())
return false;
-
+
load_required_kernels(requested_features);
vector<OpenCLProgram*> programs;
@@ -880,7 +880,7 @@ DeviceKernelStatus OpenCLDevice::get_active_kernel_switch_state()
{
/* Do not switch kernels for background renderings
* We do foreground rendering but use the preview kernels
- * Check for the optimized kernels
+ * Check for the optimized kernels
*
* This works also the other way around, where we are using
* optimized kernels but new ones are being compiled due
@@ -891,7 +891,7 @@ DeviceKernelStatus OpenCLDevice::get_active_kernel_switch_state()
* this as an early exit */
return DEVICE_KERNEL_USING_FEATURE_KERNEL;
}
-
+
bool other_kernels_finished = load_kernel_task_pool.finished();
if (use_preview_kernels) {
if (other_kernels_finished) {
diff --git a/intern/cycles/kernel/filter/filter_reconstruction.h b/intern/cycles/kernel/filter/filter_reconstruction.h
index 31a7487c77a..ceda8f71f98 100644
--- a/intern/cycles/kernel/filter/filter_reconstruction.h
+++ b/intern/cycles/kernel/filter/filter_reconstruction.h
@@ -95,14 +95,16 @@ ccl_device_inline void kernel_filter_finalize(int x, int y,
}
/* The weighted average of pixel colors (essentially, the NLM-filtered image).
- * In case the solution of the linear model fails due to numerical issues,
- * fall back to this value. */
+ * In case the solution of the linear model fails due to numerical issues or
+ * returns non-sensical negative values, fall back to this value. */
float3 mean_color = XtWY[0]/XtWX[0];
math_trimatrix_vec3_solve(XtWX, XtWY, (*rank)+1, stride);
float3 final_color = XtWY[0];
- if(!isfinite3_safe(final_color)) {
+ if(!isfinite3_safe(final_color) ||
+ (final_color.x < -0.01f || final_color.y < -0.01f || final_color.z < -0.01f))
+ {
final_color = mean_color;
}
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 2a300d3419e..262d7df1364 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -44,7 +44,7 @@ typedef struct LightSample {
*
* Note: light_p is modified when sample_coord is true.
*/
-ccl_device_inline float area_light_sample(float3 P,
+ccl_device_inline float rect_light_sample(float3 P,
float3 *light_p,
float3 axisu, float3 axisv,
float randu, float randv,
@@ -118,6 +118,60 @@ ccl_device_inline float area_light_sample(float3 P,
return 0.0f;
}
+ccl_device_inline float3 ellipse_sample(float3 ru, float3 rv, float randu, float randv)
+{
+ to_unit_disk(&randu, &randv);
+ return ru*randu + rv*randv;
+}
+
+ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
+{
+ float3 ru, rv;
+
+ make_orthonormals(v, &ru, &rv);
+
+ return ellipse_sample(ru, rv, randu, randv);
+}
+
+ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
+{
+ return normalize(D + disk_light_sample(D, randu, randv)*radius);
+}
+
+ccl_device float3 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
+{
+ return disk_light_sample(normalize(P - center), randu, randv)*radius;
+}
+
+ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, LightSample *ls)
+{
+ float3 I = ls->Ng;
+
+ float attenuation = dot(dir, I);
+
+ if(attenuation <= spot_angle) {
+ attenuation = 0.0f;
+ }
+ else {
+ float t = attenuation - spot_angle;
+
+ if(t < spot_smooth && spot_smooth != 0.0f)
+ attenuation *= smoothstepf(t/spot_smooth);
+ }
+
+ return attenuation;
+}
+
+ccl_device float lamp_light_pdf(KernelGlobals *kg, const float3 Ng, const float3 I, float t)
+{
+ float cos_pi = dot(Ng, I);
+
+ if(cos_pi <= 0.0f)
+ return 0.0f;
+
+ return t*t/cos_pi;
+}
+
/* Background Light */
#ifdef __BACKGROUND_MIS__
@@ -291,11 +345,19 @@ ccl_device_inline float background_portal_pdf(KernelGlobals *kg,
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
+ bool is_round = (klight->area.invarea < 0.0f);
- if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, axisu, axisv, dir, NULL, NULL, NULL, NULL))
+ if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, axisu, axisv, dir, NULL, NULL, NULL, NULL, is_round))
continue;
- portal_pdf += area_light_sample(P, &lightpos, axisu, axisv, 0.0f, 0.0f, false);
+ if(is_round) {
+ float t;
+ float3 D = normalize_len(lightpos - P, &t);
+ portal_pdf += fabsf(klight->area.invarea) * lamp_light_pdf(kg, dir, -D, t);
+ }
+ else {
+ portal_pdf += rect_light_sample(P, &lightpos, axisu, axisv, 0.0f, 0.0f, false);
+ }
}
if(ignore_portal >= 0) {
@@ -345,15 +407,26 @@ ccl_device float3 background_portal_sample(KernelGlobals *kg,
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
-
- *pdf = area_light_sample(P, &lightpos,
- axisu, axisv,
- randu, randv,
- true);
+ bool is_round = (klight->area.invarea < 0.0f);
+
+ float3 D;
+ if(is_round) {
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list