Coder Social home page Coder Social logo

Comments (9)

dukope avatar dukope commented on July 17, 2024

I've investigated this a little more. All the same nearest neighbor rasterization issues are broken again in the latest nme. Sample image here

The problem is either due to the pixel-center sampling or the (unnecessary?) rounding while converting to Fixed10. I haven't confirmed this. Both changes were made back in lime here: openfl/lime@cda7b69.

from nme.

hughsando avatar hughsando commented on July 17, 2024

This looks more like an offset issue than a scaling issue. Should be able to tell by putting a pixel at 0,0 in the bitmap and seeing where it comes out.

from nme.

hughsando avatar hughsando commented on July 17, 2024

Thinking about this again - what are you using to do the render? Tiles, bitmap, beginBitmapFill, triangles? For pixel-aligned, 1:1 scaling the smooth render should look exactly the same as the nearest-neighbour scaling.

from nme.

dukope avatar dukope commented on July 17, 2024

This is a bitmap font, which is using tiles to render. I'll grab nme-dev and try reapplying my previous fixes. I'm pretty sure the problem is related to one of the two issues I found and fixed before: either sampling from the pixel centers or the rounding before converting to Fixed10.

from nme.

dukope avatar dukope commented on July 17, 2024

To add a little more info, all tiles are set with integer pixel coordinates and hardware mode renders correctly.

from nme.

dukope avatar dukope commented on July 17, 2024

Reapplying openfl/lime@cda7b69 improves things but doesn't fix the problem completely. There are still cut-off tiles and Stage scaling problems.

I'll try to put together a simple project that illustrates the problem clearly.

from nme.

dukope avatar dukope commented on July 17, 2024

Ok. Sample project here: https://www.dropbox.com/s/utviyu3e5xuyqds/SoftwareRasterizationError.zip

It draws a grid of tiles into the main sprite, then calls BitmapData.draw() to copy the sprite into a child Bitmap for comparison. Build/run to see this:

screen shot 2014-06-29 at 1 18 19 am

Note the offset sampling on the left side. The right side is the same sprite copied into a BitmapData, which for some bizarre reason doesn't exhibit the problem. The offset sampling is dependent on the sprite's scale. Everything renders properly in hardware mode.

from nme.

hughsando avatar hughsando commented on July 17, 2024

The right side is working I think because it does the render at 1:1 and then a scale.
The sampling at the screen pixel centers was ok, and is needed, but the problem was that the bilinear sampling of the source texture coordinates needs an offset before truncation, while the nearest-neighbour sampling does not. This should be fixed now - the dependencies for bitmapfill.h are a bit screwy, so you may need a clean before a rebuild.

from nme.

dukope avatar dukope commented on July 17, 2024

Works perfectly. Thanks Hugh!

The right side is working I think because it does the render at 1:1 and then a scale.

Interesting. That gives me an idea to render to an offscreen Sprite and save some performance in software mode...

from nme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.