I am writing a 2d game using an orthographic camera. I have two cubes rotated 180 deg in the z-axis which i use as my background. On the cubes i attached my 2 bitmaps (one on each cube). The cubes are next to each other so that the background is continuous. The trouble is that when i run the game (in the static game view it works just fine) i see
a tiny white line separating the cubes.
What can i do to eliminate this?
Due to the limitations of floating-point precision, you cannot guarantee that the positions of vertices that should be shared by two objects will actually be coincident if arbitrary transformations have been applied. Furthermore, any deviation at all can cause the type of rendering artifacts that you’re describing.
In short, you’ll have to revise your approach so that the vertices can be made to match up exactly. (Feel free to ask if you need ideas on how to do that.)
i dont mind if the cubes dont fit exactly i.e. i dont mind if there is any ovelap. In fact thats what i did, i put the first cube at (0,0,0) and the second at (299,0,0) (the cubes have size 300 in the x-dimension) so that there is an ovelap of 1 unit, but i still get the white line when i run the game. Any ideas?
What’s behind the cubes (visually)? Also, are the cubes rendered with alpha blending of any sort?
(Also, you generally don’t want overlapping coplanar or nearly coplanar surfaces either, as that can lead to z fighting.)
There is nothing behind the cubes ( the strange thing is that when the game is not running the white line is not there , only when i run the game it appears going on and off)
i use the Diffuse shader.
What does one normally do when we want to have a wide bitmapped background split into multiple cubes. The reason i use multiple cubes
is that my llevel (background) is going to be quite big(wide) and its going to be very difficult to edit a really big bitmap .
Well, there has to be something behind the cubes, even if it’s just the clear color (or the previous contents of the frame buffer or whatever).
Without seeing the project, I can’t say for sure what the white lines are. If the shapes are overlapping it might be z fighting, although that usually manifests as an irregular pattern of some sort.
Can you post a screenshot?
You could also try using planes instead of cubes. I’ve had success lining up planes precisely. The default size of a plane is 10x10 IIRC and so you can set up a series of planes as a child of one GameObject, then scale the parent up as needed and there should be no seams.
The screenshot is here: http://distantsuns.webs.com/apps/photos/photo?photoid=115847238
It seems that i can not use planes because if i rotate them 90 deg in the x-axis so that i can use them
as my background everuthing disapperars (remember i am writing a 2d game so i am using an orhographic camera)
I looked at the screenshot, but it’s a little small and I’m not really sure what I’m looking for. Could you isolate the effect and just post an image of that?
[Edit: Ok, I see the message and the arrow, but I can’t spot the effect you’re referring to.]
If you save it on your computer you can see propely. Or i can post a better image if yiu dont
edit : The effect starts from the top and almost continues until the bottom of the image
I didn’t have it at full size, but I can see it now. However, I’m not really sure what that is - it looks more like a smudge or blur than a line. (Maybe someone else will have better luck identifying the problem though.)
ok, here’s the way to view this photo… http://distantsuns.webs.com/photos/t1/screen1.jpg and zoom in. It’s appears to be incorrect alignment of the tile itself. For example, if you make them just blue, there is no “rendering artifact” or visible problem. Maybe off by a few pixels, or the way you imported the textures doesn’t clap them correctly (not exactly sure about that problem, but i’ve experienced it).
Yeah, I’ll second paulygon, try setting the Texture from Repeat to Clamp mode and see if that helps.
With respect to using planes, do you mean that it only shows the background if you rotate 90 degrees, or that the planes disappear? If the planes disappear you’re probably just rotating them the wrong way, try rotating -90 degrees instead. Planes only have one facing direction, so if you point it away from your camera it won’t render at all.
all right that did it. i changed the texture from repeat to clamp mode and it worked. thanks
Hi, I have similar problem, but it affects collisions - when my object tries to move from one tile to another, it stops and turns upside down like it hit the edge. Overlapping of the tiles doesn’t help. How to solve this?
try removing the box colliders
You could try using Unity’s Snapping tool 
starman: I need those colliders
mikesgames: thanks, that helps alot 