Blender Git Loki
Git Commits -> Revision 170c70b
July 24, 2016, 00:37 (GMT) |
Cycles: Prefilter the shadow feature passes The previous commit already generates the features, but they're quite noisy, which is unacceptable for a LWR feature since it leads to noise in the result. The filtering algorithm is: 1. filter_divide_shadow: - Divide the R and G channels of both passes to get two noisy shadow passes - Scale the B channels and combine them to get the approximate Sample Variance - Compute the squared difference of the A and B divided passes to get the correct, but also noisy, Buffer Variance - Compute the squared difference of the A and B Sample Variances to get the variance of the Sample Variance estimate 2. filter_non_local_means: - Smooth the Buffer Variance using Non-Local Means with weights derived from the Sample Variance pass 3. filter_non_local_means: - Smooth the A and B shadow passes using Non-Local Means with weights derived from the other pass (B to smooth A, A to smooth B) and from the smooth buffer variance. 4. filter_combine_halves: - Compute the squared difference of the A and B smoothed shadow passes to estimate the residual variance in the channels. 5. filter_non_local_means: - Smooth the two passes again using each other and the residual variance for weights. 6. filter_combine_halves: - Average the two double-smoothed passes to obtain the final shadow feature used for the LWR algorithm. Although the algorithm might sound rather slow, that's not the case. This can be seen by reducing the half window: Doing so reduces the time LWR takes, but the prefiltering stays the same. So, since the time used can be reduced drastically with the half window, prefiltering can't be the bottleneck. Also, the amount of repeated smoothing sounds like it destroys fine details. However, that is not the case: Due to taking variance into account and the remarkable quality of the NLM filter, details that only span a couple of pixels are still preserved without blurring. The final feature isn't used yet, that will be added in the next commit. |
Commit Details:
Full Hash: 170c70b29072d3c83d3e3a1f55666855a47bc41d
Parent Commit: 462adab
Lines Changed: +351, -0
5 Modified Paths:
/intern/cycles/device/device_cpu.cpp (+142, -0) (Diff)
/intern/cycles/kernel/kernels/cpu/kernel_cpu.h (+32, -0) (Diff)
/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h (+38, -0) (Diff)
/intern/cycles/kernel/kernels/cuda/kernel.cu (+38, -0) (Diff)
/intern/cycles/kernel/kernel_filter.h (+101, -0) (Diff)
/intern/cycles/kernel/kernels/cpu/kernel_cpu.h (+32, -0) (Diff)
/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h (+38, -0) (Diff)
/intern/cycles/kernel/kernels/cuda/kernel.cu (+38, -0) (Diff)
/intern/cycles/kernel/kernel_filter.h (+101, -0) (Diff)