Quote from: Harvey Birdman on September 06, 2007, 11:47:03 AM
Hi, Ben -
How about writing up a little procedure explaining how to use your tiling technique on a set of terrains? Or have you already? I hadn't seen anything like a step by step procedure.
Most of it is in the generation of the terrains. Terrains/reference images are exported from GlobalMapper usng UTM projection which produces a reasonable looking result with TG2's current terrain mapping. I export multiple 4097x4097 terrains at varying resolutions (e.g. 10m, 20m, 50m, 100m, 200m, 500m per pixel), centred on my area of interest. I use a spreadsheet to calculate the required numbers to enter into GM when exporting. If there are multiple areas of interest close to each other I'll create a TER for each of these, with a calculation in my spreadsheet to figure out the offset of the center of each terrain from my main reference point (this is where the UTM projection is really useful).
Each TER is then loaded into TG2 from largest to smallest (lowest to highest res), positioned by their centres (less number crunching than using lower left). With a flat terrain, the defaults for Displacement: Flatten First (ON) and Border Blending (0.1) will merge the terrains nicely, but the terrain is flat, not mapped to the planet surface. To fix this, you turn off Flatten First... but doing this also stacks the terrains on top of each other. To workaround this I created a mask to be used as a Blending shader to simulate the terrain merging of flattened terrains. If you look at the TGD above using the compact version of the clip there are a few basic inputs... width of terrain (in metres), X,Z coordinates of the centre of the terrain and the width of the blend (same usage as Border blending setting)
The following only works for terrains positioned without overlapping edges... I need to get this working before I try dealing with overlaps...
Border Blending for each terrain must be set to 0 in the heightfield shader. Each terrain is then blended by a combination of its own mask minus the mask of the next smallest terrain (subtract scalar node). The exceptions of course are the smallest terrain (only uses its own mask) and the largest terrain (apply the mask of the previous terrain and invert). As each border uses the same border blending twice (normal and inverse), the combined values for any point in the blended area should be 1 ... mask value + (1-mask value)
This post contains some screen grabs and the expanded clip.
http://forums.planetside.co.uk/index.php?topic=2036.msg20030#msg20030The test in this post
http://forums.planetside.co.uk/index.php?topic=2036.msg21346#msg21346 was successful, but it was merging two small terrains within a larger terrain so there's only a single overlay (2 TERs at most at any point). The problems seem to arise when you have more than 2 TERs in a border (in theory all of the other terrains should be at 0).
The math for my mask is hardly rocket science.... just a linear gradient for each edge (so that 0 = outer edge of TER and 1 = inner edge of border blending), clamped to 0,1 and then combined using multiply nodes.
I'll be releasing the terrains officially later, but if anyone wants a sneak preview for testing I'm loading them up here:
http://www.path.unimelb.edu.au/~bernardk/terragen/terrains/us_3peaks/files/Still filling in the data gaps. I can only access USGS in bursts... they seem to spit the dummy at me after a couple of Gb for a few days.