isImageSheetSampledInsideFrame?

  • Core: adding “isImageSheetSampledInsideFrame” display defaults, which would alter how sprite sheet frames sample textures. Setting it to true would enforce sampling inside frame with half of the texel offset

 

I just noticed this comment in the daily build updates.

I’m curious what this does exactly? Can someone explain the benefits of using this?

Hi @pouwelsjochem8,

The primary purpose of this is to prevent border artifacts when sampling frames from image sheets. See the doc here:

https://docs.coronalabs.com/daily/api/library/display/setDefault.html

Brent

Aha, I didn’t know there was a daily build documentation, I’ll remember that one!

But the isImageSheetSampledInsideFrame is indeed somewhat I thought it would be.

I am experiencing border artifacts with my pixel-art game too, which uses:

display.setDefault( "magTextureFilter", "nearest" ) -- Set nearest neighbor texture filter display.setDefault( "minTextureFilter", "nearest" ) -- Set nearest neighbor texture filter

The isImageSheetSampledInsideFrame in fact does not solve my kind of border artifacts. Well it does, but in the wrong way :stuck_out_tongue:

It looks like what this does is scale the image so the border is cut off by half a pixel, which indeed ensures there are no border artifacts anymore. But with pixelart this won’t work, as the tiles are not “pixel perfect” anymore… As seen in the screenshots below, the borders of my tiles are half a pixel now, which causes the problem that it not tiles perfectly…

Without isImageSheetSampledInsideFrame

YprngA1.png

With isImageSheetSampledInsideFrame

9uPb6VE.png

Well for now I still can use the old fashion fix for my problem, extruding the tiles in my tileset :slight_smile:

Hi @pouwelsjochem8,

The primary purpose of this is to prevent border artifacts when sampling frames from image sheets. See the doc here:

https://docs.coronalabs.com/daily/api/library/display/setDefault.html

Brent

Aha, I didn’t know there was a daily build documentation, I’ll remember that one!

But the isImageSheetSampledInsideFrame is indeed somewhat I thought it would be.

I am experiencing border artifacts with my pixel-art game too, which uses:

display.setDefault( "magTextureFilter", "nearest" ) -- Set nearest neighbor texture filter display.setDefault( "minTextureFilter", "nearest" ) -- Set nearest neighbor texture filter

The isImageSheetSampledInsideFrame in fact does not solve my kind of border artifacts. Well it does, but in the wrong way :stuck_out_tongue:

It looks like what this does is scale the image so the border is cut off by half a pixel, which indeed ensures there are no border artifacts anymore. But with pixelart this won’t work, as the tiles are not “pixel perfect” anymore… As seen in the screenshots below, the borders of my tiles are half a pixel now, which causes the problem that it not tiles perfectly…

Without isImageSheetSampledInsideFrame

YprngA1.png

With isImageSheetSampledInsideFrame

9uPb6VE.png

Well for now I still can use the old fashion fix for my problem, extruding the tiles in my tileset :slight_smile: