Code Monkey home page Code Monkey logo

oneworldsdkforunity's Introduction

OneWorldSDK Unity Demo

The One World SDK Unity Demo showcases how to view a worldwide base terrain at multiple levels of detail with support for WGS84 coordinates. The user may fly anywhere around the world while a terrain streaming system automatically loads imagery and elevation data from disk or through web services.

With the One World SDK, the Earth can be seen from a low altitude to a high altitude. One World SDK - Earth

While connected to Bing Maps with an API key, elevation data is streamed on-the-fly for the current location. One World SDK - Mountains

Goals

We believe in leveraging the massive Unity developer base to build a realistic, whole-earth, and interactive world. One World. Free and Open-Source.

The world should be available on the devices you use from desktop to mobile devices. The Unity real-time 3D engine also has first-class support for Virtual Reality, Augmented Reality, and Mixed-Reality headsets to create immersive and highly compelling experiences.

Help us on this journey. If you have ideas to contribute to this project, join us.

Developer Setup

C# middleware libraries can be found in the src/Libraries/ directory. The src/OneWorldSDK_UnityDemo/ directory is a Unity Project with additional demo integration scripts in src/OneWorldSDK_UnityDemo/Assets/Scripts/.

  1. Open src/Libraries/OneWorldSDK.sln using Visual Studio 2019.
  2. Build the solution.
  3. Then run copy_DLLs.bat.
  4. Open the src\OneWorldSDK_UnityDemo project in Unity. (The default Unity version is 2019.4.14f1)
  5. In Unity, navigate to Assets->Scenes and double-click on the OneWorldDemo.unity scene.
  6. Press the Play button.

Camera Control

  • C - Increase altitude
  • X - Decrease altitude
  • R - Pitch up
  • F - Pitch down
  • Q - Roll counter-clockwise
  • E - Roll clockwise
  • A - Left
  • D - Right
  • W - Forward
  • S - Backward
  • Space - reset view to be looking down at the globe

Configuration

The One World SDK Unity Demo configuration file serves as a reference, and we recommend creating a local copy data/OneWorldSDK_Viewer.local.config.json for your local configuration settings to avoid accidentally committing local settings or your private API key.

Elevation

By default, no elevation will be present. Elevation can be easily supported using a Bing Maps API key:

  "elevationProviderType": "bing",
  "elevationProviderSettings": {
    "bing": {
      "apiKey": "<YOUR_API_KEY_HERE>"
    }
  }

Setup Video

Please see this video showing the steps to setup the One World SDK for Unity.
One World SDK Setup Tutorial

Demo Videos

Several videos created using the One World SDK for Unity can be found on our YouTube channel. One World SDK for Unity on YouTube

Please subscribe to our channel and give us a like if you would like to see more of this content.

Professional Services

Do you need to augment your software development team, or are you looking for an experienced team to develop a solution that leverages the One World SDK for Unity? For custom development projects, please contact [email protected]

License

The source code in this repository is licensed under the MIT License. See the LICENSE text file for full terms.

oneworldsdkforunity's People

Contributors

simblocks avatar tqdv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oneworldsdkforunity's Issues

Some scripts are missing.

I just came into contact with this library, it's 23 years now. When I finished following the process, running the scene could not operate on the earth. You can see the following warning in the console, it is missing some scripts.

image

How do I find these missing scripts?

Can't build it on Visual Studio 2019

So, I followed you instructions but I'm having errors on building the solution. Lots of NuGet packages are missing.
What if you could provide the functional Unity project instead?

太酷啦 大佬 收下我的膝盖

太酷啦 大佬 收下我的膝盖

因为我是**的,加载地球会非常满,有没有离线版本的sdk呢 比如只想要局部地区的也行

Height map tile id

I have a heightmap. However, I didn't understand how to translate the tileids of this heightmap. Can you tell me in more detail? Should I use the 3 functions written in the description? How should I do?

替换图源问题

I have attempted to replace the image sources by modifying the BirdseyeImageryMetadata.RefreshImageryMetadata() and TileToURL() methods in BirdseyeTerrainTileProvider.cs, and the WMSTileProvider.TileToURL() in WMSTileProvider.cs. However, at runtime the application still displays the original Bing images. Please advise if any other modifications are needed?

Additionally, during build, even after adding a OneWorldSDK_Viewer.config.json file in a new folder, the application only displays "Loading" and does not show the globe. Please advise how this should be handled?

Thank you very much, looking forward to your reply.

Camera jittering

Upon camera movement, I have a very strong jittering. I can see it especially in the Scene view? Does somebody know what the problem could be? Thanks in advance

Many tiles without elevation data?

I'm using the demo scene with a Bing basic/dev API key. Since the default configuration limits the maximum tile LOD to 10 I adjusted it as follows, adding the API key and increasing maxTileLOD to 16:

{
  //Settings for each elevation provider
  "elevationProviderSettings": {
    "bing": {
      //The bing API key to use
      "apiKey": "{MY_BING_API_KEY}"
  },

  // ... omit unchanged parts ...

  "tileChunkerSettings": {
    //The number of tiles that will be kept loaded in-cache at a time
    //Cached tiles don't have to be re-queried and are simply reactivated
    "numTiles": 4095,
    //The number of tiles to preload (load at startup)
    "preloadPercent": 0,
    "disablePhysics": false,
    //The number max number of tiles that will be loaded concurrently
    //Defaults to processor count
    "maxConcurrentLoad": null,
    //The LOD that features will be queried at
    "featureLoadLOD": 15,
    //The maximum LOD to create tiles at
    "maxTileLOD": 16,
    //The maximum lod to use for physics
    "maxPhysicsLOD": 10,
    //The maximum amount of time in milliseconds spend loading tiles each frame
    //Increasing this number lowers frame-rate in high-load scenarious but
    //decreases latency for loading tiles
    "loadFrameBudget": 3,
    //The size of each texture atlas, in tiles
    //The actual pixel size will be (size*size*256)
    "atlasTileSize": 1,
    //Set to true to compress textures during runtime
    //Compressing textures significantly reduces RAM usage but can cause regular frame drops
    "compressTextures": false
  },

  // ... omit unchanged parts ...
}

With these settings much higher resolution image tiles are loaded, but only a fraction of the tiles appear to have elevation data associated with them, making them stand out among lots of "flat" tiles:
lake-tahoe-missing-elevation

This image is from latitude 38.9819 longitude -119.8195 elevation 9802.8. Is this expected or am I missing a relevant setting in the configuration? Thanks!

Camera movement

Hello, I'm using the Demo and I've noticed that the CameraBase, which is the main camera, doesn't move regularly, its position keeps bouncing back and forth from 2000~-2000. I would like to try to modify its movement logic, may I know where should I modify? (I tried to read WorldObjectMovement but didn't figure out the logic)

BAT File is not working properly

The correct bat should be like this :
pathFrom variable looks into a wrong directory..

set currentDir=%cd%
set "pathFrom=%~dp0src\Bin\"
set "pathTo=%~dp0src\OneWorldSDK_UnityDemo\Assets\Plugins\"

REM COPY DEPENDENCIES
copy /y "%pathFrom%Newtonsoft.Json.dll" "%pathTo%"
copy /y "%pathFrom%Pngcs.dll" "%pathTo%"
copy /y "%pathFrom%gdal_csharp.dll" "%pathTo%"
copy /y "%pathFrom%BitMiracle.LibJpeg.NET.dll" "%pathTo%"
copy /y "%pathFrom%ogr_csharp.dll" "%pathTo%"
copy /y "%pathFrom%x86\SQLite.Interop.dll" "%pathTo%windows-x86\"
copy /y "%pathFrom%x64\SQLite.Interop.dll" "%pathTo%windows-x64\"
copy /y "%pathFrom%DotSpatial.Projections.dll" "%pathTo%"
copy /y "%pathFrom%osr_csharp.dll" "%pathTo%"
copy /y "%pathFrom%OsmSharp.dll" "%pathTo%"
copy /y "%pathFrom%OsmSharp.dll" "%pathTo%"
copy /y "%pathFrom%Npgsql.dll" "%pathTo%"
copy /y "%pathFrom%..\src\Libraries\packages\protobuf-net.2.3.7\lib\net40\protobuf-net.dll" "%pathTo%"
copy /y "%pathFrom%NetTopologySuite.dll" "%pathTo%"
copy /y "%pathFrom%BruTile.dll" "%pathTo%"
copy /y "%pathFrom%Microsoft.Bcl.AsyncInterfaces.dll" "%pathTo%"
copy /y "%pathFrom%Npgsql.dll" "%pathTo%"

copy /y "%pathFrom%System.*.dll" "%pathTo%"
del "%pathTo%System.Net.Http.dll"

copy /y "%pathFrom%sbioMath.dll" "%pathTo%"
copy /y "%pathFrom%sbioMath.pdb" "%pathTo%"

copy /y "%pathFrom%sbioOneWorldSDK.dll" "%pathTo%"

REM CONVERT PDBs TO MDBs
cd %pathFrom%
pdb2mdb.exe sbioOneWorldSDK.dll
pdb2mdb.exe sbioMath.dll
cd %currentDir%

copy /y "%pathFrom%sbioOneWorldSDK.dll.mdb" "%pathTo%"
copy /y "%pathFrom%sbioMath.dll.mdb" "%pathTo%"
pause

Error in built program of Unity

Hi, When I built Unity, the build program give me errors in the attached image, and I can't see the Earth. What could be wrong?

errors

Can Google be used instead of Bing?

As I understand it, Bing's Basic Key is causing elevation to randomly display in Unity. Issue #7 identifies the problem. However, the developer solution is that one should purchase an Enterprise Bing Maps Key. That financial impact to production starts at around $500/annually.

I notice in OneWorldSDK_Viewer.config.json we're able to specify Bing as the provider of this data. Is it possible to source the data from Google instead? Trying to find a way around the elevation problem; it's an unfortunate dealbreaker when random tiles fail to populate with data. Thank you all for your time and ideas!

No Elevation Data

I made the installation according to the tutorial. But I have no elevation on the map. What could be the problem?

image

Error after build the demo scene.

I download the whole project from GitHub, and it can run correctly in Unity Editor. But when I build the Unity demo scene and run the built program, the errors occurred and I couldn't see the earth. I used Unity 2019.4.14f1, and did not change anything.
errors

is this sdk able to work on WebGl

i built a webgl version with the demo scene and run it in browser,repeated errors:
Tile (1)[0][0]{0} Failed to load:
System.MethodAccessException: Attempt to access method 'sbio.owsdk.Services.ITerrainTileProvider.LoadTerrainTileAsyncInto' on type '' failed.
at sbio.owsdk.Unity.TerrainTileChunker+TileLoadOp+d__8.MoveNext () [0x00000] in <00000000000000000000000000000000>:0

after outputting to exe, an error will be reported when running

Error assigning 2DArray texture to 2D texture property '_MainTex': Dimensions must match
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.Material:SetTexture (string,UnityEngine.Texture)
UnityEngine.Material:set_mainTexture (UnityEngine.Texture)
sbio.owsdk.Unity.TerrainTileChunker/TileAtlasInfo:.ctor (int,byte,UnityEngine.Shader,UnityEngine.Shader,bool) (at D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/Scripts/TerrainTileChunker.cs:1564)
sbio.owsdk.Unity.TerrainTileChunker:.ctor (sbio.owsdk.Unity.TerrainTileChunker/Settings,UnityEngine.Shader,UnityEngine.Shader,sbio.owsdk.IWorldContext,sbio.owsdk.Unity.TileLoadContext,sbio.owsdk.Services.ITileMeshProvider) (at D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/Scripts/TerrainTileChunker.cs:720)
sbio.OneWorldSDKViewer.WorldChunker:Start () (at D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/UnityDemo/Scripts/WorldChunker.cs:31)

[D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/Scripts/TerrainTileChunker.cs line 1564]

Error assigning 2DArray texture to 2D texture property '_MainTex': Dimensions must match
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.Material:SetTexture (string,UnityEngine.Texture)
UnityEngine.Material:set_mainTexture (UnityEngine.Texture)
sbio.owsdk.Unity.TerrainTileChunker/TileAtlasInfo:.ctor (int,byte,UnityEngine.Shader,UnityEngine.Shader,bool) (at D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/Scripts/TerrainTileChunker.cs:1564)
sbio.owsdk.Unity.TerrainTileChunker:.ctor (sbio.owsdk.Unity.TerrainTileChunker/Settings,UnityEngine.Shader,UnityEngine.Shader,sbio.owsdk.IWorldContext,sbio.owsdk.Unity.TileLoadContext,sbio.owsdk.Services.ITileMeshProvider) (at D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/Scripts/TerrainTileChunker.cs:720)
sbio.OneWorldSDKViewer.WorldChunker:Start () (at D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/UnityDemo/Scripts/WorldChunker.cs:31)

[D:/we/OneWorldSDKforUnity-main/src/OneWorldSDK_UnityDemo/Assets/Scripts/TerrainTileChunker.cs line 1564]

Can Some Areas with High Detail and others with Low Detail?

I set the whole earth's max imagery LOD to 5, except for some small areas with higher max LOD for example 19. All the images are stored in SQLite in local PC. Before zooming to 6, it works fine, but once zoom level exceed 5 there will be the tile NULL error. My question is since some specific areas has higher images in SQLite, why theses areas can't display images with LOD larger than 5?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.