Georeferencing Problem

Started by aknight0, February 03, 2015, 09:16:12 PM

Previous topic - Next topic

aknight0

I'm having some trouble with the georeferencing feature.  I loaded in a dem in .img format, and a georeferenced image in .jp2.  Both have georeferencing turned on, but they don't line up quite right.  See the image, the bushes should be on top of the plateau, not on the side.  It's not a huge offset, but just enough to throw the scene off.  I've already tried moving the planet origin to the location of the heightfield.  Any tips on getting these synced up? I've tried several different file types with the same results.
[attachimg=1]

Oshyan

What's the source of your data? Is it freely available, something we can look at and try too?

- Oshyan

aknight0

Sure thing.  The coordinates are 38.99053° -109.76028°.  I've tried two different data sources so far.  The first is the National Map Viewer - http://viewer.nationalmap.gov/viewer/ - there I used the 1/3 arc second NED in IMG format for elevation data, and the 1 meter NAIP in JP2 format for imagery.  The second place I tried was the Utah AGRC site with elevation data here: http://mapserv.utah.gov/raster/?cat=10%20Meter%20%7BDEM%7D, and imagery here: http://gis.utah.gov/data/aerial-photography/, I tried both the HRO and NAIP image sets.  I also tried opening the data and imagery in ArcMap, and they line up fine there, which leads me to believe that the issue may be just with Terragen reading them in.  The error is small enough that it's possible may just be a lack of significant figures in the coordinates being stored.  Thanks for looking into it!

Oshyan

I'm working on reproducing this. Did you try ArcGrid data as an alternative?

- Oshyan

aknight0

Okay, I just tried it with the ArcGrid format, and the image lined up correctly this time, but the elevation data didn't come through as nicely as in the other format.  It seems flattened.
[attachimg=1]

Oshyan

Are you confident that either one has the right vertical scale? Theoretically if they both have the same georef data they should both look the same actually. They're just different formats of the same originally sampled data. I do wonder if the lower displacement is actually more correct though, and perhaps *that* is why it wasn't lining up...

- Oshyan

aknight0

I'm not entirely confident that the vertical scale is completely correct in either case, however, I have been to this particular site in person, and the actual terrain is much more similar to the first image than the second.  There are definitely large cliffs.

Oshyan

OK, that's good to know. But would you say that distant mountain looks as it should? I mean it's not too tall? Keep in mind that sharp/steep features like cliffs may be less accurately represented than you'd think due to sample spacing (10m in this case, I believe).

- Oshyan

aknight0

The background mountain also seems more to scale using the first data format.  Google Earth actually has a pretty nice 3D map of the area.  If you plug in the coordinates I posted earlier you can get a better feel for the overall terrain I'm looking at. 

Oshyan

Hehe, ironically Google Maps' version is slightly misaligned too. ;) But I see your point.

I did download the data (I think it's of the right area), but was not able to find the exact same place. I'll try again today with both heightfield data sets and see what I can come up with.

In the meantime, can you verify what version of TG you're running?

- Oshyan

Oshyan

Btw, if you could paste your camera node in here, that could be helpful (I presume it's georeferenced; are you still using the coordinate offset to 0,0,0?). Just go to the node network, select your Camera node, then Ctrl-C/Command-C (Mac), and then Ctrl-V/Paste it right in here as text. It should look something like this:

<terragen_clip>
   <camera
      name = "Render Camera"
      gui_use_node_pos = "1"
      gui_node_pos = "640 0 0"
      gui_group = "Cameras"
      show_camera_body_in_preview = "1"
      position = "-4664841.444 -8055174.436 4015052.163"
      rotation = "24.53033485 31.77147942 -106.9393712"
      light_exposure = "1"
      perspective = "1"
      fisheye = "0"
      use_horizontal_fov = "1"
      horizontal_fov = "60"
      use_vertical_fov = "0"
      vertical_fov = "40"
      focal_length_in_mm = "31.17691454"
      film_aperture_in_mm = "36 24"
      orthographic = "0"
      use_ortho_width = "1"
      ortho_width = "1000"
      use_ortho_height = "0"
      ortho_height = "1000"
      spherical = "0"
      motion_blur_position = "1"
      motion_blur_length = "0.5"
      shutter_offset = "-0.25"
      subject_distance = "100"
      aperture_diameter_in_mm = "5"
      import_position = "1"
      import_rotation = "1"
      import_fov_general = "1"
      import_Z_up = "0"
      import_rotation_order = "4"
      import_vertical_FOV = "1"
      import_focal_length = "0"
      import_focal_length_to_FOV = "0"
      do_not_import_FOV = "0"
      m_fbx_convert_to_metres = "1"
      import_offset = "0 0 0"
      import_scale = "1"
      import_filename = ""
      export_filename = ""
      stereo = "0"
      stereo_left = "1"
      stereo_centre = "0"
      stereo_right = "0"
      stereo_mode = "1"
      inter-axial_separation_in_mm = "63.5"
      zero_parallax_distance = "2.54"
      >
   </camera>
</terragen_clip>

Thanks,

Oshyan

aknight0

Haha, success!  I tried the GridFloat format, and things are lining up nicely now.  I do appreciate your help though Oshyan, thanks for putting time into this. 

If you'd still like to continue your debugging of the other formats, I'm using Terragen build 3.2.03.0.  The area overlaps two of the 1/3 arc second data tiles on the nation map viewer, so I've been bring them both in (n39w110, n40w110).  I changed the planet origin to match up with the southern tile, n29w110.  I also had to turn off border blending because I was right on the edge, which may have been my problem with the ArcGrid data. Here's my camera node:

<terragen_clip>
   <camera
      name = "Render Camera"
      gui_use_node_pos = "1"
      gui_node_pos = "640 0 0"
      gui_group = "Cameras"
      show_camera_body_in_preview = "1"
      position = "21476.23727 909.6131477 109477.0844"
      rotation = "-10 -19 0"
      light_exposure = "1"
      perspective = "1"
      fisheye = "0"
      use_horizontal_fov = "1"
      horizontal_fov = "60"
      use_vertical_fov = "0"
      vertical_fov = "40"
      focal_length_in_mm = "31.17691454"
      film_aperture_in_mm = "36 24"
      orthographic = "0"
      use_ortho_width = "1"
      ortho_width = "1000"
      use_ortho_height = "0"
      ortho_height = "1000"
      spherical = "0"
      motion_blur_position = "1"
      motion_blur_length = "0.5"
      shutter_offset = "-0.25"
      subject_distance = "100"
      aperture_diameter_in_mm = "5"
      import_position = "1"
      import_rotation = "1"
      import_fov_general = "1"
      import_Z_up = "0"
      import_rotation_order = "4"
      import_vertical_FOV = "1"
      import_focal_length = "0"
      import_focal_length_to_FOV = "0"
      do_not_import_FOV = "0"
      m_fbx_convert_to_metres = "1"
      import_offset = "0 0 0"
      import_scale = "1"
      import_filename = ""
      export_filename = ""
      stereo = "0"
      stereo_left = "1"
      stereo_centre = "0"
      stereo_right = "0"
      stereo_mode = "1"
      inter-axial_separation_in_mm = "63.5"
      zero_parallax_distance = "2.54"
      >
   </camera>
</terragen_clip>

aknight0

Here's a pic.  Bushes are on top, just like they should be.   :)

Oshyan

Ah excellent, glad you sorted it out. And you got the height scaling thing sorted as well; did you have to do anything for that, or did it just end up working somehow?

- Oshyan

aknight0

The height scale and the image match up both started working correctly when I switched over to using GridFloat instead of ArcGrid or IMG.  In theory they should be the same data, so I'm not sure what makes the difference.