codecat / godot-tbloader

TrenchBroom Loader for Godot 4. (Alternative to Qodot)
MIT License
232 stars 29 forks source link

TBLoader meshes not displaying texture maps besides Albedo #64

Open 18swenskiq opened 1 year ago

18swenskiq commented 1 year ago

[Godot 4 Beta16]

When I import my Trenchbroom level, the materials use lots of texture maps besides the albedo, however the meshes created by TBLoader only show the albedo rather than the other maps like normal, height, etc.

The material appears fine if I just apply it to a MeshInstance3D

Pic: image

The result is the same whether I am in editor or run the game

codecat commented 1 year ago

This is weird, because I've definitely used complex materials before. I wonder if it's because the texture and material files have the same base name and are in the same location? (Eg: test.png and test.material)

If that's the case, it might be using the texture before the material.

18swenskiq commented 1 year ago

You are correct.

That being said, it would be great if different names were supported. For instance, the material being named test.material while the albedo is named test_albedo.png which is what I was trying to do (in Trenchbroom it was using test_albedo as the mat). How this might work is maybe like a checkbox in the TBLoader ent like "use material override", using the lone material in the folder rather than what the brush face is actually textured with.

I didn't assume that a texture would/could be loaded directly, the docs/README was a little bit confusing as well as this is not how any engine I've interacted with works.

If this is something that won't be fixed, it might be nice to reword the docs/README to say something like "a texture can be used instead of a material on imported brush faces, and unless the material name is a 1:1 match it will not be loaded"

codecat commented 1 year ago

Ahh I see. Yeah I can understand that would be a problem. Need to think about that. It's hard because I'm not sure TrenchBroom sees anything other than actual image files in its texture browser. Perhaps it could work when a strict filename format is used, like in your example: test_albedo.png could look for test.material, etc.

I didn't assume that a texture would/could be loaded directly, the docs/README was a little bit confusing as well as this is not how any engine I've interacted with works.

It's just a quick way to allow prototyping of maps w/o having to set up the materials for them.