diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-18 22:54:41 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-06-22 14:28:01 +0300 |
commit | 207338bb58b1a44c531e6d78fad68672c6d3b2e1 (patch) | |
tree | 960d346de6f1e28f6778655a6330ba36404546bb /intern/cycles/device | |
parent | d1ef5146d72d40f97fdcbf28e96da49193c21dea (diff) |
Cycles: port curve-ray intersection from Embree for use in Cycles GPU
This keeps render results compatible for combined CPU + GPU rendering.
Peformance and quality primitives is quite different than before. There
are now two options:
* Rounded Ribbon: render hair as flat ribbon with (fake) rounded normals, for
fast rendering. Hair curves are subdivided with a fixed number of user
specified subdivisions.
This gives relatively good results, especially when used with the Principled
Hair BSDF and hair viewed from a typical distance. There are artifacts when
viewed closed up, though this was also the case with all previous primitives
(but different ones).
* 3D Curve: render hair as 3D curve, for accurate results when viewing hair
close up. This automatically subdivides the curve until it is smooth.
This gives higher quality than any of the previous primitives, but does come
at a performance cost and is somewhat slower than our previous Thick curves.
The main problem here is performance. For CPU and OpenCL rendering performance
seems usually quite close or better for similar quality results.
However for CUDA and Optix, performance of 3D curve intersection is problematic,
with e.g. 1.45x longer render time in Koro (though there is no equivalent quality
and rounded ribbons seem fine for that scene). Any help or ideas to optimize this
are welcome.
Ref T73778
Depends on D8012
Maniphest Tasks: T73778
Differential Revision: https://developer.blender.org/D8013
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/device.h | 3 | ||||
-rw-r--r-- | intern/cycles/device/device_optix.cpp | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 67828103394..69f22aeb35c 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -132,6 +132,7 @@ class DeviceRequestedFeatures { /* BVH/sampling kernel features. */ bool use_hair; + bool use_hair_thick; bool use_object_motion; bool use_camera_motion; @@ -178,6 +179,7 @@ class DeviceRequestedFeatures { max_nodes_group = 0; nodes_features = 0; use_hair = false; + use_hair_thick = false; use_object_motion = false; use_camera_motion = false; use_baking = false; @@ -200,6 +202,7 @@ class DeviceRequestedFeatures { max_nodes_group == requested_features.max_nodes_group && nodes_features == requested_features.nodes_features && use_hair == requested_features.use_hair && + use_hair_thick == requested_features.use_hair_thick && use_object_motion == requested_features.use_object_motion && use_camera_motion == requested_features.use_camera_motion && use_baking == requested_features.use_baking && diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp index bc2aeb0ae90..7aab2c96db4 100644 --- a/intern/cycles/device/device_optix.cpp +++ b/intern/cycles/device/device_optix.cpp @@ -428,11 +428,20 @@ class OptiXDevice : public CUDADevice { group_descs[PG_HITS].hitgroup.entryFunctionNameAH = "__anyhit__kernel_optix_shadow_all_hit"; if (requested_features.use_hair) { - // Add curve intersection programs group_descs[PG_HITD].hitgroup.moduleIS = optix_module; - group_descs[PG_HITD].hitgroup.entryFunctionNameIS = "__intersection__curve"; group_descs[PG_HITS].hitgroup.moduleIS = optix_module; - group_descs[PG_HITS].hitgroup.entryFunctionNameIS = "__intersection__curve"; + + // Add curve intersection programs + if (requested_features.use_hair_thick) { + // Slower programs for thick hair since that also slows down ribbons. + // Ideally this should not be needed. + group_descs[PG_HITD].hitgroup.entryFunctionNameIS = "__intersection__curve_all"; + group_descs[PG_HITS].hitgroup.entryFunctionNameIS = "__intersection__curve_all"; + } + else { + group_descs[PG_HITD].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon"; + group_descs[PG_HITS].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon"; + } } if (requested_features.use_subsurface || requested_features.use_shader_raytrace) { |