Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2020-11-04 17:09:06 +0300
committerPatrick Mours <pmours@nvidia.com>2020-11-04 17:09:06 +0300
commitfd9124ed6b35fc3701ec3a4a9980c6eda5324fac (patch)
tree342a5b7542a017f1b9888cb333a16dc2e097d7a4 /intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
parent43ceb0f0475e7d9a4095ae0675dd976d03a83cfe (diff)
Fix Cycles volume render differences with NanoVDB when using linear sampling
The NanoVDB sampling implementation behaves different from dense texture sampling, so this adds a small offset to the voxel indices to correct for that. Also removes the need to modify the sampling coordinates by moving all the necessary transformations into the image transform. See also T81454.
Diffstat (limited to 'intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h')
-rw-r--r--intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
index 347d0fec7f5..b466b41f456 100644
--- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
+++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
@@ -490,21 +490,17 @@ template<typename T> struct NanoVDBInterpolator {
static ccl_always_inline float4
interp_3d(const TextureInfo &info, float x, float y, float z, InterpolationType interp)
{
+ const nanovdb::Vec3f xyz(x, y, z);
nanovdb::NanoGrid<T> *const grid = (nanovdb::NanoGrid<T> *)info.data;
const nanovdb::NanoRoot<T> &root = grid->tree().root();
- const nanovdb::Coord off(root.bbox().min());
- const nanovdb::Coord dim(root.bbox().dim());
- const nanovdb::Vec3f xyz(off[0] + x * dim[0], off[1] + y * dim[1], off[2] + z * dim[2]);
-
typedef nanovdb::ReadAccessor<nanovdb::NanoRoot<T>> ReadAccessorT;
switch ((interp == INTERPOLATION_NONE) ? info.interpolation : interp) {
- default:
- case INTERPOLATION_LINEAR:
- return read(nanovdb::SampleFromVoxels<ReadAccessorT, 1, false>(root)(xyz));
case INTERPOLATION_CLOSEST:
return read(nanovdb::SampleFromVoxels<ReadAccessorT, 0, false>(root)(xyz));
- case INTERPOLATION_CUBIC:
+ case INTERPOLATION_LINEAR:
+ return read(nanovdb::SampleFromVoxels<ReadAccessorT, 1, false>(root)(xyz));
+ default:
return read(nanovdb::SampleFromVoxels<ReadAccessorT, 3, false>(root)(xyz));
}
}