QodotPlugin / qodot-plugin

(LEGACY) Quake .map support for Godot 3.x
MIT License
982 stars 72 forks source link

Allow multiple patterns for building Auto PBR Materials #138

Open DeerTears opened 3 years ago

DeerTears commented 3 years ago

The problem

Auto PBR is a nice feature, it's meant to speed up the texturing process with little user input, but I've heard users complain that it's still too hard to fit their materials to a rigid naming scheme for Auto PBR to work.

They want it to be easier to have the system fit their various PBR maps when they download them from the internet, as well as the various programs they use to create PBR maps, rather than having to mass rename files just to match the current strings in Project Settings.

Current Behaviour

There is only one set of strings available in Project Settings: image

And Qodot_Texture_Loader.gd only returns constant patterns. It's being called in Qodot_Map.gd when building and it has to return these hardcoded values in order to build geometry.

image

image

What I've tried

So I'm noticing this is a big feature, but it hasn't been documented, and I'm not even sure if the current Project Settings -> Qodot -> Textures even works, since it butts heads with the hardcoded PBR_SUFFIX_PATTERNS in Qodot_Texture_Loader which is required to return for a map to build geometry.

I briefly considered a resource approach to this, which would help users save presets and share them for users exporting from popular programs like Substance, or downloading from sites like Kenney.

Apologies that this screenshot has like 5 screenshots worth of content on it, but here you can see where I'd put this resource, what the resource source code is, and how the user would interact with it. My hope is to make it feel comfortably similar to using Config_Folder.tres:

image

Some ideal fixes

Changing the Project Settings, QodotMap's material-building process, and Qodot_Texture_Loader to use PoolStringArrays for patterns be helpful. Qodot_Texture_Loader would have to iterate through its material building process to check for the first valid texture that matched the pattern (since only one texture can fit in a PBR slot).

However, I also think an amazing fix would be to switch to a resource system, so we can create saveable, sharable presets for users dealing with substance painter, material maker, all the likes. And maybe to save some users sanity if they have 50 naming-patterns but they know they only need to deal with one per map, to avoid bloating the build process. This would also open the door to setting custom float properties like roughness amount and diffuse amount on SpatialMaterials built with Auto PBR, partially fixing the fact that you lose all changes made to an Auto PBR material's properties if you re-build the map.