Aligning texture maps with heightfields.

Started by Grassynoel, February 18, 2008, 04:09:50 PM

Previous topic - Next topic

Grassynoel

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

moodflow

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.
http://www.moodflow.com
mood-inspiring images and music

Grassynoel

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

Oshyan

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

Grassynoel

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

Oshyan

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

Grassynoel

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

Oshyan

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