earth-reverse-engineering icon indicating copy to clipboard operation
earth-reverse-engineering copied to clipboard

Run in streaming into game engines (Unity, Unreal)

Open fpibbs opened this issue 4 years ago • 1 comments

The idea is to stream earth data into game engines. As a background for deeper analysis or whatever useful. I mind if anyone has tried to start the process.

fpibbs avatar Jan 30 '21 08:01 fpibbs

Probably looking at the code from the client can help put something together. I assume those engines have features to deal with octrees, frustum culling, HTTP and so on. Here's an overview of the files from the client:

  • main.cpp: Render loop, deals with the octree, requests new bulks/nodes, does culling, camera movement, decides which meshes are buffered. Calls functions from the other files
  • rocktree_util.h: Requests data from the servers and calls decoding functions
  • rocktree_http.h: HTTP. Caches some requests. The HTTP cache headers and the browser do the work in the Emscripten case. I think everything is cached for some time aside from the root meta Planetoid.
  • rocktree.proto, rocktree_decoder.h, rocktree_ex.h: Decode raw data. First protobuf, then postprocessing, then putting it in a form so it fits our octree data type and can be rendered
  • rocktree_types.h: Octree data structure with meshes, textures, matrices and download state. Grows/shrinks based on camera position. Instantiated in main
  • rocktree_math.h: Math functions for frustum culling and camera
  • rocktree_gl.h: Graphics binding. The interesting part here is the octant masking. The meshes can be sub-divided with these masks and help with level of detail. This mask binding can be improved by packing it into a smaller uniform value and unpacking it in the shader.

The crucial part is the decoding of the meshes. Everything else depends on how exhaustive and optimized it should be.

retroplasma avatar Feb 19 '21 16:02 retroplasma