Artifacts on astrofora/starfield sample

SGDK only sub forum

Moderator: Stef

Post Reply
vnsbr
Interested
Posts: 48
Joined: Sun Dec 17, 2017 4:13 pm

Artifacts on astrofora/starfield sample

Post by vnsbr » Mon Feb 18, 2019 8:21 pm

I have tested astrofora/starfield_donut demo in some emulators and im getting these strange artifacts, lastest SGDK version from git.

I have to admit I never tested with older versions, but it doesnt seem right :P only the top ones seem to be updated correctly

Edit i was doing stress tests in my application, i am using bundled sprite engine and controlling frames directly. I noticed that if i have lots of stuff in the screen but i dont change frame animation fps keeps at steady 60fps. But when i change frame, say 6/second, fps can drop to as low as 30 fps( there is collision code sumed to both cases).

I noticed that this sample does things a bit different. Even though the perfomance is good i see there are these artifacts
Attachments
artifacts.png
artifacts.png (13.57 KiB) Viewed 2906 times

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Artifacts on astrofora/starfield sample

Post by Stef » Tue Feb 19, 2019 8:56 am

Artefacts are expected as we reach the limit of sprites per line. Also there are different way of displaying these animated sprites on screen. If you re upload frame data for all sprites it will be very slow (but can be a good benchmark), if you pre upload all animations to VRAM then just change VRAM index for sprite it will be much faster (60 FPS easily).

vnsbr
Interested
Posts: 48
Joined: Sun Dec 17, 2017 4:13 pm

Re: Artifacts on astrofora/starfield sample

Post by vnsbr » Tue Feb 19, 2019 10:27 am

Nevermind, i am checking spr_test.c from samples, and seeing benchmark there, thanks :D

I guess these are these methos fastest ones?

Initialization

Animation* anim = donut.animations[0];
(...)
TileSet* tileset = anim->frames->tileset;
VDP_loadTileSet(tileset, vramIndex, TRUE);

(...) After creating sprite
SPR_setAutoTileUpload(spr, FALSE);
(...)
/* Manually set VRAM index */
SPR_setVRAMTileIndex(spr, animVramIndexes[((s >> 4) + i) & 0x7]);


Main Loop

SPR_setVRAMTileIndex(spr, animVramIndexes[((s >> 4) + i) & 0x7]);


I found it strange that in the complete initialization it is not incrementing "s" like in the main loop, maybe that is a bug.

Post Reply