Landscape UV seems to be slightly off on tiles other than the first tile

I am trying to use UE4 to do real world terrain rendering. I need to use real world height maps and imagery. I want to view the terrain from far distances as well as up close. While creating landscapes, I found a seam between landscape tiles that I can’t seem to get rid of. I created a simple test to show this problem, and I am interested to know if there is something I can do to fix it or if it is a bug.

I created a 2017x2017 r16 file with flat elevation. I made 3 copies and named them appropriately to be imported. During import, I selected all 3 and left the default settings. I created 2 materials. Mat00 contains a grey texture with the top and left pixel edges being light blue and the bottom and right pixel edges being dark blue. I changed the default properties of the texture to take out distortion by changing the filter to linear and the compression to UserInterface2D(RGBA). The material also includes a LandscapeCoords node that sets up the UVs for the TextureSample where I set the UV scale to 2016. Mat01 is very similar to Mat00 but the border of the texture is different colors; the top and left are pink while the bottom and right are green. I set the landscape material for the first tile to Mat00, the second to Mat01, and the third to Mat00.

When I zoom in on the border between the 1st and 2nd tiles, I see a pink seam that is approximately 1cm between the green and light blue borders.

The border between the 2nd and 3rd tiles is similar. It appears to be wrapping the texture for this 1cm and taking the color from the pixel on the other side of the texture. It is also worthwhile to note that the first tile does not show a 1cm light blue edge even though it is using the same material as the 3rd tile.

My first thought to fix this issue was to clamp the UVs instead of wrap, but clamping does not appear to work correctly on landscape tiles. It appears to be taking the top pixel and using it across the entire landscape tile.
Here is what the landscape looks like when I change the TextureSample in the materials to clamp.

You may also be interested that if I import the landscape and uncheck the flip Y coords option with the same material/texture setup, the first tile does not have the clamping issue even though it is using the same material as the 3rd tile. This implies to me that the UV coordinates are not values between 0.0 and 1.0 for all landscape tiles.

Hello GrifterG,

From what you describe and your screenshots, you created a texture that is 2017x2017 and whenever you add these tiles into your viewport you see seems.

UE4 calculates it’s textures every 2 units. Like Photoshop scaling is recommended in increments of 2 in order to avoid issues such as these. This also holds true for whole numbers.

I would like for you to test this in a fresh project with texture values of 2048x2048 and see if that fixes the issue. Let me know if it does. If not I will continue to investigate this issue at that time.

Thank you,

Hello GrifterG,

I haven’t heard from you yet. I was wondering if you were still experiencing this issue or had a chance to try the above mentioned troubleshoots?

,

Thanks for taking the time to help me. My original test was actually using a 2016x2016 texture just for testing purposes as I will ultimately want mipmapping. I originally saw this issue using a 4096 texture on 2017 elevation though. Per your request, I made a new project and used 2048x2048 textures. Here is one of my texture settings.

This is what the seam looks like between the 1st and 2nd tile. The light blue line between the blue and red should not be there.

Hello GrifferG,

I apologize for the earlier confusion. Your original size of 2017x2017. was correct.

I am linking you to our documentation on recommended landscape sizes. Please check your landscape objects and make sure that they are to our recommended specifications.

I ran a quick test and looked for the green line that is not between the first and second Landscape.

This is the result.

I will continue to investigate this issue in the meantime.

Hello Griffer G,

I haven’t heard from you yet. I was wondering if you had a chance to look at our documentation yet?

Thank you,

,

I used this documentation to get started and that is why I knew to make my height maps 2017x2017. I have figured out a lot more than what is documented there since then, but I am trying to limit our discussion to what I think is relevant to the seam. Just to be clear, my height maps are 2017x2017. I have seen the seam when applying textures of sizes 2016x2016, 2048x2048, and 4096x4096. Your image does not show a seam, but I don’t know how you created that. To see the issue as I am seeing it, it is important to apply textures with different colors on each tile. The color of the border on the top and left sides must also be different than the colors on the border of the right and bottom sides. I uploaded the 2048 images I used for the last test. Apply these via different materials to bordering tiles. I think you will see the same issue.

Hello GrifferG,

I created landscapes that are the above mentioned sizes. Multiple landscapes created using the suggested sizes and specifications mentioned on the site I linked. I imported the heightmaps at a height resolution of 2017x2017. I used a heightmap that is very busy just to amplify that seam.

I then applied three separate colored materials to each landscape, as you can see in the above linked picture. I then made sure that they were all snapping to the grid and snapped the three landscapes without overlap next to each other.

Then I duplicated the landscapes so that three tiles overlaps. This is the result in a new project.

This is the result zoomed out.

Then I recreated the same scenario with a 4096 x 4096.

These are the results starting with the zoomed in.

This is zoomed out view.

I changed up the colors just so you can see I changed up the landscapes to reflect the change in size that I did between 2017 and 4096.
I used this same test with my original post just in that one I had a square height map around the entire landscape. Just to be clear I created this using heightmaps that are grey scale and tillable. This test was recreated from scratch in a new project to make sure this wasn’t a random issue that pops up from project to project. I do not know what is causing this issue, however I would check to see that you are not overlapping on any of your tiles.

If they are not overlapping then I would try checking your maps themselves and how you created them. If you have a square straight up you need to calculate for that small part of the edge the map needs to hold onto in order to fake to push the height on the rest of your map. This may be what you are seeing.

As I cannot reproduce this issue, the only thing I can do now is test out your project specifically. For that You can either link me a Dropbox or go to our forums. From there go to advance options and search my name in the staff search section. You can send me a private message there with a link.

Thank you,

I don’t think your scenario will show my issue because you are using solid colors for each tile. The problem is that the top edge of a tile (other than the 1st tile) will show 1 cm of coloring from the bottom edge of the texture. The top and the bottom half of each texture need to be different colors in order to see if it is pulling color from the other side of the texture. This is also why I use nearest filtering for the test so that it does not pull in color from the other side of the texture as it does with trilinear filtering. Note that we should be able to use trilinear filtering and clamp the image to prevent pulling in color from the other side, but doing so smears the texture across the tile (other than the 1st tile) as if the UVs are out of range.

In my tests, I simply import my heightmaps named FlatElevation_x0_y0.r16, FlatElevation_x0_y1.r16, and FlatElevation_x0_y2.r16. I do not move the tiles created so there should be no overlap. The verts between tiles seem to match up this way even when using actual terrain. The problem is how the textures are being mapped to the tiles.

Do you want me to upload my project?

Hello SplineO,

Now that I know you are using worldmachine, which would have been good information earlier, and you are using world composition to handle your project I can now narrow this issue down even further. In the future please include any and all information that may be relevant to how you are creating your project. The only way I knew you were doing this is from your last post and your .r16 files.

I ran another test with how I had implemented the landscape. I tried with less solid colors. Same result with no seams.

Unfortunately WorldMachine does not allow for trial users to use tiling terrain. The best step moving forward is for me to look at your project directly. That way all of the guesswork is eliminated.

Thanks,