Planetside Software Forums

General => Terragen Discussion => Topic started by: keithlostracco on May 20, 2009, 07:17:04 PM

Title: Image and Dem placement difficulties
Post by: keithlostracco on May 20, 2009, 07:17:04 PM
Hello I am working on a project where the camera will zoom in from outer space to earth and then to a specific location on Earth. I have successfully mapped an Image Shader for displacement of the continents and some other layers for continent and ocean colour, reflectivity etc. Now I am attempting to map a converted Dem file (.ter) to a specific location in North America. I know the precise size and coordinates of the Dem both in UTM (meters) and lat/long (degrees). When I set the Georeference coordinates in the Heightfield load dialog (I assume it is degrees) my Dem ended up in the ocean. I then came to realize that the center of the coordinate system of the planet was on the equator and not the pole, so my Image Shaders Artic and Antartic poles are on the equator. I have tried to find a way to rotate the textures and or the planet with no success. I know in Maya I would use the 2dTexturePlacement node to rotate the texture over the UV's of the object, but in Terragen I can't figure out how. (I'm not sure how to use the Tex Coords from XYZ). My Image shaders are mapped with Spherical projection, Position Lower Left and the Size is 1 and .5 Any help would be greatly appreciated.

[attachthumb=1]

thanks

Keith

TG2 rocks
Title: Re: Image and Dem placement difficulties
Post by: rcallicotte on May 20, 2009, 10:34:38 PM
Many have attempted something similar and Oshyan addressed one person about something similar today with encouragement that this might take some effort.  nvseal has done something like this with pretty good succss, but not with an image of Earth.  Maybe he can give you some insights.  Not a small feat.
Title: Re: Image and Dem placement difficulties
Post by: Oshyan on May 23, 2009, 06:52:39 PM
Unfortunately you can't rotate the textures on a planet currently (I assume you're using spherical mapping). You can't edit UVs in TG2. It seems like you should be able to adjust the position of your terrains to match the spherically mapped texture though. If you can figure out the maths, you ought to be able to get accurate positioning. Or am I not understanding the problem you're encountering?

- Oshyan
Title: Re: Image and Dem placement difficulties
Post by: keithlostracco on May 23, 2009, 08:07:52 PM
Thanks Oshyan, I think I can figure out the math but I am not sure of the coordinate system in TG2. In Maya (the 3d program I am most familiar with) I normally work with Cartesian coordinates, where Y is up and Z is depth. Can you explain the coordinate system in TG2, I understand Spherical coordinate's but where is 0 degrees North/South and 0 degrees West/East? Is it along the Z axis or the Y? Is Y the distance from the centre of the planet or is Y up? If you can link me to a detailed explanation or post one here I would totally appreciate it.

thanks

keith
Title: Re: Image and Dem placement difficulties
Post by: Oshyan on May 23, 2009, 08:43:43 PM
Y is "up" in TG2. The default coordinate origin is on the side of the surface of the planet. Unfortunately I can't elaborate much further than that as coordinate math escapes me a bit. ;) But if you need more info I'll try to have Jo or Matt add their thoughts here in the near future.

- Oshyan
Title: Re: Image and Dem placement difficulties
Post by: keithlostracco on May 25, 2009, 08:11:09 PM
Thanks Oshyan I would appreciate a detailed explanation from Jo or Matt

peace

keith
Title: Re: Image and Dem placement difficulties
Post by: Matt on May 26, 2009, 11:22:41 PM
You probably need to adjust the default lat-long setup in the planet node. It defaults to mapping 0,0 lat-long to the top of the planet (what Terragen calls the planet's "apex", since "north pole" is not really an accurate description). If you enter 90, 0 for the "lat long at apex" parameter in the planet node, this should map the north pole to the top of the planet and then your georeferenced heightfields should line up with your spherically projected image map. If the longitude is mismatched, you can probably compensate for that either by offsetting your georeference longitude values in the heightfield loader or by offsetting your image map in a 2D program. Or it may be possible to offset all the heightfields if you enter something other than 0 for longitude of the planet's apex, but I am not 100% sure.

EDIT: unfortunately you'll probably encounter another problem even if you align the position of the heightfield shader correctly. Heightfield always displace along the Y direction, which is not what you want when the heightfield is far away from the planet's apex (in your case the north pole).

What platform are you on (Windows or Mac)? I may be able to issue a temporary patch to allow you to displace along other directions if you're on Windows. Either way, I will get this fixed for the next update.

Matt
Title: Re: Image and Dem placement difficulties
Post by: keithlostracco on May 27, 2009, 01:31:41 AM
Awsome info, I was able to place my georeferenced data to what seems to be close to the area by changing the Lat Long at apex setting (can't believe I missed that!). I'm not sure if it is totally accurate because the displacement is extreme (probably from the Y-axis problem as you said) also the the bounding box appears twisted and not parallel to where a latitude line would be. The bounding box also seem's a little big for the size of the area. Looking at the heightfield bounding box from a different angle I just noticed that it is parallel to the apex (north pole) and not sitting at the surface angle (perpendicular to the normal). That would account for the way it appears twisted and over sized. Will the fix displace from the normal's angle of the surface or would I have to specify an angle? (displacing from the normal would be ideal) I would definitely appreciate a temporary patch (I am running windows).

Also relating to the spherical mapping tip you gave in the other georeference post, I tried changing the center of the planet and the center of the Image Map with either change the map was not positioned correctly. It appears to be positioned correctly with the default position settings of both the planet and the Image map, with the image map's size set to 1, .5 and the Position Lower Left is checked.

thanks for the help

Keith