forked from bartvdbraak/blender
Fixed point cache subframe interpolation issue.
Point cache interpolation was using too early start frame in cases when target frame was a subframe. This appeared as random ghost particles when rendering particle animation with full sample motion blur enabled.
This commit is contained in:
parent
d39adcb478
commit
91f14ddf3d
@ -1491,7 +1491,7 @@ static int ptcache_old_elemsize(PTCacheID *pid)
|
|||||||
static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2)
|
static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2)
|
||||||
{
|
{
|
||||||
if(pid->cache->flag & PTCACHE_DISK_CACHE) {
|
if(pid->cache->flag & PTCACHE_DISK_CACHE) {
|
||||||
int cfra1=frame-1, cfra2=frame+1;
|
int cfra1=frame, cfra2=frame+1;
|
||||||
|
|
||||||
while(cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1))
|
while(cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1))
|
||||||
cfra1--;
|
cfra1--;
|
||||||
@ -1518,7 +1518,7 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
|
|||||||
PTCacheMem *pm = pid->cache->mem_cache.first;
|
PTCacheMem *pm = pid->cache->mem_cache.first;
|
||||||
PTCacheMem *pm2 = pid->cache->mem_cache.last;
|
PTCacheMem *pm2 = pid->cache->mem_cache.last;
|
||||||
|
|
||||||
while(pm->next && pm->next->frame < frame)
|
while(pm->next && pm->next->frame <= frame)
|
||||||
pm= pm->next;
|
pm= pm->next;
|
||||||
|
|
||||||
if(pm2->frame < frame) {
|
if(pm2->frame < frame) {
|
||||||
@ -1841,7 +1841,7 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2)
|
|||||||
/* possible to get old or interpolated result */
|
/* possible to get old or interpolated result */
|
||||||
int BKE_ptcache_read(PTCacheID *pid, float cfra)
|
int BKE_ptcache_read(PTCacheID *pid, float cfra)
|
||||||
{
|
{
|
||||||
int cfrai = (int)cfra, cfra1=0, cfra2=0;
|
int cfrai = (int)floor(cfra), cfra1=0, cfra2=0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* nothing to read to */
|
/* nothing to read to */
|
||||||
|
Loading…
Reference in New Issue
Block a user