jitspoe / godot_bsp_importer

An importer addon to import Quake BSP files.
MIT License
102 stars 10 forks source link

WAD-less textured mesh import #17

Open Yagich opened 9 months ago

Yagich commented 9 months ago

Currently, the importer requires a WAD file to read the texture names, along with associated materials for every texture used. This is fine for Quake-style games that want to rely on existing tooling (shoutout to KOOK), but the ability to use bsp as a general level design tool is limited by this IMO, not to mention that to make WAD files you pretty much have to use archaic software.

I have managed to "solve" this for my game by hacking the texture check to see if the texture exists in the textures folder, but it's limited to the top textures folder, no subfolders. To do that, I had to modify my game config in TrenchBroom to get it to recognize png files for textures. I also have to use v2 of ericw-tools bsp, because it adds a -path option to specify the folder for loose files like textures, which still writes the texture lump, but only fills it with texture names, no actual texture data.

I would like to figure out a way to make this work fully and seamlessly, while still supporting the current worfklow. The challenges with this I can think of off the top of my head:

Would appreciate any thoughts!

jitspoe commented 9 months ago

So texture subdirectories would work better with the Quake2 BSP format, but I haven't gotten that fully supported, yet.

How I imagine this working would be:

As far as materials, there could be an option to generate materials with a given template. If a material is not found, create a new material with the given remapped name, duplicated from the template, and with the texture parameter set to point to the texture name (might need to specify a material parameter name option as well, as custom shaders might use something other than albedo_tex or whatever the default is).

echoless3484 commented 4 months ago

So texture subdirectories would work better with the Quake2 BSP format, but I haven't gotten that fully supported, yet.

How I imagine this working would be:

  • Specify optional texture path in import settings.
  • If texture exists in that path, use the dimensions of that texture to generate UV's.
  • If not, try to use textures embedded in BSP (and I think fall back to 64x64 if those don't exist).

As far as materials, there could be an option to generate materials with a given template. If a material is not found, create a new material with the given remapped name, duplicated from the template, and with the texture parameter set to point to the texture name (might need to specify a material parameter name option as well, as custom shaders might use something other than albedo_tex or whatever the default is).

Is this something that exists yet?

jitspoe commented 4 months ago

Not yet, but feel free to make a PR with it!