Planetside Software Forums

General => Terragen Discussion => Topic started by: Grassynoel on February 18, 2008, 04:09:50 PM

Title: Aligning texture maps with heightfields.
Post by: Grassynoel on February 18, 2008, 04:09:50 PM
Is there an easy way to bring in a height-field from world builder (
in terregen file format) and also an image generated in that app for
texture and have them align? I seem to have to scale the texture to
something like 80000 uints to make an approximate match which seems
nonsensical. please let me know if I'm missing something.

Thanks

Glenn
Title: Re: Aligning texture maps with heightfields.
Post by: moodflow on February 18, 2008, 05:36:16 PM
I've done something very similar.  You'll need to make the image map shader have the exact coordinates and size of the terrain, and it should work.  I am assuming you already did this.  I'll give it a quick shot and see what happens.
Title: Re: Aligning texture maps with heightfields.
Post by: Grassynoel on February 18, 2008, 07:18:27 PM
I made a test 800X800 .bmp, black with white squiggles and the two don't line up. I centered the terrain @ 10,000 units large, centered the picture, scaled it to 1,000 and it was close but still out of whack.

Glenn
Title: Re: Aligning texture maps with heightfields.
Post by: Oshyan on February 18, 2008, 09:29:48 PM
First, it needs to be in PlanY projection. Image Map Shader sizes are measured in meters, like everything else. Make the size of your Image Map the same as your terrain *in meters*, and give it the same position and coordinate origin (e.g. top left) and it should work fine.

- Oshyan
Title: Re: Aligning texture maps with heightfields.
Post by: Grassynoel on February 18, 2008, 10:48:24 PM
http://www.glennmelenhorst.com/misc/terragen/misregister.zip (http://www.glennmelenhorst.com/misc/terragen/misregister.zip)
yes, I've done all of that but no dice. Here is a file with a test bmp file that  shows what I mean.

Glenn
Title: Re: Aligning texture maps with heightfields.
Post by: Oshyan on February 18, 2008, 11:09:17 PM
When loading an image to use as a heightfield the "new heightfield" sizing controls have no effect. The size is assumed to be 1:1 meters for pixels where no scaling info is present (i.e. a BMP does not have scaling info but a TER does). In this case your image is 800x800 pixels so if you set your Image Map Shader to 800 meters in size it matches. If you want to rescale your imported image-as-heightmap, use a Heightfield Resize node (easily added from the Add Operator button in the Terrain layout). Don't forget to change the Image Map Shader size to match.

- Oshyan
Title: Re: Aligning texture maps with heightfields.
Post by: Grassynoel on February 19, 2008, 02:55:55 AM
Right. Thanks for the info.

That's a fairly abstract work-flow unless you know about it. it would seem more sensible to be able to set the size of any terrain be it BMP or Ter, that would clear up any confusion.

Glenn
Title: Re: Aligning texture maps with heightfields.
Post by: Oshyan on February 19, 2008, 03:44:42 AM
You can set the size of any terrain as it is, it's just that .ter files have scaling built-in to the format, whereas .bmp does not (and this is not something we can change). So when you load a .ter it has scaling info included and a loaded .bmp will just default to 1 meter per pixel. There is no way to make an intelligent guess as to scaling.

Newly generated heightfields have sizing settings available in the Heightfield Generate, but Heightfield Load does not include size adjustments. It could do so, but there is a separate node to do these things for flexibility reasons. Although the workflow is sometimes a bit more complicated, generally it provides for greater control and power. We're not aiming to make arbitrary feature distinctions, but when it can be useful to have those functions separated (and would be confusing to duplicate them), that's the approach we take.

- Oshyan