Open samekne opened 3 years ago
Update: This seems to be only for meshes that have a set color field. If the meshes don't have this they render normally. See examples here:
Some meshes are rendering properly.
Body does have a color so it doesn't get rendered properly.
Hat doesn't have a color set so it gets rendered properly.
I don't know why the materials don''t work, but you can override the shaders used in the model import settings
Hey Siccity, thanks for the response! I tried overriding the shader in the model import settings but it crashed Unity (this particular model has 30+ separate skinnedmeshrenderers so maybe thats why). I wrote a simple script to swap all the shared material shaders to the normal lit URP shader (with workflowmode and smoothness both set to 0 and the _MainTex remapped to _BaseMap) and it works fine as a workaround.
Was able to get the importer to use a different shader without crashing Unity, however this solution doesn't work as it doesn't map the base map correctly (when using URP shaders) so sticking with my script for now.
When importing a .gltf file with the importer, the object is correctly imported into Unity.
The different textures are all set correctly (currently these are the base map (Albedo (RGB)), Normal Map and Metallic Map. The textures are set correctly in the material, but the shader renders everything as pure white. If I create a new material with the standard URP Lit shader and assign all the textures it renders correctly.
I also tried swapping shader from the GLTF URP Shader to the URP Lit shader at runtime. I had to manually assign the Base Map (I'm guessing because URP calls it _BaseMap and GLTF calls it _MainTex) and it also renders fine after this change.
Here is the imported file:
Here is the imported material:
Here is how the model looks in Unity:
Here is how the model looks after the shader swap:
Here is the new shader:
Is there any easy way to fix this? Otherwise I'll write a script that swaps the shader at start but it seems like a very hacky solution.