Kaynağa Gözat

Added more Maya materials (#5101)

* Added more Maya materials

Added Maya materials to list and add setting texture properties for getting lost textures to mesh

* Update utMaterialSystem.cpp

Now new enumerators are handled by a case label in utMaterialSystem.cpp

* Update material.h

- Fix tests: use the correct max material parameter

---------

Co-authored-by: Kim Kulling <[email protected]>
Sanchikuuus 11 ay önce
ebeveyn
işleme
12ed0286e4

+ 4 - 0
code/AssetLib/FBX/FBXConverter.cpp

@@ -2128,6 +2128,10 @@ void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const TextureMap &_
     TrySetTextureProperties(out_mat, _textures, "Maya|emissionColor", aiTextureType_EMISSION_COLOR, mesh);
     TrySetTextureProperties(out_mat, _textures, "Maya|metalness", aiTextureType_METALNESS, mesh);
     TrySetTextureProperties(out_mat, _textures, "Maya|diffuseRoughness", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
+    TrySetTextureProperties(out_mat, _textures, "Maya|base", aiTextureType_MAYA_BASE, mesh);
+    TrySetTextureProperties(out_mat, _textures, "Maya|specular", aiTextureType_MAYA_SPECULAR, mesh);
+    TrySetTextureProperties(out_mat, _textures, "Maya|specularColor", aiTextureType_MAYA_SPECULAR_COLOR, mesh);
+    TrySetTextureProperties(out_mat, _textures, "Maya|specularRoughness", aiTextureType_MAYA_SPECULAR_ROUGHNESS, mesh);
 
     // Maya stingray
     TrySetTextureProperties(out_mat, _textures, "Maya|TEX_color_map", aiTextureType_BASE_COLOR, mesh);

+ 16 - 8
include/assimp/material.h

@@ -292,6 +292,14 @@ enum aiTextureType {
     aiTextureType_DIFFUSE_ROUGHNESS = 16,
     aiTextureType_AMBIENT_OCCLUSION = 17,
 
+    /** Unknown texture
+     *
+     *  A texture reference that does not match any of the definitions
+     *  above is considered to be 'unknown'. It is still imported,
+     *  but is excluded from any further post-processing.
+    */
+    aiTextureType_UNKNOWN = 18,
+
     /** PBR Material Modifiers
     * Some modern renderers have further PBR modifiers that may be overlaid
     * on top of the 'base' PBR materials for additional realism.
@@ -318,20 +326,20 @@ enum aiTextureType {
     */
     aiTextureType_TRANSMISSION = 21,
 
-    /** Unknown texture
-     *
-     *  A texture reference that does not match any of the definitions
-     *  above is considered to be 'unknown'. It is still imported,
-     *  but is excluded from any further post-processing.
-    */
-    aiTextureType_UNKNOWN = 18,
+    /**
+     * Maya material declarations
+     */
+    aiTextureType_MAYA_BASE = 22,
+    aiTextureType_MAYA_SPECULAR = 23,
+    aiTextureType_MAYA_SPECULAR_COLOR = 24,
+    aiTextureType_MAYA_SPECULAR_ROUGHNESS = 25,
 
 #ifndef SWIG
     _aiTextureType_Force32Bit = INT_MAX
 #endif
 };
 
-#define AI_TEXTURE_TYPE_MAX aiTextureType_TRANSMISSION
+#define AI_TEXTURE_TYPE_MAX aiTextureType_MAYA_SPECULAR_ROUGHNESS
 
 // -------------------------------------------------------------------------------
 /**

+ 4 - 0
test/unit/utMaterialSystem.cpp

@@ -260,6 +260,10 @@ TEST_F(MaterialSystemTest, testMaterialTextureTypeEnum) {
         case aiTextureType_METALNESS:
         case aiTextureType_DIFFUSE_ROUGHNESS:
         case aiTextureType_AMBIENT_OCCLUSION:
+        case aiTextureType_MAYA_BASE:
+        case aiTextureType_MAYA_SPECULAR:
+        case aiTextureType_MAYA_SPECULAR_COLOR:
+        case aiTextureType_MAYA_SPECULAR_ROUGHNESS:
         case aiTextureType_SHEEN:
         case aiTextureType_CLEARCOAT:
         case aiTextureType_TRANSMISSION: