0
\$\begingroup\$

LibGdx Game

I am making the above Libgdx game but I have come across the problem of really sharp images for my background if I zoom out of the world.

As you can see on the screenshot there are really sharp edges that appear surrounding the texture of the purple background.

How can I make the Texture blend well with the surrounding?

\$\endgroup\$
9
  • \$\begingroup\$ I do not know about lidgdx but i can tell you that you are placing the background using the world camera(which has view and perspective) instead of using a interface camera. You should place the background using an interface camera, and scroll it depending on the player position. What you are doing is placing the background in the world space, which is not correct. \$\endgroup\$
    – Haruko
    Dec 26, 2016 at 15:14
  • \$\begingroup\$ @Haruko - you mean OrthographicCamera? \$\endgroup\$
    – John
    Dec 26, 2016 at 16:30
  • \$\begingroup\$ OrthographicCamera is also a perspective camera, i mean the camera that you are using for the interface, the camera which cover the screen and is not based on world space positions, and has no scale and no rotation. You can use a orthographic camera with world space coordenates, for example to calculate the shadows made by directional lights. Orthographic camera doesn't mean "interface camera", it is just a type of camera which use orthographic perspective matrix. \$\endgroup\$
    – Haruko
    Dec 26, 2016 at 16:34
  • \$\begingroup\$ Did you try Texture filters? or your OrthographicCamera is too small \$\endgroup\$
    – jpm
    Dec 26, 2016 at 18:37
  • 1
    \$\begingroup\$ Oh i see. I get what you say now, i thought that you problem was that the background was not right when you were moving the camera or zooming. Well it is not that difficult to fix, you should have access to something like this: open.gl/textures You can see there that you can define if a texture should repeat or not. I searched the command for Lidgdx, texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); Just use it, do not place X textures. \$\endgroup\$
    – Haruko
    Dec 26, 2016 at 19:40

1 Answer 1

1
\$\begingroup\$

After talking with Rowland Mtetezi(the post creator), we found a way to solve his problem. The sharp edges were caused because he was using different objects with the same texture for the background, instead of using a wrap texture repeat and use just one object. Then, the solution was to use:

texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); 

To repeat the texture through the entire background, instead of placing different consecutive objects with the same texture.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .