Cycles: use deterministic linear interpolation for velocity

Cubic is too costly, stochastic interpolation is inaccurate.
This commit is contained in:
Weizhen Huang
2025-08-12 14:42:14 +02:00
committed by Weizhen Huang
parent bc93123461
commit 0c371ca3c5

View File

@@ -409,19 +409,26 @@ ccl_device_inline void volume_shader_motion_blur(KernelGlobals kg,
* "Production Volume Rendering", Wreninge et al., 2012
*/
/* Always use linear interpolation for velocity. */
const int cubic_flag = sd->flag & SD_VOLUME_CUBIC;
sd->flag &= ~SD_VOLUME_CUBIC;
/* Find velocity. */
float3 velocity = primitive_volume_attribute<float3>(kg, sd, v_desc, true);
float3 velocity = primitive_volume_attribute<float3>(kg, sd, v_desc, false);
object_dir_transform(kg, sd, &velocity);
/* Find advected P. */
sd->P = P - (time - time_offset) * velocity_scale * velocity;
/* Find advected velocity. */
velocity = primitive_volume_attribute<float3>(kg, sd, v_desc, true);
velocity = primitive_volume_attribute<float3>(kg, sd, v_desc, false);
object_dir_transform(kg, sd, &velocity);
/* Find advected P. */
sd->P = P - (time - time_offset) * velocity_scale * velocity;
/* Restore flag. */
sd->flag |= cubic_flag;
}
# endif