From 04767061737967da141d93c781882146b282cd47 Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Tue, 15 Oct 2024 14:54:12 +0200 Subject: [PATCH 1/8] release 2.9.0 --- README.md | 2 ++ src/i3dm.export.csproj | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d766599..4b6623f 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,8 @@ Press F5 to start debugging. ## History +2024-10-15: release 2.9.0: add tileset version option + 2024-08-01: release 2.8.3: fix release 2024-08-01: release 2.8.2: fix for I3dm using rtc_center for high precision positions diff --git a/src/i3dm.export.csproj b/src/i3dm.export.csproj index e28cb72..52967f9 100644 --- a/src/i3dm.export.csproj +++ b/src/i3dm.export.csproj @@ -5,9 +5,9 @@ net8.0 i3dm.export ./nupkg - 2.8.3 - 2.8.3 - 2.8.3 + 2.9.0 + 2.9.0 + 2.9.0 https://github.com/geodan/i3dm.export https://github.com/geodan/i3dm.export git From 45961d7d30be7244f9eeb74d670ab43eaa282a17 Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Wed, 16 Oct 2024 16:26:13 +0200 Subject: [PATCH 2/8] Handle gpu instancing tags is all null for a tile --- src/GPUTileHandler.cs | 25 +++++++++++++++---------- tests/TileHandlerTests.cs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/GPUTileHandler.cs b/src/GPUTileHandler.cs index b232c14..d0979ba 100644 --- a/src/GPUTileHandler.cs +++ b/src/GPUTileHandler.cs @@ -25,19 +25,24 @@ public static byte[] GetGPUTile(List instances, bool UseScaleNonUnifor settings.GpuMeshInstancingMinCount = 0; var model = sceneBuilder.ToGltf2(settings); - var schema = AddMetadataSchema(model); + if (instances.Any(s => s.Tags != null)) + { - var distinctModels = instances.Select(s => s.Model).Distinct(); + var schema = AddMetadataSchema(model); - var i = 0; + var distinctModels = instances.Select(s => s.Model).Distinct(); - foreach (var distinctModel in distinctModels) - { - var modelInstances = instances.Where(s => s.Model.Equals(distinctModel)).ToList(); - var featureIdBuilder = GetFeatureIdBuilder(schema, modelInstances); - var node = model.LogicalNodes[i]; - node.AddInstanceFeatureIds(featureIdBuilder); - i++; + + var i = 0; + + foreach (var distinctModel in distinctModels) + { + var modelInstances = instances.Where(s => s.Model.Equals(distinctModel)).ToList(); + var featureIdBuilder = GetFeatureIdBuilder(schema, modelInstances); + var node = model.LogicalNodes[i]; + node.AddInstanceFeatureIds(featureIdBuilder); + i++; + } } foreach (var node in model.LogicalNodes) diff --git a/tests/TileHandlerTests.cs b/tests/TileHandlerTests.cs index 80dbcc1..51ff14f 100644 --- a/tests/TileHandlerTests.cs +++ b/tests/TileHandlerTests.cs @@ -13,6 +13,35 @@ namespace i3dm.export.tests; public class TileHandlerTests { + [Test] + public void GetGpuTileWithoutTagsTest() + { + Tiles3DExtensions.RegisterExtensions(); + + // arrange + var instances = new List(); + var instance = new Instance(); + instance.Position = new Wkx.Point(1, 2, 0); + instance.Scale = 1; + instance.Model = "Box.glb"; + instances.Add(instance); + + // act + var tile = GPUTileHandler.GetGPUTile(instances, UseScaleNonUniform: false); + + var fileName = Path.Combine(TestContext.CurrentContext.WorkDirectory, "instancing_tile_without_tags.glb"); + File.WriteAllBytes(fileName, tile); + + var model = ModelRoot.Load(fileName); + + // assert + // Model only contains the EXT_mesh_gpu_instancing extension, no other extensions + Assert.That(model.ExtensionsUsed.Count() == 1); + Assert.That(model.ExtensionsUsed.First() == "EXT_mesh_gpu_instancing"); + + Assert.That(tile.Length > 0); + } + [Test] public void GetGpuTileTest() { @@ -34,6 +63,8 @@ public void GetGpuTileTest() File.WriteAllBytes(fileName, tile); var model = ModelRoot.Load(fileName); + Assert.That(model.ExtensionsUsed.Count() == 3); + var extInstanceFeaturesExtension = model.LogicalNodes[0].GetExtension(); var extStructuralMetadataExtension = model.GetExtension(); From a96c6215a57a902c377b137183ce1a4fc2a50fde Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Thu, 17 Oct 2024 09:21:20 +0200 Subject: [PATCH 3/8] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b6623f..8f74358 100644 --- a/README.md +++ b/README.md @@ -148,11 +148,14 @@ Only the i3m files should be copied to a production server. When parameter 'use_external_model' is set to true, only the model name will be stored in the i3dm payload. In the i3dm header the value 'gltfFormat' is set to 0. In this case, the model should be a valid absolute or relative url to the binary glTF. The client is responsible for retrieving the binary glTF's. Both the i3dm's and binary glTF's should be copied to a production server. +Option 'use_external_model' is only available when '--use_gpu_instancing' is false. ## Composites Starting release 2.0, for every tile there will be a composiste tile (cmpt) - even if there is only 1 model available in the tile. -Specs see https://docs.opengeospatial.org/cs/18-053r2/18-053r2.html#249 . The composite tile contains a collection of instanced 3d tiles (i3dm), for each model there is 1 i3dm. +Specs see https://docs.opengeospatial.org/cs/18-053r2/18-053r2.html#249 . +The composite tile contains a collection of instanced 3d tiles (i3dm), for each model there is 1 i3dm. +When option --use_i3dm is set to true, only I3dm's are created. When there are multiple models in a tile only the first one is used. ## Implicit tiling From 9cbb7dfc0e630909ad9be51a3f278474a30bd0e6 Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Thu, 17 Oct 2024 13:49:46 +0200 Subject: [PATCH 4/8] add testfixtures --- tests/TileHandlerTests.cs | 15 ++++++++------- tests/i3dm.export.tests.csproj | 7 +++++-- tests/{ => testfixtures}/Box.glb | Bin tests/testfixtures/tree.glb | Bin 0 -> 24796 bytes 4 files changed, 13 insertions(+), 9 deletions(-) rename tests/{ => testfixtures}/Box.glb (100%) create mode 100644 tests/testfixtures/tree.glb diff --git a/tests/TileHandlerTests.cs b/tests/TileHandlerTests.cs index 51ff14f..dd2c2ca 100644 --- a/tests/TileHandlerTests.cs +++ b/tests/TileHandlerTests.cs @@ -23,7 +23,7 @@ public void GetGpuTileWithoutTagsTest() var instance = new Instance(); instance.Position = new Wkx.Point(1, 2, 0); instance.Scale = 1; - instance.Model = "Box.glb"; + instance.Model = "./testfixtures/Box.glb"; instances.Add(instance); // act @@ -52,7 +52,7 @@ public void GetGpuTileTest() var instance = new Instance(); instance.Position = new Wkx.Point(1, 2, 0); instance.Scale = 1; - instance.Model = "Box.glb"; + instance.Model = "./testfixtures/Box.glb"; instance.Tags = JArray.Parse("[{'id':123},{'name': 'test'}]"); instances.Add(instance); @@ -87,7 +87,7 @@ public void GetTileTest() var instance = new Instance(); instance.Position = new Wkx.Point(1, 2); instance.Scale = 1; - instance.Model = "Box.glb"; + instance.Model = "./testfixtures/Box.glb"; instances.Add(instance); // act @@ -106,6 +106,7 @@ public void GetTileTest() [Test] public void GetCompositeTileTest() { + // arrange var instances = new List(); var instance = new Instance(); @@ -153,7 +154,7 @@ public void GetTileWithScaleNonUniformTest() var instance = new Instance(); instance.Position = new Wkx.Point(1, 2); instance.ScaleNonUniform = scaleNonuniform; - instance.Model = "Box.glb"; + instance.Model = "./testfixtures/Box.glb"; instances.Add(instance); // act @@ -197,12 +198,12 @@ public void GetTileWithRtcCenterTest() var instances = new List(); var instance = new Instance(); instance.Position = new Wkx.Point(1, 2); - instance.Model = "Box.glb"; + instance.Model = "./testfixtures/Box.glb"; instances.Add(instance); var instance1 = new Instance(); instance1.Position = new Wkx.Point(10, 20); - instance1.Model = "Box.glb"; + instance1.Model = "./testfixtures/Box.glb"; instances.Add(instance1); // act @@ -224,7 +225,7 @@ public void GetTileWithTagsTest() var instances = new List(); var instance = new Instance(); instance.Position = new Wkx.Point(1, 2); - instance.Model = "Box.glb"; + instance.Model = "./testfixtures/Box.glb"; var tags = JArray.Parse("[{'id':123},{'name': 'test'}]"); instance.Tags = tags; instances.Add(instance); diff --git a/tests/i3dm.export.tests.csproj b/tests/i3dm.export.tests.csproj index c3ebb34..db631cb 100644 --- a/tests/i3dm.export.tests.csproj +++ b/tests/i3dm.export.tests.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -17,7 +17,10 @@ - + + PreserveNewest + + PreserveNewest diff --git a/tests/Box.glb b/tests/testfixtures/Box.glb similarity index 100% rename from tests/Box.glb rename to tests/testfixtures/Box.glb diff --git a/tests/testfixtures/tree.glb b/tests/testfixtures/tree.glb new file mode 100644 index 0000000000000000000000000000000000000000..70c751ac49982cd4307ab08fbaf2e8f17e453c12 GIT binary patch literal 24796 zcmbV#2Uu1|6YlN-dyTz|*iaF_UeIqB1w|~Nh{P@kC@2WhL~JNF6ie(a#@<_OvA{X@ z5*3Y6V@vGOn8X;P#%Q8 zL^p$%&CBRzF}ZuXr$!|v#l#O6WP_K^eXOT@ctk{0Qc`?klDl``(e8s%1`m!(42_8z z>F%xbbdQLSONbvHH9R?FR6>-yw^?s6I)y32#ncv)!P7lCU+&(+w{4fU!9rbO4f_A4 z!SY` zj`Oig)bJt6(eB=Q;i}k;@Wdg`s4$xB7URFh{Kw!AY&_m-)fE|U_#fkKVjT<5|Nk~# zZ?V|L+F}FDdZSnv?7;srz@WDoiddkxnEzeAk4uLZ$e_2|jZQ*LT=uza??uB8g(cV?T^a7?jvGDmgqhHYOrCK4nPsaFIUFL>v^J6y+Nq z8=n{wm6n{6DAHxLd(802C=t*)k!Nuq$8-pf$WKz+tE5{hgBy zkB|JQJUKCZcv5V5a()fzYx2@rEe4a>sI%G)2BXF3Y4#E+DU!@?x105Pt3E%=bUL%( z*i9yb&SEfHotc^#pA1TLUV4kjX|wppU@_}NmYO|vURJZ&W)s31*IUIKqg`Z@#mjCmTb+f*Vl^4{7E@7+g$ZV(MN}S}!CKg9X;wAhyLxbbvlLJKtyLk+WO&;tPpBN*)==s^_CNe!SCaqci)*%Pb z_WnCKPN;}=i-=E5jEZpPzihBG2MeY5|DX3_FN9wo+!wiGw3|gSaIRcY(Z7y{Bt}Jf z4IY$M)E(Qu6mX{~#Tgid>qJY@CU}{RB5W)=gUBamkXenwD$#YA?aq>9%ug2G|Fyd! z+y2LH8;oWzi(UkRs3FcmD2geFLf;{{_qw2K>4UX-<+iQl*9;;f8x{P40WN# ziQU|O=}AbtfI!jdQlbzS;!28<;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*qK&U;_5#a@$G?EOVd z=RcWkExnuhhhx8Ntp%YD6@x%T>& z!8p(Z`eD9T)z`3FFP0U|3-5jA9%J*v&J>IXIq>2Aq0~P4^MD;NFT^j*3;uvS$KS?o zWoH%mH~&fk^EoxCU>#uG$%svCY4r&OaS!uD9)KMn2fd&V^h7>i${HMBH6RSHWs^K2#YNrUQjpozn;M|x({P8|E1}lv9#V(3V84y=7FCe2R`I8=->L- z!A`r6W?}lttXIuo27GuAcEY^y9^_CD;C1;0hxbrtZ#|g7y2ZLN&Y_=ma; z`2z8ozOfs-^m0o^_B4eT%M zE5v1<_*nw2R$z;)2D=~;u z@FS_&Anq}3H(PxsjBj1>RY9LUFtriy7?@X}zvwvy=7+uy`X=bR;M@Yw&=-On`Ysp; z=NWj0^A5-}0|K`D@oj1${a6&(Qb7ydZ~tfqjLa z9as0}C6A0}&|gCz1O3UY;znkhQ=*_h@lW((zuc|NK<=}v8oSv0g`>1*WtQBP!mwaykySQ<-1D>JIfgGOud^?%V>G;Y4 z=K^?!a|6hM56_?n^h3Wm=a!A_ys+7E?r~4H^6*IqcVBK}^p^A#ENpRkXx&(LqeIN*aE zo{RRY@E+u_ZcuO6y3AtPC0rQD;koE{3HAYaP*1Cr$zndbYHZS`Z05J1YC)ZaXI}2{!hHmM=in!NM`0bZx&``|D_u+c-vUUvfR28_;%7zY?~=vEpY{KE zA1;2l4r$x9Eum9Z>K`v0D4t6tbnKl(NSR8`-}KV=% dhYu5Szl+PX>p!LYiZLXheW2g=c3~3*{6Doe437W+ literal 0 HcmV?d00001 From 646e882ea0c36271facaaa56823208c53841a236 Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Thu, 17 Oct 2024 14:06:24 +0200 Subject: [PATCH 5/8] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f74358..dba2f80 100644 --- a/README.md +++ b/README.md @@ -286,7 +286,11 @@ Warning: When the input glTF model has transformations, the model will be transf cases it's better to remove the transformations from the input model. For example tool 'gltf-tansform' - function clearNodeTransform (https://gltf-transform.dev/modules/functions/functions/clearNodeTransform) can be used to clear local transformations. -- Known issue: Getting attributes in Cesium does not work when there are multiple input models +Known issues GPU Instancing: + +- #81: Trees rotation/ z placement wrong + +- Getting attributes in Cesium does not work when there are multiple input models https://community.cesium.com/t/upgrade-3d-tileset-with-composite-cmpt-tile-to-1-1-attribute-data-missing/33177/2 ## Developing From 636cad8a74814dcd4ff4b414134f127de69f4cfb Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Thu, 17 Oct 2024 14:07:34 +0200 Subject: [PATCH 6/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dba2f80..6e44bb4 100644 --- a/README.md +++ b/README.md @@ -288,7 +288,7 @@ used to clear local transformations. Known issues GPU Instancing: -- #81: Trees rotation/ z placement wrong +- https://github.com/Geodan/i3dm.export/issues/81: Trees rotation/ z placement wrong - Getting attributes in Cesium does not work when there are multiple input models https://community.cesium.com/t/upgrade-3d-tileset-with-composite-cmpt-tile-to-1-1-attribute-data-missing/33177/2 From 20a0fb33d2d17132d803f653fc39bc7c43bdd4ca Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Tue, 22 Oct 2024 14:42:27 +0200 Subject: [PATCH 7/8] update verticals --- src/GPUTileHandler.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/GPUTileHandler.cs b/src/GPUTileHandler.cs index d0979ba..faf07cb 100644 --- a/src/GPUTileHandler.cs +++ b/src/GPUTileHandler.cs @@ -47,7 +47,8 @@ public static byte[] GetGPUTile(List instances, bool UseScaleNonUnifor foreach (var node in model.LogicalNodes) { - node.LocalTransform *= Matrix4x4.CreateTranslation(translation); + var tra = new Vector3((float)translation.X, (float)translation.Y, (float)translation.Z); + node.LocalTransform *= Matrix4x4.CreateTranslation(tra); } var bytes = model.WriteGLB().Array; @@ -73,7 +74,7 @@ private static StructuralMetadataClass AddMetadataSchema(ModelRoot gltf) return schemaClass; } - private static SceneBuilder AddModels(IEnumerable instances, Vector3 translation, bool UseScaleNonUniform) + private static SceneBuilder AddModels(IEnumerable instances, Point translation, bool UseScaleNonUniform) { var sceneBuilder = new SceneBuilder(); @@ -88,7 +89,7 @@ private static SceneBuilder AddModels(IEnumerable instances, Vector3 t return sceneBuilder; } - private static void AddModelInstancesToScene(SceneBuilder sceneBuilder, IEnumerable instances, bool UseScaleNonUniform, Vector3 translation, string model) + private static void AddModelInstancesToScene(SceneBuilder sceneBuilder, IEnumerable instances, bool UseScaleNonUniform, Point translation, string model) { var modelInstances = instances.Where(s => s.Model.Equals(model)).ToList(); var modelRoot = ModelRoot.Load(model); @@ -103,7 +104,7 @@ private static void AddModelInstancesToScene(SceneBuilder sceneBuilder, IEnumera } } - private static SceneBuilder GetSceneBuilder(IMeshBuilder meshBuilder, Instance instance, bool UseScaleNonUniform, Vector3 translation, int pointId) + private static SceneBuilder GetSceneBuilder(IMeshBuilder meshBuilder, Instance instance, bool UseScaleNonUniform, Point translation, int pointId) { var transformation = GetInstanceTransform(instance, UseScaleNonUniform, translation); var json = "{\"_FEATURE_ID_0\":" + pointId + "}"; @@ -112,7 +113,7 @@ private static SceneBuilder GetSceneBuilder(IMeshBuilder meshBu return sceneBuilder; } - private static AffineTransform GetInstanceTransform(Instance instance, bool UseScaleNonUniform, Vector3 translation) + private static AffineTransform GetInstanceTransform(Instance instance, bool UseScaleNonUniform, Point translation) { var point = (Point)instance.Position; @@ -126,7 +127,7 @@ private static AffineTransform GetInstanceTransform(Instance instance, bool UseS var instanceQuaternion = Quaternion.CreateFromYawPitchRoll((float)instance.Yaw, (float)instance.Pitch, (float)instance.Roll); var res = Quaternion.CreateFromRotationMatrix(m4); - var position2 = position - translation; + var position2 = new Vector3((float)(position.X - translation.X), (float)(position.Y - translation.Y), (float)(position.Z - translation.Z)); var scale = UseScaleNonUniform ? new Vector3((float)instance.ScaleNonUniform[0], (float)instance.ScaleNonUniform[1], (float)instance.ScaleNonUniform[2]) : @@ -199,8 +200,8 @@ private static Matrix4x4 GetTransformationMatrix((Vector3 East, Vector3 North, V m4.M33 = forward.Z; return m4; } - private static Vector3 ToYUp(Point position) + private static Point ToYUp(Point position) { - return new Vector3((float)position.X, (float)position.Z, (float)position.Y * -1); + return new Point((double)position.X, (double)position.Z, (double)position.Y * -1); } } From f32bf5709d032209bcf56dd620b42b65b99163bb Mon Sep 17 00:00:00 2001 From: Bert Temme Date: Wed, 23 Oct 2024 11:12:20 +0200 Subject: [PATCH 8/8] set default scale to 1 --- src/Instance.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Instance.cs b/src/Instance.cs index ec232f8..53c43eb 100644 --- a/src/Instance.cs +++ b/src/Instance.cs @@ -5,6 +5,10 @@ namespace i3dm.export; public class Instance { + public Instance() + { + Scale = 1; + } public Geometry Position { get; set; } public double Scale { get; set; }