Importing obj-file causes blurry material

Version: 4.3.stable

Hey there!
I’m using Blockbench to create my Models, I want to use the Godot GridMap to build my world.

I’m exporting my model as an obj-file, so it gets exported as one single mesh.
If I was using the gltf-file export, then I would have multiple meshes, which means that I would have to combine it into a single one, which I wasn’t able to find out how to do.

The problem with the obj export is, that the textures get sampled with a linear filter, instead of nearest.

I could manually make the mesh unique and change each surface materials sampler filter to nearest, as the default of each is linear.
Now this is very annoying and boring, especially if I want to edit or change the model in Blockbench, as I would have to repeat the process again and again each time.
I looked into the Godot settings and Blockbench settings and wasn’t able to find anything that could export the file with nearest filtering as default…

I would be very greatful if someone could help me, by knowing a way on how to change the export filter to be nearest by default, or by knowing how to combine the meshes in a gltf-file export. Or of course by having another way that could help me :3!

Thanks in advances for anyone reading this and/or is trying to help me!

Left: gltf-export, Right: obj-export

This may be that the texture is being VRAM compressed. Select the texture in Godot and, in the Import tab, change the compress mode to Loseless and click on Reimport

If that’s not it then you can extract the material from the models as shown here Import configuration — Godot Engine (stable) documentation in English and modify the BaseMaterial.texture_filter to Nearest for example.

As I’m a new user I can only upload one image so I have one image with multiple numbers as an index:

Index 1:
Left: obj-file with reimported textures as Loseless
Right: gltf-file export

Index 2:
The extracting of the materials worked.
Their filtering was already set to nearest.

I can replace the textures of the obj-file with the extracted materials of the gltf-export, which ‘kinda’ solves the problem.

Index 3:
obj-export with replaced surface textures with the materials

So if I would want to edit my file I would have to do:

  • export the file as gltf and as obj
  • extract the materials of the gltf version (if I haven’t already done so)
  • make the obj-file export unique
  • replace each surface texture with the extracted material
  • and cause it now is one single mesh: export it as a mesh library so I can use it in my GridMap

…if I understood everything correctly of course.

This way of doing it is still a bit painful and annoying, but that is okay it would be good enough i guess.

Thanks for the help, if you have another idea or solution then I would be glad to try it out!

1 Like

It looks like the obj file does not have the texture assigned in the albedo property. Did it have it when you exported the materials? Does your obj file have a mtl file with the materials correctly setup?

Either way, you can directly extract the meshes from a gltf file in the same menu where you extract the materials. Select Set meshes save path and select a folder where the mesh files will be saved. You can use those in your GridMap

First of all, the obj-file has the texture assigned correctly (unless you mean that it should be the material.tres file, currently it is the png texture), the problem as far as I understand it is that the sampling is set as “linear” by default, and to change that I would have to edit each surface of the obj-file manually, which ends up being a lot of uneccessary work.
Example: Index 1

I don’t know what mtl file you are talking about, when exporting from blockbench I only get the textures as png and the obj file.
And when extracting the materials I get them as .tres

[edit]:
There is an mtl file, I just thought there wasn’t as godot didn’t show me one
Godot doesn’t seem to be using it though? There is no .import version of the file…?
Example: Index 4

Extracting the meshes of the gltf file works, but thats not really useful for me because I need them to be connected and not single.
Example: Index 2

So they wouldn’t be very useful for my GridMap, unless theres something I don’t know.
Example: Index 3