Sprite position precision -> flickers while scrolled

Hi!

I figured out, that my sprites are flickering while scrolled slowly at subpixel positions.

I read this issue https://github.com/cocos2d/cocos2d-x/issues/12847 and I want to ask where to set the precision to highp?

For me it seems like, it is done by CCGLProgram::complileShader automatically or do I have to change a predefined shader? For example: ccPositionTextureColor_vert, ccPositionTextureColor_frag?

I tried this already but see no difference on Windows machine (not tested right now on iPhone device).

As written in the mentioned issue by @ricardo, I inserted a border with 2 pixels around each frame and also add one additional pixel for extruding. Is that the right way? It makes things better but still not perfect. Means there is still a little bit of flickering.

Maybe you can share your latest findings? @UKDeveloper99 @stevetranby

Thanks in advance for your help!

Best regards,
Stefan

Just want to add. The sprites are not flickering when extruded and bordered but for my eyes but they move one pixel forward and backwards. So, I guess the precision to calculate the pixel position is not accurate.

I’ll be honest dude, I haven’t used Cocos2d for about 3 years. I can’t even remember what the issue was let alone the fix.

I think using sprite atlases helped, to the power 2 size.

Thats sad. Out of curioisty, which Engine do you use now and are there no issues with subpixel rendering?

My game development days are on a hiatus at the moment :frowning: mainly due to lack of time. If I were to use anything I’d be looking at Unreal or Unity or possibly the new Godot engine. While I do have fond memories of Cocos2D-x it just feels a little too time consuming to achieve similar things that the other major platforms can do quicker.

Did you follow Ricardo’s suggestions at the end of this issue btw? https://github.com/cocos2d/cocos2d-x/issues/12847

Unfortunately, if I round to integer pixel positions, the scrolling will not be smooth.

No the bit about using extrude 2 and something else, in texture packer options.

I am not using TexturePacker. I have used for my images a border with 2 pixels around each frame and also add one additional pixel for extruding. But I am not sure, If that’s the rright approach. In code, a SpriteFrame is created with a rect without the border and extruded pixels.

I also find a thread in chinese language where same issue occurs: https://forum.cocos.com/t/topic/40483/51 But there seems to be no solution, right? @minggo