- Home /
Ways to render a real world 3D environment given a GPS coordinate
I am attempting to display a 3d version of a real world location. Inside my Unity3D app, the user will specify the GPS coordinates of a location, then my app will have to generate a 3d plane(anything doesn't have to be a plane) of that location. The plane will show a 500 metre by 500 metre 3d snapshot of that location.
How would you suggest I achieve this in Unity3D? What methodology would you use to achieve this?
NOTE: I understand that this is a very difficult endevour(to render real world locations dynamically in Unity3d) so I expect to perform many actions to achieve this. I just don't know of all the technologies out there and which would be best for my needs
For example:
Suggested methodology 1:
Prompt user to specify GPS coords - Use Google earth API and HTTP to programmatically obtain a .khm file describing that location(Not sure if google earth provides that capability - does it?) - Unzip the .khm so I have the .dae file - Convert that file to a .3ds file using ??? third party converter(is there a converter that exists?) - Import .3ds into Unity3D at runtime as a plane(is this possible)?
Suggested methodology 2:
Prompt user to specify GPS coords - Use Google earth API and HTTP to programmatically obtain a .khm file describing that location(Not sure if google earth provides that capability - does it?) - Unzip the .khm so I have the .dae file - Parse .dae file using my own C# parser I will write(do you think its possible to write a .dae parser that can parse the .dae into an array of Vector3 that describe the height map of that location?) - Dynamically create a plane in Unity3D and populate it with my array/list of Vector3 points(is it possible to create a plane this way?) Maybe I am meant to create a mesh instead of a plane?
Can you think of any other ways I could render a real world 3d environment in Unity3D?
Assu$$anonymous$$g you can possibly get these data files, you would need to generate a model on demand and stick that in your world. I don't think Unity supports model creation within itself, so you would probably have to make it with the triangles and vertices. Which sounds like a huge pain. Why are you doing this again?
@$$anonymous$$izuho thanks for the comment. $$anonymous$$aking it with triangles and vertices is the way I expected to do it. I think a .dae file already tells me all the vertices. Do you know if I can programmatically obtain a .dae/.khm from google earth tho?
@Jake$$anonymous$$ did you find a solution to your problem? I would like to do the same, but don't know how.
hello, maybe a little bit late but, did you were able to do this?
Answer by InsideOutMonkie · Jun 19, 2012 at 08:28 AM
This answer might be useless to you, put awhile back, I took a screenshot of an area on googleearth, then I used that image as a texture on the unity3d terrain, and modeled up the landscape that way.
Peace
@Dion_Paul not useless at all. Thats exactly what I am trying to do. Render a 3d map from google earth in terms if heightmap and actual texture. Right now I am focusing on heightmap(the hardest bit). Did you do it all programmatically or did you use Google Sketchup or something? How did u get it into Unity?
I just used unity, Unity has a terrain editor built in. Using the editor just added the google earth screen shot as a terrain texture and paint it on. Once that was done, I sculpted the piece of land with the terrain editor.
Please like my answer if this helps! using the thumbs on the upper left of this box
@InsideOut$$anonymous$$onkie thanks for the reply and comments. I'm trying to like your answer but its telling me to login when I am already logged in. Unity Answers' version of Stack Overflow is messed up :P
No worries I keep getting the same message about login in Peace!
Answer by Bunny83 · Jun 19, 2012 at 11:43 AM
You should check the google API and their licenses before you attempt something like that. Especially when you want to create a commercial project you should be aware of googles copyright on all of their data.
I'm still not sure what data you want to display / use. Do you want to display a terrain with the heightmap information from google? The heightmap from google is not very accurate, so for what purpose do you want to display this information?
Next thing is: a plane is a mesh. The most simplest plane usually has 4 vertices and 2 triangles. In your case you need a Mesh with a vertex for each height sample. So it'a not really a plane (in the sense of planar) it's a mesh grid.
You can also use Unity's terrain engine and use TerrainData.SetHeights
Btw. Unity can't import any mesh data format at runtime besides assetbundles (and this text-based-scene-format afaik) which is (are) Unity pro features. There are scripts for importing obj and some other simple formats, but it wouldn't make much sense since you would need a converter to that format.
Very good point about the google API and their licenses Take that into consideration Jame$$anonymous$$, Bunny83 has a good point! lol
Actually, the images from google would make for a poor texture. Your best bet might be to use a google image as a ground reference, and paint on top of that a whole new terrain texture, it would look much more legit from an art point of view, just had to throw that in there, best of luck Jake
Answer by InsideOutMonkie · Jun 19, 2012 at 11:55 AM
Check out the cloud system on the Unity Assets store there is a free verson, it would spice up scene dramatically. If you are going for the up in the air kinda view Its very easy to learn, might take for 5 mins if that.