atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.25k stars 250 forks source link

Unable to Export from Unity with materials #654

Closed MatthieuKiskonen closed 5 months ago

MatthieuKiskonen commented 1 year ago

Describe the bug Trying to export a gameObject from Unity scene (imported glb) does not include the material.

I tried to look at export example ( https://github.com/atteneder/glTFast/blob/main/Documentation%7E/ExportRuntime.md ) and trying to use the SimpleExport example. But It returns an error that it can't find GLTFast.Exports from using nor GameObjectExport class.

Files Due to confidential glb I managed to reproduce the issue with GLBs from a different issue

GLB.zip

To Reproduce Steps to reproduce the behavior:

  1. Import assert into the project
  2. Place glb in scene and select it
  3. Go to GameObject > Export gltf > gltf-Binary (.glb)
  4. Open generated glb and see lack of materials.

Expected behavior The GameObject is exported with material

Screenshots

image image

export.zip

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here. MeshMerger.zip

This is the script I am trying to run, I have gltFast v6.0.1 added as package in package manager.

atteneder commented 1 year ago

Hi,

I assume you're not using HDRP Lit shaders (since the sources are glTFast imported glbs). It's a known issue that the glTFast shaders won't export well at the moment and thus round-trips are prone to errors.

See #385 and #351

Always curious what your use-case is. It helps me prioritize working on a solution. Thanks!

MatthieuKiskonen commented 1 year ago

Hi,

Our use case is that we create high fidelity rendering of furnished apartments, for this we use Unity to prepare the shots and then we need to export the scene to go through a distributed rendering system.

We also use a lot of tooling to prepare this as well as blend shapes that we need to convert to static meshes and alike as can be seen in the example script.

MatthieuKiskonen commented 1 year ago

Hi,

Is there an option to unpack the glb content on import? Or import using HDRP Lit Shader? This way I could create the copy with a HDRP Lit shader using the textures and would allow to export an imported glb.

Sov3rain commented 1 year ago

Hey @atteneder, any news on the ability to do round-trips import/export at runtime? This feature would be greatly appreciated. Our use case is to be able to import multiple glb files at runtime and reexport them in one scene (bundling them). Avoiding the pain of changing all the materials and swapping maps channels around would be great!

d4n3x commented 10 months ago

Also have the same problem with importing an object during runtime but with URP. Same gltfast version. Any updates on this?

slonepro commented 7 months ago

Same problems here... Big mystery, the missing textures...

youdonotexist commented 7 months ago

Any update on this? @atteneder with the GltFast library going to Unity, is this being worked on internally? Or are you looking for a community PR to solve this issue?

I am interested in round-trip runtime import/export/import using Unity's URP Materials. Right now, importing with URP textures works, but export of that same model fails to export textures/materials.

atteneder commented 7 months ago

The next release will festure export of materials based on glTFast's shaders and shader graphs, this enabling import-export round-trips.

Probably comes next week.

Hth

Sov3rain commented 7 months ago

The next release will festure export of materials based on glTFast's shaders and shader graphs, this enabling import-export round-trips.

Probably comes next week.

Hth

That's a really good news! We'll test it as soon as it drops 🙂

youdonotexist commented 6 months ago

6.5 dropped

https://docs.unity3d.com/Packages/com.unity.cloud.gltfast@6.5/changelog/CHANGELOG.html

Will test & report back. Thanks @atteneder & Unity Team!

flogli commented 6 months ago

Hi, I've just tried new 6.5 version Same problem, it seems that when I export the model that has glTF/PbrMetallicRoughness (at runtime) and open it on an external gltf/glb viewer the baked material is not displayed, only the mesh with none material or texture.

The same happens when I use the function in editor (right-click > export glTF)

vini-guerrero commented 5 months ago

Hello. Just tested both C# and Editor export, having same issue with v6.6.0 · June 03, 2024 - Unity v2022.3.33f1 Export, import in Blender, materials exist but no textures.

atteneder commented 5 months ago

Sorry to hear it's not resolved yet.

Can y'all please look if you have the Image Conversion built-in package enabled (in the Package Manager) and tell me what render pipeline and shaders you are using?

atteneder commented 5 months ago

There's a bug where materials are not exported properly when URP/HDRP are both NOT installed.

If that's the case on your end, a fix is incoming.

atteneder commented 5 months ago

It's live!