Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_random.h
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
| #else | #else | ||||
| /* compute sobol sequence value using direction vectors */ | /* compute sobol sequence value using direction vectors */ | ||||
| uint result = sobol_dimension(kg, sample + SOBOL_SKIP, dimension); | uint result = sobol_dimension(kg, sample + SOBOL_SKIP, dimension); | ||||
| float r = (float)result * (1.0f/(float)0xFFFFFFFF); | float r = (float)result * (1.0f/(float)0xFFFFFFFF); | ||||
| /* Cranly-Patterson rotation using rng seed */ | /* Cranly-Patterson rotation using rng seed */ | ||||
| float shift; | float shift; | ||||
| /* using the same *rng value to offset seems to give correlation issues, | /* Hash rng with dimension to solve correlation issues. | ||||
| * we could hash it with the dimension but this has a performance impact, | * See T38710, T50116. | ||||
| * we need to find a solution for this */ | */ | ||||
| if(dimension & 1) | RNG tmp_rng = cmj_hash_simple(dimension, tmp_rng); | ||||
lukasstockner97: This seems weird, you use the i uninitialized tmp_rng to initialize itself. I guess you meant… | |||||
sergeyAuthorUnsubmitted Not Done Inline ActionsAh, last minute optimization which for some reason was not visible at the renders =\ Good spot! sergey: Ah, last minute optimization which for some reason was not visible at the renders =\
Good spot! | |||||
| shift = (*rng >> 16) * (1.0f/(float)0xFFFF); | shift = tmp_rng * (1.0f/(float)0xFFFFFFFF); | ||||
| else | |||||
| shift = (*rng & 0xFFFF) * (1.0f/(float)0xFFFF); | |||||
| return r + shift - floorf(r + shift); | return r + shift - floorf(r + shift); | ||||
| #endif | #endif | ||||
| } | } | ||||
| ccl_device_forceinline void path_rng_2D(KernelGlobals *kg, ccl_addr_space RNG *rng, int sample, int num_samples, int dimension, float *fx, float *fy) | ccl_device_forceinline void path_rng_2D(KernelGlobals *kg, ccl_addr_space RNG *rng, int sample, int num_samples, int dimension, float *fx, float *fy) | ||||
| { | { | ||||
| #ifdef __CMJ__ | #ifdef __CMJ__ | ||||
| ▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines | |||||
This seems weird, you use the i uninitialized tmp_rng to initialize itself. I guess you meant cmj_hash_simple(dimension,*rng)?