Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_path_state.h
| Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | if(state->flag & PATH_RAY_VOLUME_SCATTER) | ||||
| flag |= PATH_RAY_DIFFUSE; | flag |= PATH_RAY_DIFFUSE; | ||||
| return flag; | return flag; | ||||
| } | } | ||||
| ccl_device_inline float path_state_terminate_probability(KernelGlobals *kg, ccl_addr_space PathState *state, const float3 throughput) | ccl_device_inline float path_state_terminate_probability(KernelGlobals *kg, ccl_addr_space PathState *state, const float3 throughput) | ||||
| { | { | ||||
| if(state->flag & PATH_RAY_TRANSPARENT) { | if(state->flag & PATH_RAY_TRANSPARENT) { | ||||
| /* transparent rays treated separately */ | /* Transparent rays are treated separately with own max bounces. */ | ||||
| if(state->transparent_bounce >= kernel_data.integrator.transparent_max_bounce) | if(state->transparent_bounce >= kernel_data.integrator.transparent_max_bounce) { | ||||
| return 0.0f; | return 0.0f; | ||||
| else if(state->transparent_bounce <= kernel_data.integrator.transparent_min_bounce) | } | ||||
| /* Do at least one bounce without RR. */ | |||||
| else if(state->transparent_bounce <= 1) { | |||||
| return 1.0f; | return 1.0f; | ||||
| } | } | ||||
| #ifdef __SHADOW_TRICKS__ | |||||
| /* Exception for shadow catcher not working correctly with RR. */ | |||||
| else if ((state->flag & PATH_RAY_SHADOW_CATCHER) && (state->transparent_bounce <= 8)) { | |||||
| return 1.0f; | |||||
| } | |||||
| #endif | |||||
| } | |||||
| else { | else { | ||||
| /* other rays */ | /* Test max bounces for various ray types. */ | ||||
| if((state->bounce >= kernel_data.integrator.max_bounce) || | if((state->bounce >= kernel_data.integrator.max_bounce) || | ||||
| (state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) || | (state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) || | ||||
| (state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) || | (state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) || | ||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| (state->volume_bounce >= kernel_data.integrator.max_volume_bounce) || | (state->volume_bounce >= kernel_data.integrator.max_volume_bounce) || | ||||
| #endif | #endif | ||||
| (state->transmission_bounce >= kernel_data.integrator.max_transmission_bounce)) | (state->transmission_bounce >= kernel_data.integrator.max_transmission_bounce)) | ||||
| { | { | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| else if(state->bounce <= kernel_data.integrator.min_bounce) { | /* Do at least one bounce without RR. */ | ||||
| else if(state->bounce <= 1) { | |||||
| return 1.0f; | return 1.0f; | ||||
| } | } | ||||
| #ifdef __SHADOW_TRICKS__ | |||||
| /* Exception for shadow catcher not working correctly with RR. */ | |||||
| else if ((state->flag & PATH_RAY_SHADOW_CATCHER) && (state->bounce <= 3)) { | |||||
| return 1.0f; | |||||
| } | |||||
| #endif | |||||
| } | } | ||||
| /* probalistic termination */ | /* Probalistic termination: use sqrt() to roughly match typical view | ||||
| return average(throughput); /* todo: try using max here */ | * transform and do path termination a bit later on average. */ | ||||
| return sqrtf(max3(fabs(throughput))); | |||||
sergey: I really propose using proper statements (starting with capital and ending with fullstop) for… | |||||
Not Done Inline ActionsOk, I'll fix the comment. brecht: Ok, I'll fix the comment. | |||||
| } | } | ||||
| /* TODO(DingTo): Find more meaningful name for this */ | /* TODO(DingTo): Find more meaningful name for this */ | ||||
| ccl_device_inline void path_state_modify_bounce(ccl_addr_space PathState *state, bool increase) | ccl_device_inline void path_state_modify_bounce(ccl_addr_space PathState *state, bool increase) | ||||
| { | { | ||||
| /* Modify bounce temporarily for shader eval */ | /* Modify bounce temporarily for shader eval */ | ||||
| if(increase) | if(increase) | ||||
| state->bounce += 1; | state->bounce += 1; | ||||
| else | else | ||||
| state->bounce -= 1; | state->bounce -= 1; | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
I really propose using proper statements (starting with capital and ending with fullstop) for all comments. Often you need to expand comments, or make more comprehensive explanations, where such an obscure statements will make it difficult to follow. Having different format for comprehensive and "simple" comments is also weird.