Introducing vetor data rendering on terrain in Unity(for WFS)

for WFS (Web Feature Service)

We can get geometry datas of point / line / polygon, i.e vector datas, from Geo Server or etc.

WFS related topic thread is here below. but I created this new topic thread for introducing.

I prototyped vector data rendering in Unity 2021.3.10f1 LTS as a proof of concept (PoC)

result. (red lines are polygon type data)


  1. studying stencil shadow volume rendering

  2. read the book / paper below.
    3D Engine Design for Virtual Globes chapter III

  3. using gdal-upm for WFS, requesting and getting vector datas. (Unity Package for GDAL, GitHub - ViRGIS-Team/gdal-upm: Unity Package for GDAL )
    for supporting Android and iOS, contribution is needed. I opened an issue. If someone interested in this, please do PR :slight_smile:
    Hello. Is there i can do for supporting Android & iOS ? · Issue #22 · ViRGIS-Team/gdal-upm · GitHub

  4. rendering order is important
    1st terrain, 2nd vector data mesh (stencil shadow volume rendering), 3rd buildings(3d tiles)
    for rendering vector data mesh. using mesh as a shadow volume for rendering. this is the point.
    I am now researching this on Unity URP for rendering optimization. my PoC is very low FPS.
    layering or render pass seperating is possible option, I think.

I’m curious someone working on this. please let me know best way to implementing this w/considering rendering performance :slight_smile:

and also I wonder if cesium dev team has a roadmap for this :slight_smile:

Hey @Tom_Lee, that looks really cool, thanks for sharing! Vector data is something we hope to work on before too long, but we don’t have any immediate plans. We’re very interested in your prototypes and your experiences implementing them in the meantime, though.

1 Like

@Kevin_Ring Howdy!

just share a secret, I purchased commercial assets and implemented stencil volume shadow rendering. FYI.

First time I was trying to implementation stencil shadow volume on Unity URP, but It was very difficult to me so I just bought commercial one for checking this shadow volume thing possible.

I changed little bit in shader for this PoC.

I’ll try to implementation my own render pass replacing the commercial asset (by customizing SRP)

Here’s good tutorial to know SRP (for those who want to customize SRP)

Now I am researching seperating render pass for rendering order.

As we know in Unity there is layer and sorting menu in inspector. I just checked the article below.

I’m now testing terrain - vector data render - 3d-tiles(building) rendering order will be ok or not with just adding layer.

currently terrain, 3d-tiles layer is “Default” but rendering order has no problem I wonder how this works. I suspect that there is option for ordering in shader graph.

1 Like

sharing my progress and a question.

for rendering order

As far as I tested and know adding layer in Unity is a feature for 2D game programming.

so I think I need to customize render pipeline (using SRP)

and also for optimization.

I applied camera frustum culling for the shadow volume meshes with AABB (Axis aligned bounding box) but this doesn’t effective for many meshes

so I wrote c# code for creating VCTR for shadow volume meshes(Vector Tiling). I haven’t written c# code for parsing VCTR yet.

VCTR specification is here. FYI.

I wonder if somenone is implementing to support VCTR for Unity.

If you are please share know-how or code with me :slight_smile:

Here’s another thread about adding support for vector data to Unreal Engine:

It may be useful for the two of you to compare notes!

Unfortunately I don’t have any particular insights for you into to how to do this. It’s something we plan to do eventually, but not something that I or anyone on the Cesium for Unreal/Unity team have looked at in depth yet.

1 Like

Thank you for sharing related thread.

I will look into it and If there is any progress, I will share it :slight_smile:

1 Like


current my work progress.

I applied quadtree & frustum culling with DOTS(Data-Oriented Technology Stack) for better performance.

still buggy and lots of to-do. and supporting VCTR still necessary (LOD, and tiling for better performance)



just sharing my current progress.

in CesiumJs there is approximateTerrainHeights.json for vector tile rendering.

the json file has data for approximate heights of terrain min max.

so I can use the values as shadow volume mesh bottom height top height.

in order to do that. I have to get quadtree id from Cesium Native method. becuase the json has data (key :quadtree-id, value: [min, max] )

I am not sure I can do PR of this entire code. in Cesium Unity I added the json in Resouce folder and I wrote some code for using it.

I just guessing this some day in future this might be necessary job for rendering VCTR with Cesium Native

so partial code is here below. FYI.

bool Cesium3DTilesetImpl::GetPositionToTile(
    const DotNet::CesiumForUnity::Cesium3DTileset& tileset,
    const DotNet::CesiumForUnity::Cesium3DTileQuadtreeId& qId,
    int level,
    double x,
    double y) {
  if (getTileset() == nullptr) {
    return false;

  TilesetContentLoader* _pLoader = getTileset()->getRootTile()->getLoader();
  if (_pLoader == nullptr) {
    return false;

  LayerJsonTerrainLoader* _pLjtLoader = dynamic_cast<LayerJsonTerrainLoader*>(_pLoader);

    if (_pLjtLoader == nullptr) {
    return false;

  const CesiumGeometry::QuadtreeTilingScheme _pX = _pLjtLoader->getTilingScheme();

  std::optional<CesiumGeometry::QuadtreeTileID> tileCoordinatesOpt =
      glm::dvec2(x, y),

  if (tileCoordinatesOpt == std::nullopt) {
    return false;

  CesiumGeometry::QuadtreeTileID tileCoordinates = tileCoordinatesOpt.value();


  return true;