How To - Terrain Mirroring

Hi,

I’m very new to World Builder & I’m still figuring my way around most of the app- - So apologies if this is a very stupid question; I’m just completely confused :slight_smile:

I’ve created a tiled terrain - which I’ve imported into my app - works perfectly, all tiles side-by-side looking great.

However I need to be able to mirror the terrain horizontally - So that the edge vertices on the left of the extent match those on the right - Allowing me to tile (horizontally) infinitely tiled my terrain.

Searching through these forums, I’ve found a couple of posts (notably http://forum.world-machine.com/index.php?topic=633.msg3842#msg3842) which all talk about using ‘flippers’. Unfortunately, the examples some of the forum users provided no longer exist (the links lead to Error 404 pages).

I’m able to add flippers and flip the entire terrain (easy); but I can’t figure out how to control the process enough to produce the results I need - & I’ve no idea where I can look to find out (& I’m starting to pull my hair out in frustration).

Would anyone be able to explain/show/provide an example for how I can use the flippers to create a mirrored terrain?

In case it’s helpful - I’ve been using the ‘crater_lunar.tmd’ sample as my base for attempting this.
Though I will need to apply this process to multiple terrains once I figure how this is possible.

Any help would be amazing!

Many thanks.

As a further note - I’ve been attempting to use the Seamless Map macro to resolve this problem - However, I’m not able to get it to produce any ‘seamless’ maps.

I’d guess it’s because I’m add the macro at the correct step in the process.
When testing, I use the ‘default’ Machine World map (advanced perlin->Terriced->heightmap).
I’ve been adding the ‘seamless map’ macro between the terriced and heightmap nodes.
Though I’ve also tried placing the macro between the ‘advanced perlin’ and ‘Terriced’ nodes without success.

Adding the macro clearly affects the output heightmap (immediate changes to the extents can be seen), but not in a way that would allow me to repeat the maps seamlessly.
Equally, when zooming in on the heightmap, it’s structure very quickly changes from the original heightmap layout - I’ve attached images ‘ProcessMap’ and ‘Result’ to demonstrate what is occurring.

I’m clearly doing something/everything completely wrong here - Can anyone help?
Am I even looking at the right tool using this macro?

Not sure if this is what you want, but this is a simple way to flip horizontal or vertical. You can copy and paste each device behind the switch (this will ensure identical parameters) and flip the output of one chain and build each.

Thanks Jaf! - Testing against the default project it worked perfectly.

In your example you added the flipper/switch directly after the Advanced Perlin generator - It makes sense that I should define the final terrain before applying any filters.

However, what would you advise for more complex terrains where terrain is generated at different points in the process. Specifically, I’ve been playing around with the crater tutorial.

This uses two perlin generators in different parts of the process.
I initially tried duplicating the entire process, adding the flipper and switch after the combiner and just prior to the output processes (please see Crater1 for reference).
Also attempting to add the flipper and switch directly after the terrain generation (please see Crater2 for ref).

Neither method worked :slight_smile:

& while I can almost understand why neither process would give me the desired results; I’m not sure how I would look at a process like this to identify where I’d need to add the flip & switch? - Where would I go with Crater?

(Sorry about this, I don’t mean to bug you after you’ve just helped me out :slight_smile: )

Hmm… I didn’t try this on a more complex node setup, but I would have thought crater2 would work. I assume everything in one chain is an exact copy of the other, up to the flipper? I mean each device was copied with no further changes (unless done to both.)

I’ll try to make some time experimenting – never really tried this before. I guess we should make sure there are no activated random inputs in any of the devices – that would for sure cause a problem.

Sure seems like that should work, but maybe I’m missing your point, which is how to do the mirroring with a crater in one chain and not the other?

A while back I tried “merging” height-fields using Photoshop blending (history brush) at the seams, which seemed to work pretty good when rendered in Terragen2. There may be a way you could do that.

One of the problems with procedural geometry generation is that a change in the “procedure” ripples through the geometry so “edges” probably won’t match.

But I’m no expert on this – maybe Stephen will elaborate on this.

Thanks for getting back to me Jaf.

I assume everything in one chain is an exact copy of the other, up to the flipper? I mean each device was copied with no further changes (unless done to both.)
Yes, I cut&paste to make a copy of the original chain (not changes were made to either chain) - before adding the flip&switch.

I did finally create a seamless/mirrored terrain using crater2 (please see attached ‘x1-x0 connected seam’ image).

However, I think the main problem is with me - I’m unable to consistently produce a seamless/mirrored map.

I’ve been attempting to create very basic a seamless/mirrored terrain all day today (9am-3:40pm currently - using the default terrain and the flip/switch setup you originally suggested), unfortunately, I can only get WM to output a copy the original terrain model (please find the attached ‘DefaultFlipSwitch.tmd’) - This is despite being able to consistently produce seamless/mirrored maps since your original post on July 5th. I’ not sure what I’m doing wrong (wether I’m missing a step? not adding the processes in the required order?) - But currently nothing is working for me at all. Gah!

Edit: How did you merge the heightmaps with the history brush? I’ve been performing a general merge & a straight replacement (in both cases I load the two heightmaps on separate layers, move the top layer to it overlaps one pixel column to the very left/right (depending on the order of the heightmaps) then either merging or flattening the image - It works enough for this to be a last resort (which it will have to be if I can’t figure out how to create the seamless/mirrored maps in the next couple of days).

Hi Mumbles,

Sorry I didn’t chime in on this thread earlier, I didn’t see the critical question being asked. This issue has come up a couple times previously, but here’s the answer:

When using tiled terrains, you’re not just operating on the terrain within a self contained box – the terrain exists mathematically outside of the local terrain tile as well. Any terrain operation that tries to change the coordinate system the terrain is operating within is going to produce messed up results. This affects not just flipping but also any other geometry-based operations such as a rotation device, etc. Any devices that might be problematic like this are marked with a red exclamation point in the workview. This is definitely not very clear, and will be improved on whenever I can get it on the task list.

In more detail: within a tile, the flipper can mirror the left side pixels to the right side. With a single heightfield this is sufficient, but with a tiled terrain, it is not. As you can see by going into Layout view, each tile is flipped within itself, but the world coordinates themselves have not been mirrored; so the tiles are lined up incorrectly. This has caused enough confusion over the years that I was tempted multiple times to remove the device completely, but it is useful to have it still when it is needed.

So, what to do about it:

In a single terrain file, the flipper works fine.
In a tiled terrain, WM is not capable of doing what you need in one go.

One solution then is to have a two-part world creation. In the first part, you create your single master (but probably lower resolution) heightfield that uses the flipper device to merge things together as you see fit. Following the other techniques described here you now have a seamlessly tile-able terrain but it is a single file, not a paged terrain set. Now create a second world and import your less-detailed master heightfield into it. Do any final finishing work (erosion pass, texturing, etc) and export this world as a tiled terrain. Use the extents mask to make sure that these finishing effects do nothing to the very edge pixels of your terrain box so that your previous work in step 1 is not effected.

That makes sense - Thanks Remnant - & apologies for the delayed response!