heightfield(load image) has constrained proportions ??? TG2 question

Started by kramdjur, September 15, 2007, 06:46:35 PM

Previous topic - Next topic

kramdjur

Hey everyone,

I am new to the forums. I have a problem in terragen2 with loading an image as a heightfield.

First, what I did was go through the tutorials for a bit. Then I decided to try and load a *.tga image as a heightfield. So I opened up tg2, I clicked the Add Terrain button and clicked heightfield(load image) and loaded a *.tga format I made beforehand in Paint Shop Pro.

But then I noticed a problem in the render preview window : the heightfield of the *.tga image is much smaller than the surrounding default plane and is enclosed by a bounding box ??? (see attachment ) So only a slight portion of the landscape is covered by the image-loaded heightmap.

Basically I attempted this to see if I could make a whole landscape based on a single pre-made image, but it doesn't seem to work. I might have overlooked something. the original dimensions of the image are 430 X 430 pixels, which I thought was going to be enough to cover the plane, but obviously I am doing something wrong.

All your help would be very much appreciated,

Many thanx in advance,

kramdjur

jo

Hi kramdjur,

This is a bit odd, I agree. I thought surely it couldn't be so, but when I checked it out myself I saw that it was. I will bring it up with Matt. I would expect that you could control the size of the area the imported image covers.

The usage of checkboxes in the Heightfield load shader is a bit iffy too.

Regards,

Jo

Oshyan

There are a number of things going on here.

First off in regards to the image "not filling the heightfield area", what you're seeing is the bounding box for the initial base heightfield generate node, *not* the one for the new one you've just created to load your image. If you disable or delete the original heightfield generate node you'll see that larger bounding box go away.

In regards to the size of the imported image, the heightfield load node tries to take the scale from the source file that is loaded. In the case of .ter files this is measured in meters and could be anything. For imported images I'm guessing it just does 1 pixel = 1 meter since there is no "point spacing" specified.

It's certainly true that there is currently no easy way of scaling the heightfield in TG2 from within the heightfield loader and that is probably a good thing to add, however given the node-based nature of the workflow it makes sense to do this in another node as well and that's exactly the approach to take. If you select your heightfield shader node in the node list then click on the Add Operator button below, you can add a Heightfield Resize node which allows you to set the size in meters. Note that this will scale the heightfield in all 3 dimensions, including vertical, so it may end up getting "taller" than you want. If so simply add a Heightfield Adjust Vertical and set the height as you please.

Essentially what you're seeing here is the result of basic image formats having no inherent "scale". Most images don't need to have one - it's not even relevant to most images (what is the "meter spacing" of a picture of your dog?) - but TG2 needs to either know or assume a scale in order to load the image. In this case it takes the most simple view of the loaded data and essentially interprets it 1:1, but tools are provided for rescaling. A more sophisticated Heightfield Load node might be justified, but it's always a struggle between complex, "do it all" nodes and simpler "building blocks"...

- Oshyan

pagan

Hi
I am new to terragen 2, (worked a bit on terragen 0.9).
I was follwing this discussion because I have not fully understand how to solve the resize problem
My input file is a terragen file with resolution of 2647 x 2647 at 100m per pixel.
As you can see from my image there is a big gap between the highfield load file and the highfield shader.
I dont mind about the gap as long as the elevation is right
Shoud I set the resize node at 2647 x 2647 Re-sample pixel or 264700 x 264700 Re-size in Meters, or should I not use the resize node at all, in order to get the right elevation?
Is this ok?
Many many thanks
Nic

Oshyan

Where did your original input .ter come from? If the scaling of the .ter was correct in the originating application, it should be correct in TG2 since the .ter format includes scaling information which TG2 respects.

It appears that it may be a DEM with a large blank area exported as part of the actual heightfield, which would explain the empty areas you noted. If it is a generated file in World Machine for example and should have no blank area, then it may be due to the issues explained earlier in this thread, namely that if you are using a second heightfield loader, the original will still display a bounding box. If you delete the original, unused one, the extra bounding box should go away. If the scale is still not what you want then use the heightfield operators as described above.

- Oshyan

pagan

Ok here is the catch...
If you use Landserf to create .ter files they need to be re-sampled.
In an E-mail from the author of Landserf:
"The .ter surface exported from LandSerf isn't actually reduced. Rather it
is padded out with zeros so that the width and height are powers of 2+1
(129, 257, 513 etc)...If you want to ensure there is no padding, you need to sample your surface
to have dimensions that are powers of 2+1. This is most easily achieved by
changing the resolution to an appropriate value (Edit->Edit Raster) and
then selecting the 'interpolate to new resolution' option before pressing
'OK' in the edit window.
For example, suppose you had a raster of 100x100 cells with an E-W and N-S
resolution of 10 units. You would change both resolution values to
10*100/129 (=7.751937) to give a new raster of 129x129 cells. This could
then be exported as a .ter file without any extra padding."


Hope this helps all you using landserf

;)