Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/integrator/integrator_subsurface.h
| Show All 22 Lines | |||||
| #include "kernel/bvh/bvh.h" | #include "kernel/bvh/bvh.h" | ||||
| #include "kernel/closure/alloc.h" | #include "kernel/closure/alloc.h" | ||||
| #include "kernel/closure/bsdf_diffuse.h" | #include "kernel/closure/bsdf_diffuse.h" | ||||
| #include "kernel/closure/bsdf_principled_diffuse.h" | #include "kernel/closure/bsdf_principled_diffuse.h" | ||||
| #include "kernel/closure/bssrdf.h" | #include "kernel/closure/bssrdf.h" | ||||
| #include "kernel/closure/volume.h" | #include "kernel/closure/volume.h" | ||||
| #include "kernel/integrator/integrator_intersect_volume_stack.h" | |||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| #ifdef __SUBSURFACE__ | #ifdef __SUBSURFACE__ | ||||
| /* TODO: restore or remove this. | /* TODO: restore or remove this. | ||||
| * If we reevaluate the shader for the normal and color, it should happen in | * If we reevaluate the shader for the normal and color, it should happen in | ||||
| * the shade_surface kernel. */ | * the shade_surface kernel. */ | ||||
| ▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | ccl_device_inline bool subsurface_random_walk(INTEGRATOR_STATE_ARGS) | ||||
| } | } | ||||
| # ifndef __KERNEL_OPTIX__ | # ifndef __KERNEL_OPTIX__ | ||||
| /* Compute or fetch object transforms. */ | /* Compute or fetch object transforms. */ | ||||
| Transform ob_itfm ccl_optional_struct_init; | Transform ob_itfm ccl_optional_struct_init; | ||||
| Transform ob_tfm = object_fetch_transform_motion_test(kg, object, time, &ob_itfm); | Transform ob_tfm = object_fetch_transform_motion_test(kg, object, time, &ob_itfm); | ||||
| # endif | # endif | ||||
| const float3 ray_start_P = ray_offset(P, -Ng); | |||||
| /* Setup ray. */ | /* Setup ray. */ | ||||
| Ray ray ccl_optional_struct_init; | Ray ray ccl_optional_struct_init; | ||||
| ray.P = ray_offset(P, -Ng); | ray.P = ray_start_P; | ||||
| ray.D = D; | ray.D = D; | ||||
| ray.t = FLT_MAX; | ray.t = FLT_MAX; | ||||
| ray.time = time; | ray.time = time; | ||||
| ray.dP = ray_dP; | ray.dP = ray_dP; | ||||
| ray.dD = differential_zero_compact(); | ray.dD = differential_zero_compact(); | ||||
| /* Setup intersections. | /* Setup intersections. | ||||
| * TODO: make this more compact if we don't bring back disk based SSS that needs | * TODO: make this more compact if we don't bring back disk based SSS that needs | ||||
| ▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | # endif | ||||
| kernel_assert(isfinite3_safe(throughput)); | kernel_assert(isfinite3_safe(throughput)); | ||||
| /* Return number of hits in ss_isect. */ | /* Return number of hits in ss_isect. */ | ||||
| if (!hit) { | if (!hit) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| # ifdef __VOLUME__ | |||||
| /* Update volume stack if needed. */ | |||||
| if (kernel_data.integrator.use_volumes) { | |||||
| const int object = intersection_get_object(kg, &ss_isect.hits[0]); | |||||
| const int object_flag = kernel_tex_fetch(__object_flag, object); | |||||
| if (object_flag & SD_OBJECT_INTERSECTS_VOLUME) { | |||||
| integrator_volume_stack_update_for_subsurface(INTEGRATOR_STATE_PASS, ray_start_P, ray.P); | |||||
| } | |||||
| } | |||||
| # endif /* __VOLUME__ */ | |||||
| /* Pretend ray is coming from the outside towards the exit point. This ensures | /* Pretend ray is coming from the outside towards the exit point. This ensures | ||||
| * correct front/back facing normals. | * correct front/back facing normals. | ||||
| * TODO: find a more elegant solution? */ | * TODO: find a more elegant solution? */ | ||||
| ray.P += ray.D * ray.t * 2.0f; | ray.P += ray.D * ray.t * 2.0f; | ||||
| ray.D = -ray.D; | ray.D = -ray.D; | ||||
| integrator_state_write_isect(INTEGRATOR_STATE_PASS, &ss_isect.hits[0]); | integrator_state_write_isect(INTEGRATOR_STATE_PASS, &ss_isect.hits[0]); | ||||
| integrator_state_write_ray(INTEGRATOR_STATE_PASS, &ray); | integrator_state_write_ray(INTEGRATOR_STATE_PASS, &ray); | ||||
| Show All 21 Lines | |||||