3
\$\begingroup\$

I've created a textured cube in Blender, which I have uv-mapped like this:

enter image description here

The tiles are 256x256, and I've mapped the coordinates exactly at the edges (e.g. x: 256, y: 512). I then export my model as an fbx-file to Unity. In Unity, if I put many cubes adjacent to each other, seams appear between the cubes, like this:

Click image for a clearer view

I think I understand why this happens, because the uv-coordinates are exactly on the edges, and thus two faces sample from the same points along an edge.

I could solve this in some ways:

  • By making the uv-tiles smaller, but it would look ugly with patterns.
  • By adding some space between the tiles in the texture, and aligning the uv-coordinates to them.

My question: is there a better proper way for achieving this?


UPDATE:

So, about half a year later I still have issues with the seams. I've tried many things:

  • Start uv-coordinates at 256.5 instead of 256, and so on...
  • Turned of mipmapping.
  • Set wrap mode to clamp.
  • Set filter mode to point filter.
  • Edge padded the texture atlas with first 4px, 8px, 16px, 32px. But still bleeding occurs at certain angles. Also updated the uv-coordinates accordingly.
  • Changed my atlas to be of Power of 2 instead, i.e. 1024x1024 instead of 1024x768.
  • Set "Non Power of 2" in Unity to None so Unity doesn't rescale my texture to nearest Power of 2.
  • Set texture format to Automatic Truecolor instead of Compressed.

With 32px edge padding it actually gets a lot better, but it still isn't perfect, I guess I could go on and try even more padding, but my textures will get bigger and bigger.

I understand now that it is the mip-levels that are causing the bleeding. At far distances I don't think this is a problem, but I can see this occuring just about 5-7 units away from the player, if the player is looking down.

I believe there is something trivial about this that I'm missing. This is really a showstopper for me, forever grateful to the one who helps me solve this.

Thanks in advance!

This is how I have edge padded my texture (lines not visible on real texture), the problem does not only occur when the faces has such extremes distinct difference in colors as this one. It also occurs when the faces have patterns.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ What are the import settings for the texture? Point, Bilinear or Trilinear? \$\endgroup\$ – Savlon Jan 10 '16 at 20:19
  • \$\begingroup\$ @Savlon: Bilinear.If I change to Trilinear there is hardly no change. \$\endgroup\$ – Unresolved External Jan 10 '16 at 21:24
  • \$\begingroup\$ But it is the problem or uvs. You can see that pink tiles on top have line of red part from texture so you have to resize UVs at least little bit to adjust \$\endgroup\$ – Hamza Hasan Jan 10 '16 at 21:31
  • \$\begingroup\$ I've updated my original question. If anyone could have a look at the content below the Update heading would be great. Thanks! \$\endgroup\$ – Unresolved External Jul 26 '16 at 15:02
2
\$\begingroup\$

I would say Edge padding.
(Even if you have disabled MipMaps)

If the ‘gutters’ (blank areas between UV’s) have colors/transparencies that are very different from the colors inside the UV’d areas, then those colors can ‘bleed’ together which creates seams on the model. This problem will also occur when neighbouring UV shells have different colors; as the texture is downsampled eventually those colors start to mix.

http://docs.unity3d.com/462/Documentation/Manual/HOWTO-alphamaps.html

http://wiki.polycount.com/wiki/Edge_padding

\$\endgroup\$
0
\$\begingroup\$

I had the same problem with a very simple labyrinth I made. I tried playing around with the quality settings (Edit > Project Settings > Quality) and switched between them. I noticed that the seams were present exclusively when it was set to either "Beautiful" or "Fantastic". The main difference between Beautiful and the next best setting ("Good") was the fact that anti-aliasing (2x MSAA) was on. Turning it off for every quality setting solved the problem.

I plan on trying out another AA solution than Unity's. I read that Valve's AA (used in The Lab) is supposedly very good for VR.

(hope this helps)enter image description here

Note: yes, in my labyrinth everything is vertex-snapped.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply! I set my character to a fixed angle where a seam was visible, then I toggled between the different Quality options and the seam disappeared when I choose "Beatiful". However, as soon as I start my game and aim up and down seams are visible again at other angles. I also tried to disable MSAA, no difference. I noticed now, if I undock the Game tab and resize it seams appear differently depending on the size of the game window. Might be a clue for someone? \$\endgroup\$ – Unresolved External Aug 4 '16 at 18:24
  • \$\begingroup\$ Hey. I had this problem when my pieces were textured or untextured. What happens in your case if you remove the textures? and yes, in my case too the lines were visible depending on the camera position. Arr you sure that when you started the game the quality didn't change? \$\endgroup\$ – BlackRainbow Aug 5 '16 at 6:35
  • \$\begingroup\$ Hey @BlackRainbow, thanks for the reply! I removed the textures and the problem persists, so the problem isn't with the texture. I also tried to change the prefab for my cube to use Unity's default Cube-model instead of my own exported fbx-model, same problem. If I run Debug.Log(QualitySettings.currentLevel) it says the same name as the selected in Quality settings. The seams seems to differ if I change the Anti Aliasing level, but they never disappear. \$\endgroup\$ – Unresolved External Aug 5 '16 at 9:48
  • \$\begingroup\$ Hmmm. That's odd. In my case it completely disappears as soon as I remove AA regardless of the other settings! I'd have suggested you look into tweaking shadow quality (bias, etc) but judging from your pictures it doesn't seem to be caused by shadows. Sorry I couldn't help! \$\endgroup\$ – BlackRainbow Aug 5 '16 at 11:14
0
\$\begingroup\$

Use a separate texture for each surface of your cube. That way there is no way they can bleed into each other.

It would also be more memory-efficient to use six 256x256 textures than one 768x1024 texture, because in your large texture, 42% of the pixel-space is wasted.

It also allows you to apply different shader settings on each surface. This might be interesting when you start to use more complex materials than just single colored textures. It also allows you to highlight individual surfaces with shader properties. If you want to keep using single-colored textures, you do not need a texture at all because you can simply implement the material of each surface with a textureless material.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply Philipp! I've been thinking about this solution myself. But, this means I have to have 6 individual faces aligned to form a cube? I also need to have 6 materials one for each texture, instead of one? It would require a lot of more draw calls, since only objects sharing the same material can be batched together (correct me if I'm wrong). Will it be more efficient in contrast? \$\endgroup\$ – Unresolved External Aug 4 '16 at 18:42
0
\$\begingroup\$

If you send mesh objects with different positions to the graphics card, unity's precision is not high enough and the actual vertex positions in the graphics cards, the seams, will not be the same. hence you will see seams inside the graphics card. the further you go from origin, the bigger the rounding error will be.

If you put all your cubes on 0,0,0 and instead change their vertex positions to the positions you want, and send them all to the graphics card, they will not contain seams. they will have identical object position and seam position rounding errors sent to the graphics card.

AFAIK i solved the issue after some time and puzzling, perhaps waster 50 hours to solve it, becaues i was told that my problem was inside the game engine not the graphics card.

So... keep all cubes on zero zero zero, edit their vertex positions, rewrite all the vertices to the new positions you want the cubes to be in, otherwise the seam positions in the graphics card differ microscopically.

Its a weird error inside Unity that no one else than me knows about because i am a lame coder who never managed to code a game but i am basically a genious:) mark me down.

\$\endgroup\$
0
\$\begingroup\$

I had the same problem and it was resolved by making sure Unity treat the alpha as transparency.

Click on the actual texture, in the inspector, the texture type was "default" so I had to manually check "Alpha is Transparency".

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.