I have a little problem. I have a tileset as background with 2 layers.
The player is a GameObject. If the Player is moving the camera is moving too (both are in a collection).
Have to say that this “problem” also is present if I just move the player (camera fix and “untouched”)
If i move the player (and cam) there are visible gridlines. More and less while moving. These lines are not in the original graphics.
How to prevent this?
These kinds of issues show up more obviously in different situations. It is the color in the adjacent tile which is bleeding through because of the way the texture atlas works. In other games, it could be resolution, or similarity of color of other tiles which makes it less obvious.
If you add extrusion in your tilesource (set Extrude Borders to 2) like Mattias says it should solve it. It copies a little bit of the edge outward for the tiles so that its own color bleeds in instead of other tiles when it happens.
Sure. When the game renders a tile it samples from the texture. When it samples and draws at the very edge of a sprite or a tile, you run the risk of getting some information from outside the tile.
In this case the sprite or tile may get a touch of green on the left and a touch of red on the right. This has to do with the fact that the renderer does not measure whole pixels normally, but could measure anywhere on the image. If it samples right between two pixels, the resulting color is a 50-50 mix.
The solution is to extrude the border of each image on the texture atlas. All around the green image, green pixels are added, around mario, white is added and around the red image red pixels are added.
The number of pixels to add depends on how the image is going to be used. If you don’t scale the image 1 pixel is enough since the renderer won’t ever sample that far outside.
I have a gui.node.box with a graphic (a texture of the player-sprite). I scale it up to 10. (The original player is just 32px). In the editor the upscaled player looks very nice with fat pixels (nice old-school). In the game its been “aliased” and smoothed which looks terrible. I’ve already played a bit with the properties of the box, but dont get a nicer result.
Got a tip?
(maybe open new threads for this questions for easier finding ?)
@stephenkalisch might seem like a silly problem, but these types of posts are very helpful to folks like me just starting out. I’ve run into the exact same issue when i was starting with defold (even worse is z position. If GO is z=1, and sprite is z=1, the sprite looks fine in editor but does not render in game. You have no idea how long it took me to find THAT problem…). As someone who reads basically every forum post on here, I’ve learned as much from other peoples’ mistakes as i have from the official defold manuals.