cesium-unity icon indicating copy to clipboard operation
cesium-unity copied to clipboard

for supporting i3dm

Open tomlee-dev opened this issue 4 months ago • 12 comments

Description

for supporting i3dm rendering.

note that this change is a proof of concept i3dm instanced rendering in Unity.

~~for texture and lighting~~ and animation? need to work for it. (I've not finished. I don't have time line for it)

Issue number or link

https://github.com/CesiumGS/cesium-unity/issues/416

Author checklist

  • [x] I have submitted a Contributor License Agreement (only needed once).
  • [x] I have done a full self-review of my code. ~~-[ ] I have updated CHANGES.md with a short summary of my change (for user-facing changes).~~ ~~- [ ] I have added or updated unit tests to ensure consistent code coverage as necessary.~~ ~~- [ ] I have updated the documentation as necessary.~~

Testing plan

check these url with Cesium3DTileset component.

https://sandcastle.cesium.com/SampleData/Cesium3DTiles/Instanced/InstancedWithBatchTable/tileset.json https://sandcastle.cesium.com/SampleData/Cesium3DTiles/Instanced/InstancedOrientation/tileset.json https://raw.githubusercontent.com/CesiumGS/cesium/refs/heads/main/Specs/Data/Cesium3DTiles/Instanced/InstancedTextured/tileset.json https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/refs/heads/main/1.0/TilesetWithTreeBillboards/tileset.json

lat: 40.04253068 lon: -75.61209424 height: 10.0096 image

tomlee-dev avatar Aug 21 '25 07:08 tomlee-dev

I found that there is issue of processing material in UnityPrepareRendererResources.cpp

I added fallback logic to the baseColorTexture processing of gltf 1.0 extension KHR_techniques_webgl

I tested with this tileset. https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/refs/heads/main/1.0/TilesetWithTreeBillboards/tileset.json

see the commit https://github.com/CesiumGS/cesium-unity/pull/600/commits/bb86eac27c94a3d75a17f38219c0ad16b96584c7

tomlee-dev avatar Sep 05 '25 05:09 tomlee-dev

Hi @tomlee-dev, do you have an indication when this could be implemented into the main branch. Our company would benefit from this implementation a lot.

@Patrick-van-Halm-360Fabriek I don't know. I am just a contributor :) If you need this in hurry, then just check out this remote branch and merge with your local repository and build it :)

see https://github.com/CesiumGS/cesium-unity/blob/main/Documentation~/developer-setup.md#packaging-cesium-for-unity

TomLeeLive avatar Sep 08 '25 12:09 TomLeeLive

I've found this implementation to be very laggy when loading a tileset containing lightposts for instance, is there a way to optimize it? My whole Unity Editor just starts to freeze...

@Patrick-van-Halm-360Fabriek could you give me the tile url ?

TomLeeLive avatar Sep 23 '25 13:09 TomLeeLive

@Patrick-van-Halm-360Fabriek could you give me the tile url ?

https://www.3drotterdam.nl/datasource-data/2602863a-3d22-44c2-8c95-bbf88a20bf37/tileset.json lat: 51.90656 Long: 4.488245

@Patrick-van-Halm-360Fabriek I will check it tomorrow!

TomLeeLive avatar Sep 23 '25 13:09 TomLeeLive

@Patrick-van-Halm-360Fabriek I will check it tomorrow!

Thanks in advance :)

We also found that this tileset doesn't seem to load: https://www.3drotterdam.nl/datasource-data/00a7099b-8670-4173-8ac6-d16cd6ab0ffe/tileset.json

We also found that this tileset doesn't seem to load: https://www.3drotterdam.nl/datasource-data/00a7099b-8670-4173-8ac6-d16cd6ab0ffe/tileset.json

this tileset is cmpt. I know that cmpt can embed i3dm tile. so I tried to implement some code for supporting it, but It is difficult than just showing i3dm tile. It takes time to me. and I also don't have clear time line for this too. maybe yours developer can working on this. remember that I am just a contributer not a paid freelancer :)

TomLeeLive avatar Sep 23 '25 14:09 TomLeeLive

@Patrick-van-Halm-360Fabriek Here's what I found: current implementation code is each cmpt contains I3dmInstanceRenderer component. Purpose of the component is calling the DrawMeshInstanced method and containing mesh data for that cmpt. The problem is that each cmpt calls its own mesh and DrawMeshInstanced method. It seems that the cmpt's parent object should contain the shared mesh data for instancing, and only call DrawMeshInstanced once in Update method in I3dmInstanceRenderer component of cmpt's parent object. this will be better implementation.

The current fix idea is as above, but I'm currently busy and can't work on it right away. It will take some time.

Thank you for reporting this :)

TomLeeLive avatar Sep 24 '25 01:09 TomLeeLive

@Patrick-van-Halm-360Fabriek I've just uploaded commit for cmpt, embedded i3dm. https://github.com/CesiumGS/cesium-unity/pull/600/commits/31d1a81fbc248b1f34d5868eafcd001a717c2adb but still need to improve this PR. I mean applying the idea I mentioned before.

TomLeeLive avatar Oct 02 '25 01:10 TomLeeLive