Skip to content

Commit

Permalink
feat: PiXYZ culling (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalkia authored Jun 12, 2024
1 parent eb71714 commit 8b7b95e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-lod-conversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
include:
- lodLevelsToTest: ["500", "3"]
files: "QmTpsFiaJVPv5mU6ERBzkDcZ39Lyq9sEfiLw9Ep3VQAFgK_3.fbx"
sizes: "1880064"
sizes: "1413120"
- lodLevelsToTest: ["7000;3000;1000;500", "0"]
files: "QmTpsFiaJVPv5mU6ERBzkDcZ39Lyq9sEfiLw9Ep3VQAFgK_0.fbx QmTpsFiaJVPv5mU6ERBzkDcZ39Lyq9sEfiLw9Ep3VQAFgK_1.fbx QmTpsFiaJVPv5mU6ERBzkDcZ39Lyq9sEfiLw9Ep3VQAFgK_2.fbx QmTpsFiaJVPv5mU6ERBzkDcZ39Lyq9sEfiLw9Ep3VQAFgK_3.fbx"
sizes: "48934912 7024640 2895872 1880064"
sizes: "48934912 2572288 1708032 1413120"

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions DCL_PiXYZ/PXZClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ private async Task ConvertScene(PXZConversionParams pxzParams, SceneConversionPa
if (pxzParams.LodLevel != 0)
{
modifiers.Add(new PXZDeleteByName(".*collider.*"));
modifiers.Add(new PXZRemoveHiddenPartOccurrences());
modifiers.Add(new PXZDecimator(sceneConversionInfo.SceneImporter.GetSceneBasePointer(), pxzParams.DecimationType,
pxzParams.DecimationValue, pxzParams.ParcelAmount, pathHandler));
modifiers.Add(new PXZMergeMeshes(pxzParams.LodLevel));
Expand Down
20 changes: 20 additions & 0 deletions DCL_PiXYZ/PiXYZWorflow/PXZRemoveHiddenPartOccurences.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using UnityEngine.Pixyz.API;
using UnityEngine.Pixyz.Scene;

namespace DCL_PiXYZ
{
public class PXZRemoveHiddenPartOccurrences : IPXZModifier
{
public void ApplyModification(PiXYZAPI pxz)
{
pxz.Core.SetModuleProperty("Algo", "DisableGPUAlgorithms", "True");
//We use low quality settings, since this modifier is used only for far away lods.
//For more info, check https://www.pixyz-software.com/documentations/html/2024.2/sdk/manual/functions/deleteoccluded.html?q=Occluded
OccurrenceList hiddenOccurrences = pxz.Algo.FindOccludedPartOccurrences(new OccurrenceList(new uint[]
{
pxz.Scene.GetRoot()
}), 256, 2, 30, true);
pxz.Scene.DeleteOccurrences(hiddenOccurrences);
}
}
}
4 changes: 2 additions & 2 deletions DCL_PiXYZ/Utils/PXZEntryArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public PXZEntryArgs()
DefaultSceneLodManifestDirectory = Path.Combine(Directory.GetCurrentDirectory(), "scene-lod-entities-manifest-builder/");
}

[Option("sceneToConvert", Required = false, Default = "0,0", HelpText = "The scene coordinate to convert")]
[Option("sceneToConvert", Required = false, Default = "5,19", HelpText = "The scene coordinate to convert")]
public string SceneToConvert { get; set; }

[Option("defaultOutputPath", Required = false, HelpText = "Output path for all files (LODs and Downloads)")]
Expand All @@ -20,7 +20,7 @@ public PXZEntryArgs()
[Option("defaultSceneLodManifestDirectory", Required = false, HelpText = "Path to the manifest project")]
public string DefaultSceneLodManifestDirectory { get; set; }

[Option("decimationValues", Required = false, Default = "7000", HelpText = "Triangle max count per lod level. Separate each leavel by a ;") ]
[Option("decimationValues", Required = false, Default = "7000;500", HelpText = "Triangle max count per lod level. Separate each leavel by a ;") ]
public string DecimationValues { get; set; }

[Option("startingLODLevel", Required = false, Default = 0, HelpText = "Starting LOD level to generate. Modifiers depend on this value") ]
Expand Down

0 comments on commit 8b7b95e

Please sign in to comment.