pietru2004 / Godot-WFC

My implementation of WFC algoritm with gui for making tile rules and 3 generators.
32 stars 1 forks source link

Problems with textures! #9

Closed n0ahwint3r closed 1 month ago

n0ahwint3r commented 1 month ago

Hey,

Not sure if this qualifies as an issue or if it‘s just a request for a patch… As far as I can see, the MeshLibDefiner does neither support .gltf files nor can textures of MeshLibItems be added/changed within the Inspector, which seems a bit inconveinient… I can make great textures in Blender and properly export them to .gltf files, which look okay in Godot… but can‘t use them in the MeshLib. I can make good textures with Material Maker, export them to .gltf and they look good in Godot… still can‘t use those… Same for making textures within Godot… Do I miss something here? Like… I see all the stats of the Mesh and it‘s Material within the Inspector but I can‘t change any of the properties or override the base texture… is there a fix for this?

pietru2004 commented 1 month ago

the current api of MeshLibrary doesn't support setting material of mesh obraz all I can recommend is merging model into 1 mesh and using mesh surfaces for loading any materials and textures obraz

Basically make sure materials with textures are assigned to mesh. if you used Scene -> Export As -> MeshLibrary each MeshInstance would be treated as separate object that can be painted in world. You could use smart material(shader material) for your mesh.

n0ahwint3r commented 1 month ago

I found a workaround for the lack of support for setting textures in a MeshLib:

I changed the MeshLibItem.gd to export a StandardMaterial3D (probably going to do the same for ORM), which I can access in the editor. I also changed the MeshLibDefiner.gd so that it recognizes and applies said Material to override the inaccessible Material of the Mesh when generating the MeshLib.

It‘s only one OverrideMaterial, so it doesn‘t work for multiple subsurfaces for now, but for my main project I‘ll have to implement that as well… I‘ll upload the changed scripts afterwards, since it seems to be a useful feature to have in this plugin!

pietru2004 commented 1 month ago

In editor mesh importer you can set material of mesh, assign it.