How to clear transparent pixels in Phaser 3? - pixel

I tried to remove them using TexturePacker with option: "Clear transparent pixels" but that removed part of the sprite. And this is what happened:
After that, I restored the deleted part in Aseprite. But the transparent pixels appeared again. Also tried to delete everything around sprites with Wand tool.

How avoiding the texture bleeding issues on WebGL.
Tile Extruder is a node based CLI app that automatically fixes tileset images for WebGL, so they no longer have edge bleeding where the tiles join at the sides. It's easy to build into your workflow and includes sample code showing how to use the extruded tiles in Phaser 3.
tile-extruder --tileWidth 32 --tileHeight 32 --input ./tile_jungle_ground_brown.png --output ./tile_jungle_ground_brown-extruded.png
Note: you'll have to adjust your margin & spacing because of the extrusion. If you had no margin & spacing, then the new margin is 1px and the spacing is 2px.

Related

face mask overlapping with border on spark ar studio

I've added a border on my filter and my face overlaps and it looks like my face is just floating over the border.
I've already tried changing the layers, and turning off the buttons in Advanced Render Options but still overlaps

HTML5 canvas - make a mono mask efficiently without antialiasing

I am using pixel colour inspection to detect collisions. I know there are other ways to achieve this but this is my use case.
I draw a shape cloned from the main canvas on to a second canvas switching the fill and stroke colours to pur black. I then use getImageData() to get an array of pixel colours and inspect them - if I see black I have a collision with something.
However, some pixels are shades of grey because the second canvas is applying antialiasing to the shape. I want only black or transparent pixels.
How can I get the second canvas to be composed of either transparent or black only?
I have achieved this long in the past with Windows GDI via compositing/xor combinations etc. However, GDI did not always apply antialiasing. I guess the answer lies in globalCompositeOperation or filter but I cannot see what settings/filters or sequence to apply.
I appreciate I have not provided sample code but I am hoping that someone can throw me a bone and I'll work up a snippet here which might become a standard cut & paste for posterity from that.

Achieve pixel perfect on Canvas?

I want to make exact 1-pixel thick line without distortions. (means not appeared as 2-pixel lines or 1.5-pixel lines, etc) Because it seems like the Canvas just can't stand Pixel Perfect at times.
It is also depends on CanvasScaler setting, make sure that screen/canvas output is exactly at scale 1x.
Confirm that canvas final scale is all 1x
Also confirm that your displaying game window has 1x scale so that 1 pixel show up nicely too!
(View full unscaled image in another window if sprite in above image appear jagged)
For canvas scaler setting, if you use it in other mode such as "Scale with screen size", and its reference resolution did not match current game window, it will result in non 1x scaling.
If scale is non uniform, jagged or blurry line will start to appear on canvas.
Notice the middle sword sprite.
Canvas' pixel perfect tick box helped nothing so far.
Actually, sorry. Canvases try to respect screen pixels when scaling with PixelPerfect set to true.
The solution was pretty easy - just setting PixelPerfect to false. I got so used to set it to true (because of the UI style I was going for before) that I didn't even consider turning it off. I guess that's mainly due to its name - Pixel Perfect.
xD

OpenGL es 2.0 blend issue

Now I learning OpenGL ES 2.0 with iOS and try to develop the drawing functions in iPhone.
I have success to draw a line art image and live drawing with finger, thanks to GLPaint.
Live drawing can covered the line art image, but I want the line art drawing without cover the black line.
img This is now I've done with drawing.
Is there any good blend method to do that? Thank you.
I finally done with this issue.
It's simple to use glBlendFunc:
glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
The point is
First parameter is destination color (background color), second is source color.
For default, glBlendEquation is set to GL_FUNC_ADD; if you want to do something different, please remember to change with different case.
In this issue, we don't need to change it, cause we need blend background color with brush color, and black color always cover any color when add two of them.
Make sure set "glEnable(GL_BLEND)" after draw background image.
My mistake is, setting glEnable(GL_BLEND) with compile brush shader, and draw after set all shaders.

LibGDX - Sprites to texture using FBO

I am working on a simple painting app using LibGDX, and I am having trouble getting it to "paint" properly with the setup I am using. The way I am trying to do this is to draw with sprites, and add these individual sprites into a background texture, using LibGDX's FBO commands, when it is appropriate.
The problem I am having is something relating to blending, in that when the sprites are added to this texture that I am building, any transparent pixels of the sprite that are on top of pixels that have been drawn to previous will be brightened up substantially, which obviously doesn't look very good. The following is what the result looks like, using a circle with a green>red gradient as the "brush". The top row is part of the background texture now, while the bottom one is still in its purely sprite drawn form.
http://i238.photobucket.com/albums/ff307/Muriako/hmm.png
Basically, the transparent areas of each sprite are brightening anything below them, and I need to make them completely transparent. I have messed around with many different blending mode combinations and couldn't find one that was any better. GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA for example did not have this problem, but instead the transparent pixels of each sprite seem to be lowered in alpha and even take on some of the color from the layer below, which seemed even more annoying.
I will be happy to post any code snippets on request, but my code has become a bit of mess since I started trying to fix these problems, so I would rather only put up the necessary bits as necessary.
What order are you drawing the sprites in? Alpha blending only works with respect to pixels already in the target, so you have to draw all alpha-containing things (and everything "behind" them) in Z order to get the right result. I'm using .glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

Resources