L3DT users' community
Large 3D terrain generator

Seams in stiched Terrains

Got a problem or need advice?

Re: Seams in stiched Terrains

Postby Onkelpoe » Tue Oct 14, 2014 8:31 pm

Hey Aaron,

both heightfields are generated in World Machine 3 in two seperate calculations.
The normal map was taken from the 8192x8192 calculation and is fine, without this strange seams...

Ok, I will do the suggested testing and report back.

Thanks for having a look and support!


Cheers!
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Seams in stiched Terrains

Postby Onkelpoe » Wed Oct 15, 2014 8:00 am

Ok, so I created a 4096x4096 heightfield+normal map+texture map (without any tiling/mosaic) in latest L3DT. Just 4096x4096 size, no tiling.

Then I exported optimized meshes, 2048 split size + normal (this time with UV´s hehehe)
and imported that into Unity3D. See image “Result 1”

One thing to mention: I had to set the “pixel error” to “250” to get around 3k tris. When
targeting the same number of tris from my 8192x8192 heightfield, I have to set the
“error factor” to “12”. Seems a bit weird to me, that a 4096x4096 heightfield produces
a higher resolution, than a 8192 one… or do I misinterpret this? (When setting error
to “12” for the 4096k heightfield, I get Millions of tris)

Result: The normal maps do not produce any seams :D
But: When apply the “TX” Texture maps, seams occure.


Test2:

Then I did the “duplicate Borders” on the texture map and then exported the textures layer in 2x2 mosaic 2048x2048.jpg

In Unity3D I exchanged the old “TX” with the new “duplicate borders” ones – but still seams in the texture map…


Now I am confused pretty much ^^

1. Normal maps are working straight after “export opt. mesh” (seamless)
2. Textures “TX” maps are not – even after “duplicate borders” and re-export
3. Why there is a (normal map) seam problem with my project???


Best Regards


EDIT: Next up, I will try "Unity Terrains" from the heightfield.raw tiles and see, if the normals work on that, too!
Attachments
Result1.PNG
Last edited by Onkelpoe on Wed Oct 15, 2014 10:50 am, edited 2 times in total.
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Seams in stiched Terrains

Postby Onkelpoe » Wed Oct 15, 2014 8:07 am

I also uploaded the 8192x8192 normal map (created in WM3) into my drop box, maybe that helps with testing/investigation?!

I want to import this normal map in L3DT as" Terrain Normals" - but could not find a way... When choosing "Import custom map layer", there
is no choice for "Terrain normals" (all other kinds of maps are present)...

"File-Import" does not have an "import normal map" option, too.

Hmmm, wanted to try to import my own normal map and then "export opt. meshes" and see, if that works for my "moon-project"...



Cheers!
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Seams in stiched Terrains

Postby Aaron » Wed Oct 15, 2014 1:55 pm

Hi Onkelpoe,

Thanks for running that test. I think we're nearly at the bottom of this, but I need to ask for a little more of your help to confirm my suspicions, if that's OK.

Onkelpoe wrote:But: When apply the “TX” Texture maps, seams occure.
...
In Unity3D I exchanged the old “TX” with the new “duplicate borders” ones – but still seams in the texture map…


Before I go on, I don't think you need to bother with the duplicate tile borders feature any more. The seams you're seeing aren't of the sort that can be fixed by that function.

I've seen those sorts of seams before when originally developing Sapphire (fixed nearly a decade ago). I've also seen them in other game engines I shan't name. What's going on here is that the texture coordinate wrapping mode in Unity3D is set to 'repeat' instead of 'clamp', so that when the U or V coordinates reach 1 at the tile edge, they wrap around to 0 and sample the opposite side of the texture map. If you set the coordinate mapping mode to clamp, the problem will go away. How you do this in Unity3D I have no idea, but in Sapphire I had to do this:

Code: Select all
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 


(Yes, that's oldschool OpenGL. Not using OpenGL 3/4 yet.)

Of course, that's assuming there are no seams in the texture map as exported from L3DT, which I'm prepared to believe but you may want more convincing. To test this you could paste two or three of the mesh's texture tiles together in an image editor, to see whether there are seams at the join (and I mean those really strong one-pixel wide seams that you saw in Unity3D). If there are no seams, then the problem is not the data, but the code that renders it.

Onkelpoe wrote:3. Why there is a (normal map) seam problem with my project???


I'd appreciate it if you could run a little test using World Machine. I know that the normal map of the 8192x98192px map that you already generated with WM was clear of seams, but I'd like to test whether WM will show seams when working only with the heightmap file, not with the rest of the generator network. Could I ask you to create a little WM graph where you use a file input device in WM to load that 8192x8192 heightmap TER file, then generate the normals from that, then save, with no other filters? If WM also produces seams in the normal map when generating straight from that TER file, then the problem is not in the normal map generators or file exporters of L3DT (or WM), but in the TER file itself. If this is the case, then we can tackle how the TER file came to have seams in the next installment of this saga.

Onkelpoe wrote:One thing to mention: I had to set the “pixel error” to “250” to get around 3k tris. When
targeting the same number of tris from my 8192x8192 heightfield, I have to set the
“error factor” to “12”. Seems a bit weird to me, that a 4096x4096 heightfield produces
a higher resolution, than a 8192 one… or do I misinterpret this? (When setting error
to “12” for the 4096k heightfield, I get Millions of tris)


That's nothing to worry about. This just means that the map you made in L3DT was rougher and/or steeper than the WM map. If it's a rough, steep map, then the tessellation error will need to be higher to keep the same triangle count. Or, put the other way, if you use the same tessellation error on a smooth map and a rough map, then the triangle count will be larger on the rough map and smaller on the smooth map.

Onkelpoe wrote:I want to import this normal map in L3DT as" Terrain Normals" - but could not find a way... When choosing "Import custom map layer", there
is no choice for "Terrain normals" (all other kinds of maps are present)...


Some magic here. Use the "Import new map layer" option as you were, set the layer name to 'TN', and the layer type to 'normals map'. This will overwrite the terrain normals (documented here).

Anyway, thank you for your patience, and if you have time to run those tests, thank you doubly so.

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Seams in stiched Terrains

Postby Onkelpoe » Wed Oct 15, 2014 2:16 pm

Ok, my observations:

doing the rnd 4096x4096 project in L3DT and importing into Unity 3D results:

- when exporting optimized meshes, placing the exported obj´s next to each other = no seams
- when apply the normal map = still no seams *yeah*
- when appy the texture map = seams *Oh noez* = so this is because of "repeat" instead of "clamp" settings in Unity itself?! <= setting Texture to "clamp" solves it!

- when exporting the rnd 4096x4096 heightfield as .raw 2049x2049 tiles = seams
- when apply the normal maps = seams
- when apply the texture map = seams

- when exporting the rnd 4096x4096 heightfield as .raw 2049x2049 tiles after sel. the heightfield-layer and "Layer-Dup.Borders" = seams
- when apply the normal maps = seams
- when apply the texture map = seams

So meshes are working, but "Unity Terrains" are complete fail... (see image)
(setting the texture Clamp or repeat does not matter here)


Cheers!

So maybe this is the same problem, as with the mesh .obj´s? (repeat/clamp)
Attachments
terrains.PNG
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Seams in stiched Terrains

Postby Onkelpoe » Wed Oct 15, 2014 2:33 pm

For the "WM .ter heightfield to normal map bitmap Test": WM generates the same "lines" in the normal map.
So the 8192x8192 heightfield seems to be "broken", kind of... funny thing is, I tried to do a new run to generate
a new 8192x8192.ter heightfield - but WM seems to refuse to do it in 8K res.. 2k runs fine, 4K also.. but at 8k seems like it hangs up :(

So, I got the 8193x8193. ter heightfield and the o.k. normal map - how can I use them in L3DT?
I have to re-scale the heightfield to 8192x8192, I guess - then I can get "2048" tiling meshes exported + normals and also 2049x2049.raw´s?

Best regards
Last edited by Onkelpoe on Thu Oct 16, 2014 6:32 am, edited 1 time in total.
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Summary

Postby Onkelpoe » Wed Oct 15, 2014 2:48 pm

Tiling obj meshes = solved

tiling "unity terrains" = still seams

I guess L3DT can not solve this, because it seems to be a problem, made by Unity 3D.

Like suggested, I think I give http://scrawkblog.com/2013/10/17/terrain-texturing-using-tile-mapping-in-unity/ a shot...

Maybe L3DT could (already?) do something like:

You need to add a border around the control maps so open them up in photoshop and increase the canvas size by what border size you have chosen to use. I have used a 2 pixel border. You then need to copy in the values from the control maps neighbours into this border. If the border is on a edge that does not have a neighbour just fill the border with the same values at that control maps edge.


"control map" = splat map

Cheers!
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Seams in stiched Terrains

Postby Onkelpoe » Mon Oct 20, 2014 10:49 am

Ok, so that´s it, I guess?
(as there were no other posters active, than me) :|
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Previous

Return to Help and support

Who is online

Users browsing this forum: No registered users and 18 guests

cron