- Home /
Texture UVs Shift with Camera Movement (ortho)
I'm trying to make a top-down sprite-based game, sort of like classic Zelda or Pokemon. Right now I am working on the tool that paints terrains so I can make area maps. I have a different file for each terrain, but each file contains tiles for about 120 different angles.
When the Quad for the terrain is created, it has the whole texture file as a texture. It then looks at neighbors that have the same texture and decides which UV coordinates to use. The code for this is super long (thousands of lines), so I don't think I'll be posting it.
I've got all this working fine. My problem comes in when I move the camera. As you can see in these two screen-shots, a weird line in the texture appears at one angle but disappears at another. All I have to do is move the camera. This also happens when I change zoom levels (by adjusting the orthogonal width).
Glitch Picture: Notice the brown lines in the grass, and the green lines on the right side of the grass?
Glitch Picture: Notice how the lines are now gone?
I have tried introducing blank lines to the Texture file between the Tiles and updated the UV coordinates. The problem persisted but with clear/see-through lines instead of solid colored lines as shown. The camera is in orthographic mode, so it isn't a perspective issue. It changes with angle, so it isn't a UV coordinate issue.
I would like to avoid having to make each UV coordinate it's own texture file if at all possible.
Thanks in advance.
An additional detail I've discovered:
If the Orthographic Width is 6, 8, or 12 AND the camera position does not have decimals that are not a factor of 2 then the error does not occur.
I'm managed to implement a work-around where the orthographic size snaps to either 6, 8, or 12 and the camera position movement uses [Vector3.direction] x .03125f x cameraSpeed (rather than Time.deltaTime)
This makes me think that the issue is not with the texture/renderer/UV/etc. but with some other aspect of Unity 5.
Your answer
Follow this Question
Related Questions
Tilemap: Resizing Tiles? 1 Answer
Issue mapping texture to imported quad 1 Answer
Best way to do tiling in 2D 1 Answer
Black lines between tile sprites 7 Answers
Sprites and textures appears black on Samsung Galaxy Grand I9082 0 Answers