Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Romans_I_XVI
Roku Guru

Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

So I couldn't figure out why my games were looking distorted on my newer devices. The games look fine on say the Roku Stick or Roku 3, but on my RokuTV and Roku Ultra there was distortion. Well I finally figured it out, if you draw to a position that is in between two pixels (x: 50.5 y: 50.5 for instance) it will cause distortion on these newer devices. Now I obviously have no desire to draw to a half pixel position, I just always assumed the system would round it to the nearest int. Which is what it did, until now apparently.

Personally I think it'd be nice if this was fixed on the device level, in my opinion it's not uncommon to do movement underneath the hood at a speed less than 1 pixel per frame. So it's inconvenient to have to remember to cint() every position before drawing it to the screen. Again this is how the older devices worked. I don't know what all models are doing this, I currently only have it happening on the RokuTV and Roku Ultra.

This shows the difference, in the image on the left I'm not using cint() on the positions and on the right I am. The most obvious distortion is on the "Best" text as I'm drawing that at *.5 position.
https://i.imgur.com/lYBPC8z.jpg
0 Kudos
6 REPLIES 6
Komag
Roku Guru

Re: Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

Hmm, I can see the distortion there, and also on the direction pad on the right side and in the arrows on the left side. Yeah, it would be nice if they would fix it systematically, but I wouldn't count on it! I'm a very heavy user of Cint myself 🙂

(And this is another reason to have many Roku models to test on, you never what what's going to crop up!)
0 Kudos
squirreltown
Roku Guru

Re: Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

"Romans_I_XVI" wrote:

This shows the difference, in the image on the left I'm not using cint() on the positions and on the right I am. The most obvious distortion is on the "Best" text as I'm drawing that at *.5 position.

That is ugly for sure. It might get fixed accidentally, video does have the priority. At least it shouldn't be noticable when moving stuff.
Kinetics Screensavers
0 Kudos
NB_
Roku Guru

Re: Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

Reading initial description sounded like BFD, yet i am barely able to see a difference - and only if zoom the image full size and the specific pointers to look at "Best" and direction pads (both), there is 1 pixel fray or such.

Which functions are you using? Write a MWE that demonstrates the issue, so i can take it to the drawing powers-that-be.
0 Kudos
Romans_I_XVI
Roku Guru

Re: Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

Trust me, it looks very ugly on my big screen 4k TV. Which is sort of the point, this issue is occurring specifically on devices that can do 4k from what I see.

I'll draw up an example for you tomorrow. All you need to do is make a draw call to a .5 position.
0 Kudos
Romans_I_XVI
Roku Guru

Re: Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

Apparently scaling is botched too.
https://imgur.com/a/IVuuE

The second image is how I was drawing the game previously which was having a canvas of 854x480 and calling DrawScaledObject to a 1280x720 roScreen. The first image shows what it looks like if I just call DrawObject. So the scaling causes distortions as well.

Luckily I can just set my roScreen size to 854x480, which I don't know why I wasn't doing that before honestly. When done that way it looks good.

When I get my example together I'll try to make something that shows all these things.
0 Kudos
Romans_I_XVI
Roku Guru

Re: Bug | Distortion When Drawing To Half Pixel Position On Newer Devices

Alright, here's the example for you.
https://www.dropbox.com/s/5817ej9ifm5ne ... e.zip?dl=1

This is what it looks like on my Roku TV
https://i.imgur.com/0dAXzCG.jpg

Here's what it looks like on my Roku Stick
https://i.imgur.com/RsCBUDM.jpg

After putting together this example I now realize both the stick and my roku tv have distortion. However, I can live with the distortion on the stick much easier than I can with the distortion on the RokuTV. On the RokuTV it is like there are pixel size bites taken out of the image, where on the stick it's more just jagged edges.

Regardless, is there any reason it can't be done at a system level where any draw calls to a float position get turned in to integers before drawing? I don't see there ever being a reason to purposely draw to a half pixel position on purpose, I was obviously doing it on accident because I calculate positions mathematically. Like if I want to draw an image to the center of the screen I would get the image's width and height and divide it by two, but if that image is say 105 pixels wide, half of that would be 52.5. So I'd end up making the draw call at 640 - 52.5. Again, it's not like that's on purpose, but it's just how the math works out when calculating positions and it'd be nice to not have to worry about wrapping everything in cint().

Thanks and best regards.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.