Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions indra/newview/gltf/llgltfloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void LLGLTFLoader::processNodeHierarchy(S32 node_idx, std::map<std::string, S32>

const LL::GLTF::Node& node = mGLTFAsset.mNodes[node_idx];

LL_INFOS("GLTF_IMPORT") << "Processing node " << node_idx << " (" << node.mName << ")"
LL_DEBUGS("GLTF_IMPORT") << "Processing node " << node_idx << " (" << node.mName << ")"
<< " - has mesh: " << (node.mMesh >= 0 ? "yes" : "no")
<< " - children: " << node.mChildren.size() << LL_ENDL;

Expand Down Expand Up @@ -542,7 +542,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh&
base_name = "mesh_" + std::to_string(mesh_index);
}

LL_INFOS("GLTF_DEBUG") << "Processing model " << base_name << LL_ENDL;
LL_DEBUGS("GLTF_DEBUG") << "Processing model " << base_name << LL_ENDL;

if (instance_count > 0)
{
Expand Down Expand Up @@ -988,7 +988,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh&
created_faces++;
}

LL_INFOS("GLTF_IMPORT") << "Primitive " << pModel->mLabel
LL_INFOS("GLTF_IMPORT") << "Primitive " << (S32)prim_idx << " from model " << pModel->mLabel
<< " is over vertices limit, it was split into " << created_faces
<< " faces" << LL_ENDL;
LLSD args;
Expand Down Expand Up @@ -1276,7 +1276,7 @@ void LLGLTFLoader::populateJointsFromSkin(S32 skin_idx)
glm::mat4 final_inverse_bind_matrix = glm::inverse(tranlated_original);

LLMatrix4 gltf_transform = LLMatrix4(glm::value_ptr(final_inverse_bind_matrix));
LL_INFOS("GLTF_DEBUG") << "mInvBindMatrix name: " << legal_name << " Translated val: " << gltf_transform << LL_ENDL;
LL_DEBUGS("GLTF_DEBUG") << "mInvBindMatrix name: " << legal_name << " Translated val: " << gltf_transform << LL_ENDL;
mInverseBindMatrices[skin_idx].push_back(LLMatrix4a(gltf_transform));
}
else
Expand All @@ -1289,7 +1289,7 @@ void LLGLTFLoader::populateJointsFromSkin(S32 skin_idx)
inv_bind = glm::inverse(skeleton_transform * inv_bind);

LLMatrix4 gltf_transform = LLMatrix4(glm::value_ptr(inv_bind));
LL_INFOS("GLTF_DEBUG") << "mInvBindMatrix name: " << legal_name << " Generated val: " << gltf_transform << LL_ENDL;
LL_DEBUGS("GLTF_DEBUG") << "mInvBindMatrix name: " << legal_name << " Generated val: " << gltf_transform << LL_ENDL;
mInverseBindMatrices[skin_idx].push_back(LLMatrix4a(gltf_transform));
}

Expand All @@ -1301,7 +1301,7 @@ void LLGLTFLoader::populateJointsFromSkin(S32 skin_idx)
LLMatrix4 newInverse = LLMatrix4(mInverseBindMatrices[skin_idx].back().getF32ptr());
newInverse.setTranslation(original_joint_transform.getTranslation());

LL_INFOS("GLTF_DEBUG") << "mAlternateBindMatrix name: " << legal_name << " val: " << newInverse << LL_ENDL;
LL_DEBUGS("GLTF_DEBUG") << "mAlternateBindMatrix name: " << legal_name << " val: " << newInverse << LL_ENDL;
mAlternateBindMatrices[skin_idx].push_back(LLMatrix4a(newInverse));

if (legal_joint)
Expand Down
44 changes: 38 additions & 6 deletions indra/newview/llmodelpreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,7 @@ F32 LLModelPreview::genMeshOptimizerPerFace(LLModel *base_model, LLModel *target

void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 decimation, bool enforce_tri_limit)
{
LL_INFOS() << "Generating lod " << which_lod << " using meshoptimizer" << LL_ENDL;
LL_DEBUGS("Upload") << "Generating lod " << which_lod << " using meshoptimizer" << LL_ENDL;
// Allow LoD from -1 to LLModel::LOD_PHYSICS
if (which_lod < -1 || which_lod > LLModel::NUM_LODS - 1)
{
Expand Down Expand Up @@ -1896,6 +1896,12 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d

mMaxTriangleLimit = base_triangle_count;

// For logging purposes
S32 meshes_processed = 0;
S32 meshes_simplified = 0;
S32 meshes_sloppy_simplified = 0;
S32 meshes_fail_count = 0;

// Build models

S32 start = LLModel::LOD_HIGH;
Expand All @@ -1905,7 +1911,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
{
start = which_lod;
end = which_lod;
}
};

for (S32 lod = start; lod >= end; --lod)
{
Expand Down Expand Up @@ -1968,6 +1974,11 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
const LLVolumeFace &face = base->getVolumeFace(face_idx);
LLVolumeFace &new_face = target_model->getVolumeFace(face_idx);
new_face = face;
meshes_fail_count++;
}
else
{
meshes_simplified++;
}
}
}
Expand All @@ -1980,7 +1991,18 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
if (genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_NO_TOPOLOGY) < 0)
{
// Sloppy failed and returned an invalid model
genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_FULL);
if (genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_FULL) < 0)
{
meshes_fail_count++;
}
else
{
meshes_simplified++;
}
}
else
{
meshes_sloppy_simplified++;
}
}
}
Expand Down Expand Up @@ -2080,25 +2102,28 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
precise_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_FULL);
}

LL_INFOS() << "Model " << target_model->getName()
LL_DEBUGS("Upload") << "Model " << target_model->getName()
<< " lod " << which_lod
<< " resulting ratio " << precise_ratio
<< " simplified using per model method." << LL_ENDL;
meshes_simplified++;
}
else
{
LL_INFOS() << "Model " << target_model->getName()
LL_DEBUGS("Upload") << "Model " << target_model->getName()
<< " lod " << which_lod
<< " resulting ratio " << sloppy_ratio
<< " sloppily simplified using per model method." << LL_ENDL;
meshes_sloppy_simplified++;
}
}
else
{
LL_INFOS() << "Model " << target_model->getName()
LL_DEBUGS("Upload") << "Model " << target_model->getName()
<< " lod " << which_lod
<< " resulting ratio " << precise_ratio
<< " simplified using per model method." << LL_ENDL;
meshes_simplified++;
}
}

Expand All @@ -2112,6 +2137,8 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
//copy material list
target_model->mMaterialList = base->mMaterialList;

meshes_processed++;

if (!validate_model(target_model))
{
LL_ERRS() << "Invalid model generated when creating LODs" << LL_ENDL;
Expand Down Expand Up @@ -2141,6 +2168,11 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
}
}
}

LL_INFOS("Upload") << "LOD " << which_lod << ", Mesh optimizer processed meshes : " << meshes_processed
<<" simplified: " << meshes_simplified
<< ", slopily simplified: " << meshes_sloppy_simplified
<< ", failures: " << meshes_fail_count << LL_ENDL;
}

void LLModelPreview::updateStatusMessages()
Expand Down
Loading