Comments (9)
I've investigated this a little more. All the same nearest neighbor rasterization issues are broken again in the latest nme.
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.
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.
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.
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.
To add a little more info, all tiles are set with integer pixel coordinates and hardware mode renders correctly.
from nme.
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.
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:
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.
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.
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)
- Crash caused by preemptive mode HOT 2
- fix continues integration HOT 3
- make tooling lix compatible HOT 2
- [QUESTION] Flash Player Emulator HOT 3
- relatively rare timer crash. can't get why yet HOT 7
- [QUESTION] How accurate cubicTo method? HOT 2
- Issue with clipboard getdata on Android HOT 2
- Window close events
- Incompatibility with SWF library HOT 4
- Unable to run sample project on Linux HOT 3
- nme setup fails on M1 Mac
- CapabilitiesGetScreenDPI on Mac retina display concern HOT 8
- Video player on android 11 issue HOT 1
- nme build is adding empty `-cp`s
- Build Error: Invalid character: / HOT 3
- nme build neko create an empty output file.
- xcode 14.0.1 NME app hang risk warning
- Cant compile NME for android with latest hxcpp changes
- nmehost download site has been taken over, please do not visit till Hugh has resolved. HOT 1
- ByteArray writeFile doesnt work on iOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nme.