Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WAD-less textured mesh import #17

Open
Yagich opened this issue Dec 18, 2023 · 3 comments
Open

WAD-less textured mesh import #17

Yagich opened this issue Dec 18, 2023 · 3 comments

Comments

@Yagich
Copy link
Contributor

Yagich commented Dec 18, 2023

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:

  • To deal with textures in subfolders that may have the same filename, I'd hoped to use TB's _tb_textures key in worldspawn, but it seems like ericw's bsp trims these out. Textures names get written to the texture lump as their filename, but not the relative path
  • Deciding whether or not to use materials vs just the texture name essentially boils down to "if material file exists, use that, if not, try to load texture, if not, make empty material"

Would appreciate any thoughts!

@jitspoe
Copy link
Owner

jitspoe commented Dec 19, 2023

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).

@echoless3484
Copy link

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
Copy link
Owner

jitspoe commented May 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants