- Home /
Atlas on Mesh rendering issue
We use sprite atlas' for each terrain material type our meshes will need, as the meshes are procedurally generated. As such, we may have one or more submeshes for our mesh. Occasionally when the player moves, a part of the tile next to the tile being displayed in the atlas will bleed through. You can stop and catch this on screen, and if you move just a smidge it will disappear.
We know it is not a problem with our mesh generation, so it either has to be some sort of feature that needs to be disabled in Unity settings, or it could be the settings on the material or sprite itself from import.
Anyway, here are some pictures of it:
Bleeding: http://imgur.com/G64I0ee
Moved a smidge to the left, no Bleeding: http://imgur.com/bK5Sakm
You can see the bleeding on the right edge of the right hole that was dug. And actually, we noticed that the boldness of the edge lines changes when we move as well. This is because tiles next to them in the atlas also have an edge and it is probably showing the edge from that tile in addition to the edge of the tile that is supposed to be drawn. So this is happening all the time, just coming and going as you move. Anybody have a solution for this?
While I've never done anything like this procedurally, third-party tools that use texture atlases have a setting for padding or some sort of pixel bleed setting. I believe the problem is that you are mapping fixed pixels into floating point uv coordinates. You may be able to mitigate in your code through some sort of rounding as you do your uv calculations.
I noticed that some people put magenta boxes around the tiles inside their atlas. Is this to prevent this very issue? I was just thinking...it only seems to bleed like 1 pixel or so...so if I had a transparent border around my tiles then it wouldn't bleed anything. But then again, when its supposed to look fine I might wind up with transparent lines around my tiles!
I've found padding to well defined values seems to work better for me - effectively ensuring things have to be on a 4 pixel defined boundary seems to work. The filtering mode of the texture also makes a difference - you want point normally in these cases I find.
So just to make sure I understand correctly...basically re-create the image and add in a few pixels of padding in between the tiles?
Yes, and play with the filter mode on the imported texture.
Answer by BlueSin · Mar 15, 2014 at 03:36 AM
Resolved. Answering my own question so I can close it out.
There were two separate problems. The first was that I needed to added transparent padding between the tiles in my atlas. The second was with my character controller's skin width.
I changed the skin width on Unity's clunky character controller and it stopped. Annoying, I hate Unity's character controller. I need to do a new one, its so clunky. Thanks all for your help!
Your answer
Follow this Question
Related Questions
How to scroll a region of texture (which is an atlas) on a mesh (which is a sprite) 2 Answers
How do you bend a 2d texture in 3d?,How do you bend a 2D object in 3D? 0 Answers
Can I use a Mesh as a Sprite Mask? 0 Answers
How do I access a texture slice's rect via scripting? 1 Answer
Tool to make ONE flat sized mesh from a png/texture? 5 Answers