Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_path_state.h
| Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| 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 treated separately */ | ||||
| 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) | else if(state->transparent_bounce <= 1) | ||||
| return 1.0f; | return 1.0f; | ||||
| } | } | ||||
| else { | else { | ||||
| /* other rays */ | /* other rays */ | ||||
| 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) { | else if(state->bounce <= 1) { | ||||
| return 1.0f; | return 1.0f; | ||||
| } | } | ||||
| } | } | ||||
| /* probalistic termination */ | /* probalistic termination, use sqrt() to roughly match typical view | ||||
sergey: I really propose using proper statements (starting with capital and ending with fullstop) for… | |||||
brechtAuthorUnsubmitted Not Done Inline ActionsOk, I'll fix the comment. brecht: Ok, I'll fix the comment. | |||||
| return average(throughput); /* todo: try using max here */ | * transform and do path termination a bit later on average */ | ||||
| return sqrtf(max3(fabs(throughput))); | |||||
| } | } | ||||
| /* 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.