From 7b7b8a8da8f3a7e726b7de2b152cd00c67df0f18 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 7 Jul 2021 22:34:26 +0300 Subject: DRTVWR-542 WIP --- indra/newview/llmodelpreview.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 3664a27a72..df66d79b7b 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -125,9 +125,16 @@ public: { LOD_FROM_FILE = 0, GENERATE, + MESH_OPTIMIZER, USE_LOD_ABOVE, } eLoDMode; + typedef enum + { + LIMIT_TRIANGLES = 0, + LIMIT_ERROR_TRESHOLD, + } eLoDLimit; + public: // Todo: model preview shouldn't need floater dependency, it // should just expose data to floater, not control flaoter like it does @@ -155,7 +162,7 @@ public: void loadModelCallback(S32 lod); bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); } void queryLODs() { mGenLOD = true; }; - void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); + void genGlodLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); void generateNormals(); void restoreNormals(); U32 calcResourceCost(); @@ -166,7 +173,8 @@ public: void updateStatusMessages(); void updateLodControls(S32 lod); void clearGLODGroup(); - void onLODParamCommit(S32 lod, bool enforce_tri_limit); + void onLODGenerateParamCommit(S32 lod, bool enforce_tri_limit); + void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit); void addEmptyFace(LLModel* pTarget); const bool getModelPivot(void) const { return mHasPivot; } -- cgit v1.2.3 From 17131ac20336b5561b574a9c121c6a5876be2d53 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sun, 11 Jul 2021 22:39:30 +0300 Subject: DRTVWR-542 WIP #4 Made meshoptimizer into default generation mechanism Ensured that at least one triangle will remain of any face --- indra/newview/llmodelpreview.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index df66d79b7b..f6f4ce580d 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -163,6 +163,7 @@ public: bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); } void queryLODs() { mGenLOD = true; }; void genGlodLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); + void genMeshOptimizerLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); void generateNormals(); void restoreNormals(); U32 calcResourceCost(); -- cgit v1.2.3 From 938969c811732a3e2faf0229301de286bd12c1a5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 12 Jul 2021 19:18:25 +0300 Subject: DRTVWR-542 WIP #6 Trying out 'sloppy' variant --- indra/newview/llmodelpreview.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index f6f4ce580d..9f38156ca2 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -126,6 +126,7 @@ public: LOD_FROM_FILE = 0, GENERATE, MESH_OPTIMIZER, + MESH_OPTIMIZER_SLOPPY, USE_LOD_ABOVE, } eLoDMode; @@ -163,7 +164,7 @@ public: bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); } void queryLODs() { mGenLOD = true; }; void genGlodLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); - void genMeshOptimizerLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); + void genMeshOptimizerLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false, bool sloppy = false); void generateNormals(); void restoreNormals(); U32 calcResourceCost(); @@ -175,7 +176,7 @@ public: void updateLodControls(S32 lod); void clearGLODGroup(); void onLODGenerateParamCommit(S32 lod, bool enforce_tri_limit); - void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit); + void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit, bool sloppy); void addEmptyFace(LLModel* pTarget); const bool getModelPivot(void) const { return mHasPivot; } -- cgit v1.2.3 From 9aaac1bb985f5bd65f9b0fe985c47cd30dcfd166 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 23 Jul 2021 21:30:13 +0300 Subject: DRTVWR-542 Attempt to simplify all faces of an object as a whole and split back into faces --- indra/newview/llmodelpreview.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 9f38156ca2..b784345b5a 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -127,6 +127,7 @@ public: GENERATE, MESH_OPTIMIZER, MESH_OPTIMIZER_SLOPPY, + MESH_OPTIMIZER_COMBINE, USE_LOD_ABOVE, } eLoDMode; @@ -164,7 +165,7 @@ public: bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); } void queryLODs() { mGenLOD = true; }; void genGlodLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); - void genMeshOptimizerLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false, bool sloppy = false); + void genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 decimation = 3, bool enforce_tri_limit = false); void generateNormals(); void restoreNormals(); U32 calcResourceCost(); @@ -176,7 +177,7 @@ public: void updateLodControls(S32 lod); void clearGLODGroup(); void onLODGenerateParamCommit(S32 lod, bool enforce_tri_limit); - void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit, bool sloppy); + void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit, S32 mode); void addEmptyFace(LLModel* pTarget); const bool getModelPivot(void) const { return mHasPivot; } -- cgit v1.2.3 From 1a1793244002effe46cedf63180de60f4bc69a9a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Aug 2021 21:14:00 +0300 Subject: DRTVWR-542 Automated method selection Normally simplification methods apply for whole upload, but this one selects methods per model or per face. --- indra/newview/llmodelpreview.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index b784345b5a..b3296fecf6 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -125,9 +125,10 @@ public: { LOD_FROM_FILE = 0, GENERATE, + MESH_OPTIMIZER_AUTO, // automatically selects method based on model or face + MESH_OPTIMIZER_COMBINE, MESH_OPTIMIZER, MESH_OPTIMIZER_SLOPPY, - MESH_OPTIMIZER_COMBINE, USE_LOD_ABOVE, } eLoDMode; @@ -229,6 +230,10 @@ private: // Count amount of original models, excluding sub-models static U32 countRootModels(LLModelLoader::model_list models); + // functions for meshoptimizer, return reached simplification ratio + F32 genMeshOptimizerPerModel(LLModel *base_model, LLModel *target_model, F32 indices_ratio, F32 error_threshold, bool sloppy); + F32 genMeshOptimizerPerFace(LLModel *base_model, LLModel *target_model, U32 face_idx, F32 indices_ratio, F32 error_threshold, bool sloppy); + protected: friend class LLModelLoader; friend class LLFloaterModelPreview; -- cgit v1.2.3 From b45c0e3ed926270e100271f33885b8d31085a858 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 6 Sep 2021 21:29:51 +0300 Subject: SL-15940 Remove ability to set zero triangle limit Setting lod to zero triangles doesn't work and shouldn't work, so UI shouldn't allow setting less then one triangle per model as well. --- indra/newview/llmodelpreview.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index b3296fecf6..49032f0dbf 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -296,8 +296,14 @@ protected: U32 mGroup; std::map, U32> mObject; + + // Amount of triangles in original(base) model U32 mMaxTriangleLimit; + // Minimum amount of allowed triangles in lod for spin cntrl. + // Leave at least one triangle per model. + S32 mMinTriangleLimit; + LLMeshUploadThread::instance_list mUploadData; std::set mTextureSet; -- cgit v1.2.3 From 33f52ee51dad85802d124e987aa6ee9b7faf0cb2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 10 Nov 2021 17:48:55 +0200 Subject: SL-14403 Removed glod --- indra/newview/llmodelpreview.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 49032f0dbf..7d4507ccf2 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -124,7 +124,6 @@ public: typedef enum { LOD_FROM_FILE = 0, - GENERATE, MESH_OPTIMIZER_AUTO, // automatically selects method based on model or face MESH_OPTIMIZER_COMBINE, MESH_OPTIMIZER, @@ -165,7 +164,6 @@ public: void loadModelCallback(S32 lod); bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); } void queryLODs() { mGenLOD = true; }; - void genGlodLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); void genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 decimation = 3, bool enforce_tri_limit = false); void generateNormals(); void restoreNormals(); @@ -176,8 +174,6 @@ public: void clearIncompatible(S32 lod); void updateStatusMessages(); void updateLodControls(S32 lod); - void clearGLODGroup(); - void onLODGenerateParamCommit(S32 lod, bool enforce_tri_limit); void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit, S32 mode); void addEmptyFace(LLModel* pTarget); @@ -265,19 +261,11 @@ protected: std::map mViewOption; - //GLOD object parameters (must rebuild object if these change) + // Model generation parameters (must rebuild object if these change) bool mLODFrozen; - F32 mBuildShareTolerance; - U32 mBuildQueueMode; - U32 mBuildOperator; - U32 mBuildBorderMode; U32 mRequestedLoDMode[LLModel::NUM_LODS]; S32 mRequestedTriangleCount[LLModel::NUM_LODS]; F32 mRequestedErrorThreshold[LLModel::NUM_LODS]; - U32 mRequestedBuildOperator[LLModel::NUM_LODS]; - U32 mRequestedQueueMode[LLModel::NUM_LODS]; - U32 mRequestedBorderMode[LLModel::NUM_LODS]; - F32 mRequestedShareTolerance[LLModel::NUM_LODS]; F32 mRequestedCreaseAngle[LLModel::NUM_LODS]; LLModelLoader* mModelLoader; -- cgit v1.2.3 From 9e38e5a187574279b46dc76d9d0fb2c7b2f816f6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 8 Dec 2021 22:58:27 +0200 Subject: SL-16471 Removed unneeded MeshOpt generation method --- indra/newview/llmodelpreview.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 7d4507ccf2..9361acfc49 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -125,9 +125,8 @@ public: { LOD_FROM_FILE = 0, MESH_OPTIMIZER_AUTO, // automatically selects method based on model or face - MESH_OPTIMIZER_COMBINE, - MESH_OPTIMIZER, - MESH_OPTIMIZER_SLOPPY, + MESH_OPTIMIZER_COMBINE, // combines faces into a single model, simplifies, then splits back into faces + MESH_OPTIMIZER_SLOPPY, // uses sloppy method, works per face USE_LOD_ABOVE, } eLoDMode; -- cgit v1.2.3 From 0a9ade4687dd53e9973ebfdf1ef948f04f5ac8c1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Dec 2021 19:52:05 +0200 Subject: SL-16479 'sloppy' precision in automated mode. --- indra/newview/llmodelpreview.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 9361acfc49..48d6d362eb 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -225,8 +225,12 @@ private: // Count amount of original models, excluding sub-models static U32 countRootModels(LLModelLoader::model_list models); - // functions for meshoptimizer, return reached simplification ratio + // Merges faces into single mesh, simplifies using mesh optimizer, + // then splits back into faces. + // Returns reached simplification ratio. -1 in case of a failure. F32 genMeshOptimizerPerModel(LLModel *base_model, LLModel *target_model, F32 indices_ratio, F32 error_threshold, bool sloppy); + // Simplifies specified face using mesh optimizer. + // Returns reached simplification ratio. -1 in case of a failure. F32 genMeshOptimizerPerFace(LLModel *base_model, LLModel *target_model, U32 face_idx, F32 indices_ratio, F32 error_threshold, bool sloppy); protected: -- cgit v1.2.3 From 7f0e62ea9e1c2deac03ad9ffc3533f558fd77766 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 31 Mar 2022 22:52:56 +0300 Subject: SL-17121 Revert "SL-15940 Remove ability to set zero triangle limit" This reverts commit b45c0e3ed926270e100271f33885b8d31085a858. --- indra/newview/llmodelpreview.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llmodelpreview.h') diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index f78f476810..9e32215e6a 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -290,10 +290,6 @@ protected: // Amount of triangles in original(base) model U32 mMaxTriangleLimit; - // Minimum amount of allowed triangles in lod for spin cntrl. - // Leave at least one triangle per model. - S32 mMinTriangleLimit; - LLMeshUploadThread::instance_list mUploadData; std::set mTextureSet; -- cgit v1.2.3