XNALaraMesh icon indicating copy to clipboard operation
XNALaraMesh copied to clipboard

Xps/xnalara. How to export 3d model with xps shaders to .glb/gltf?

Open SeruiosBoss opened this issue 4 years ago • 3 comments

Hello. When I export model with xps shaders in gltf there are no colors and textures, there are only materials, but if I edit material from xps shader to image texture and choose the same .tga file it works correctly, but there are no colors in gltf with xps shader. But I want to have it because there are really good flares and reflections in model with xps shader. (body mesh and bodyenv mesh with flares and reflections). What can I do? Thx.

SeruiosBoss avatar Nov 04 '21 13:11 SeruiosBoss

I've been messing around with this tonight. As you noted, the problem is related to the XPS shader but it's also related to the GLTF exporter. Here's the documentation for that exporter:

https://docs.blender.org/manual/en/2.90/addons/import_export/scene_gltf2.html

The GLTF exporter is expecting Principled BSDF to be connected directly to the Material Output node. But with XNALara, the XPS shader is connected to Material Output. XPS shader does internally use Principled BSDF, but the GLTF Exporter does not drill down into XPS to find the Principled BSDF.

Though GLTF Exporter could be modified to drill down into the graph, it's unlikely Khronos would want to do that. I think the proper fix would be for XNALara to end with a Principled BSDF rather than encapsulate one. I have tried replacing XPS shader with regular Principled BSDF and the textures do export. But this is a lengthy process since it has to be done for multiple parts.

I'm not the author of this library so I hope that @johnzero7 can take a look and determine the best way to fix this properly.

jbienz avatar Jan 17 '22 03:01 jbienz

Maybe a simpler solution would be to adapt the XNALara code to create a direct converter to glTF, bypassing Blender altogether.

ldo avatar Jan 17 '22 03:01 ldo

Not to downplay the value and importance of the XnaLara project, but I did want to share a related tool. Specifically for the purposes of editing Halo assets in Blender and exporting them to GLTF, I found the Reclaimer project to have high compatibility.

https://github.com/Gravemind2401/Reclaimer

That project is a Halo asset extractor, and at the bottom of that page you'll also find the AMF Blender script for importing the extracted assets into Blender with PBR.

Cheers!

jbienz avatar Feb 08 '22 04:02 jbienz