godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.4k stars 19.24k forks source link

Scene Import "Use External" for materials only works if an material to replace exists #64853

Open antonWetzel opened 1 year ago

antonWetzel commented 1 year ago

Godot version

4.0.dev (https://github.com/godotengine/godot/commit/d0a2a4c98195eb8a43713286b5b865dfbed05163)

System information

Windows 11

Issue description

If the mesh does not have a Material a empty Material is used (\<Unnamed Material> in the advanced import settings and empty name in the Scene). The option "Use External" exists but does not work for these Materials; the empty Material is used.

I think the option should not be removed but fixed for unnamed materials because it enables a workflow with all Materials in Godot (instead of Blender, ...).

Steps to reproduce

  1. Blender: Create new Mesh
  2. one of the following
    • Blender: remove Material and import to Godot
    • Blender: export to GLTF and for Geometry -> Materials select Placeholder or No exports
    • Godot: import .blend and for Materials -> Export Materials select Placeholder
  3. Go to Advanced Import Settings
  4. Select the Material and tick Use External Material -> enabled and choose replacement path

Result has a empty Material.

Minimal reproduction project

Test.zip

jss2a98aj commented 1 year ago

This may be related to how #69741 was fixed. I don't think it is a regression as previously "\<Unnamed Material>" caused editor crashes, but is still not what I would expect to have happen.

maridany1999 commented 5 months ago

I have the same issue. My objective is to reuse the materials created in Godot and I don't want to import the materials from Blender. I don't know what's the best practice or best workflow to import 3D models of type GLB. Is there any other temporary solution to this issue?

TinoNug commented 5 months ago

I am relatively new to Godot. But could it be that Godot thinks the file is already exported? It says "Already external". But there is no file anywhere.

I have deleted all the cache files, but the problem is still the same.

I can't export the.tres file from my .glb files. For some reason, another side effect is that changing other shaders no longer affects my models. They are all white.

grafik

TokisanGames commented 5 months ago

My objective is to reuse the materials created in Godot and I don't want to import the materials from Blender. I don't know what's the best practice or best workflow to import 3D models of type GLB.

@maridany1999

Static models we export from Blender with GLB/material placeholder, and copy over the binary textures. In Godot we manually recreate the material, save it to disk as tres, and place it in the override slot on the mesh.

We import animated models twice. Once with animations, which are extracted and saved to an animation library as text. Then again without animations, which is the only GLB saved.

Everything possible is saved as git-friendly, easily modifiable tres: the materials and animation library. Only the textures and mesh data (saved as GLB) are binary. The GLB contains only the mesh data; no textures or animations. We make a mesh scene inheriting the GLB, and that inheritance is never broken. The mesh is the only thing that can't be changed. With this setup, textures can be replaced, and animations and materials can be changed.

We don't do anything with materials in the importer. To date, none of them have worked for us anyway. The only thing I generally do in there is adjust LOD generation or root node type.

maridany1999 commented 5 months ago

@TokisanGames Thanks! Those methods seem good! Regarding the static models, will it be more expensive placing the materials on the Material Override Slots instead of the default Materials Slots?

TokisanGames commented 5 months ago

Should make no difference.