Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/integrator/path_state.h
| Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | ccl_device_inline void path_state_next(KernelGlobals kg, IntegratorState state, int label) | ||||
| flag &= ~(PATH_RAY_ALL_VISIBILITY | PATH_RAY_MIS_SKIP); | flag &= ~(PATH_RAY_ALL_VISIBILITY | PATH_RAY_MIS_SKIP); | ||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| if (label & LABEL_VOLUME_SCATTER) { | if (label & LABEL_VOLUME_SCATTER) { | ||||
| /* volume scatter */ | /* volume scatter */ | ||||
| flag |= PATH_RAY_VOLUME_SCATTER; | flag |= PATH_RAY_VOLUME_SCATTER; | ||||
| flag &= ~PATH_RAY_TRANSPARENT_BACKGROUND; | flag &= ~PATH_RAY_TRANSPARENT_BACKGROUND; | ||||
| if (bounce == 1) { | if (!(flag & PATH_RAY_ANY_PASS)) { | ||||
| flag |= PATH_RAY_VOLUME_PASS; | flag |= PATH_RAY_VOLUME_PASS; | ||||
| } | } | ||||
| const int volume_bounce = INTEGRATOR_STATE(state, path, volume_bounce) + 1; | const int volume_bounce = INTEGRATOR_STATE(state, path, volume_bounce) + 1; | ||||
| INTEGRATOR_STATE_WRITE(state, path, volume_bounce) = volume_bounce; | INTEGRATOR_STATE_WRITE(state, path, volume_bounce) = volume_bounce; | ||||
| if (volume_bounce >= kernel_data.integrator.max_volume_bounce) { | if (volume_bounce >= kernel_data.integrator.max_volume_bounce) { | ||||
| flag |= PATH_RAY_TERMINATE_AFTER_TRANSPARENT; | flag |= PATH_RAY_TERMINATE_AFTER_TRANSPARENT; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | else if (label & LABEL_GLOSSY) { | ||||
| flag |= PATH_RAY_GLOSSY; | flag |= PATH_RAY_GLOSSY; | ||||
| } | } | ||||
| else { | else { | ||||
| kernel_assert(label & LABEL_SINGULAR); | kernel_assert(label & LABEL_SINGULAR); | ||||
| flag |= PATH_RAY_GLOSSY | PATH_RAY_SINGULAR | PATH_RAY_MIS_SKIP; | flag |= PATH_RAY_GLOSSY | PATH_RAY_SINGULAR | PATH_RAY_MIS_SKIP; | ||||
| } | } | ||||
| /* Render pass categories. */ | /* Render pass categories. */ | ||||
| if (bounce == 1) { | if (!(flag & PATH_RAY_ANY_PASS) && !(flag & PATH_RAY_TRANSPARENT_BACKGROUND)) { | ||||
| flag |= PATH_RAY_SURFACE_PASS; | flag |= PATH_RAY_SURFACE_PASS; | ||||
| } | } | ||||
| } | } | ||||
| INTEGRATOR_STATE_WRITE(state, path, flag) = flag; | INTEGRATOR_STATE_WRITE(state, path, flag) = flag; | ||||
| INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce; | INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce; | ||||
| /* Random number generator next bounce. */ | /* Random number generator next bounce. */ | ||||
| INTEGRATOR_STATE_WRITE(state, path, rng_offset) += PRNG_BOUNCE_NUM; | INTEGRATOR_STATE_WRITE(state, path, rng_offset) += PRNG_BOUNCE_NUM; | ||||
| } | } | ||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| ccl_device_inline bool path_state_volume_next(IntegratorState state) | ccl_device_inline bool path_state_volume_next(IntegratorState state) | ||||
| { | { | ||||
| /* For volume bounding meshes we pass through without counting transparent | /* For volume bounding meshes we pass through without counting transparent | ||||
| * bounces, only sanity check in case self intersection gets us stuck. */ | * bounces, only sanity check in case self intersection gets us stuck. */ | ||||
| uint32_t volume_bounds_bounce = INTEGRATOR_STATE(state, path, volume_bounds_bounce) + 1; | uint32_t volume_bounds_bounce = INTEGRATOR_STATE(state, path, volume_bounds_bounce) + 1; | ||||
| INTEGRATOR_STATE_WRITE(state, path, volume_bounds_bounce) = volume_bounds_bounce; | INTEGRATOR_STATE_WRITE(state, path, volume_bounds_bounce) = volume_bounds_bounce; | ||||
| if (volume_bounds_bounce > VOLUME_BOUNDS_MAX) { | if (volume_bounds_bounce > VOLUME_BOUNDS_MAX) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Random number generator next bounce. */ | /* Random number generator next bounce. */ | ||||
| if (volume_bounds_bounce > 1) { | |||||
| INTEGRATOR_STATE_WRITE(state, path, rng_offset) += PRNG_BOUNCE_NUM; | INTEGRATOR_STATE_WRITE(state, path, rng_offset) += PRNG_BOUNCE_NUM; | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| #endif | #endif | ||||
| ccl_device_inline uint path_state_ray_visibility(ConstIntegratorState state) | ccl_device_inline uint path_state_ray_visibility(ConstIntegratorState state) | ||||
| { | { | ||||
| const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag); | const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag); | ||||
| ▲ Show 20 Lines • Show All 156 Lines • Show Last 20 Lines | |||||