PBR textures are ignored during export
I'm trying to export a mesh with a PBR material from my engine to collada/gltf2 using the latest assimpnet but it seems like pbr textures are completely ignored
I'm adding texture properties using the "AddMaterialTexture" method. This seems to be working nicely for usual textures such as the diffuse, normal or emissive textures, but when setting the texture type to Roughness or Metalness types everything goes bonkers.
Any advice on how to properly export these textures?
Comments (5)
-
repo owner -
Hi, I’m the issue author, I just didn’t think it would submit the issue without logging in lol
I’m using the master branch version of the library + the provided binaries.
It misses all pbr properties from what I’ve noticed. I’m setting the metalness and the roughness textures the same way I’m setting the rest and they are ignored. The exported gltf (thats what I was working on) had just the main textures (diffuse, normal, emissive)
-
repo owner No worries, I misread and thought on import not export too…
Looking at the native assimp github repo, are you using these material property keys?
https://github.com/assimp/assimp/blob/master/include/assimp/pbrmaterial.h
AssimpNet may be missing these, although ultimately they’re just strings…
-
On Import everything is fine, which is so weird since I don’t see any AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_TEXTURE or AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_TEXTURE keys.
I’m honestly not 100% sure how these are used, but I see some relevant keys in other material types such as clearcoat or sheen types (e.g. AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_TEXTURE)
But yeah essentially from what I understand such properties end up as strings. If there is any way to manually set such properties its fine for me.
-
repo owner You get the MaterialProperty by calling Material::GetProperty which takes the fully qualified string name, or the components of it. The property then has a number of get/set values for the supported types.
- Log in to comment
Latest from nuget or latest from the master branch?
The last time I looked at PBR support it was really a mess but that was a long time ago. I think there was some more recent work which may be in the last native version (5.2.5) I built for AssimpNet (master branch) but I haven’t looked too closely.
How bad is bonkers? Did you look at all the textures coming back from the material?