3. Textures and Materials - QodotPlugin/qodot-plugin GitHub Wiki

This Wiki is outdated and no longer being maintained. Qodot's new documentation can be found here: https://qodotplugin.github.io

Table of Contents

Format

.map files store textures as per-face string names in the format texture-group/texture-name

These are used to look up actual texture assets at runtime and apply them to mesh geometry during generation.

Basic Texturing

Qodot uses the string names stored in a .map file to look up textures from the project's res:// directory and apply them to the appropriate faces during build-time.

This is controlled by the Base Texture Path property on the QodotMap node; when looking up a texture, QodotMap will scan the specified folder for texture group subdirectories, then look inside them for a texture file with the extension specified in the Texture Extension property.

For example, take the screenshot below: Qodot will parse this file layout as base/checkerboard, base/grid, base/uv_test and base/uv_test_512 respectively.

Notes

  • Qodot will ignore any textures stored in the root texture directory. This mirrors the behavior of TrenchBroom, and is reflective of the Quake map format storing textures inside named WAD files.

  • Do not store any project content inside of addons/qodot. Files inside that folder will be irrevocably deleted if a new version of the plugin is installed through the AssetLib.

Default Material

As textures need to be applied to a material in order to be displayed on a mesh, Qodot generates the appropriate materials for any found textures. By default, this is a raw SpatialMaterial instance created with SpatialMaterial.new(), but can be overridden with the Default Material property. If set, Qodot will plug the texture into its Albedo slot before applying it to the appropriate face.

Material Overrides

The default material can be overridden per-texture by creating a Material resource and saving it with an identical name next to the texture in question. The extension used for material resource files is controlled with the Material Extension property on QodotMap.

As you can see below, tangent-test.png is present and will show up in TrenchBroom to represent the shaders/tangent-test texture:

Qodot, however, will see the tangent-test.tres ShaderMaterial next to it and use that instead.

Note

Material override resources can be any subclass of Material applicable to 3D meshes, the most notable of which are SpatialMaterial and ShaderMaterial.

Unlike the default material specified on the QodotMap, no parameters will be injected into overridden instances - the user is expected to pre-configure these in the editor.

Automatic PBR Texturing

Qodot supports automatic application of PBR materials provided as sets of loose texture files. In order to use the automatic PBR workflow, create a folder of the same name next to your texture file and populate it with the following PBR channel textures:

  • [texture]_normal[.extension]
  • [texture]_metallic[.extension]
  • [texture]_roughness[.extension]
  • [texture]_emissive[.extension]
  • [texture]_ao[.extension]
  • [texture]_depth[.extension]

If present, Qodot will automatically detect them and slot them into the appropriate texture property of the default SpatialMaterial at build time.

Below is a working example of automatic PBR texturing; military-panel.png will be loaded first and applied to the Albedo slot of the default material, after which Qodot will scan the military-panel folder for military-panel's associated PBR channel textures and apply them to the appropriate slots in the material.

Note

This workflow is intended to be used for quick pre-visualization of PBR textures. While it lacks the fine-grained control that comes with defining an override material for each one, it shortens the time between importing a new set of PBR textures and being able to see them applied to your map geometry.

WAD File Support

Qodot adds palette.lmp and texture WAD import support to the Godot editor, allowing textures to be extracted and converted to RGB for in-engine use.

.lmp and .wad files will be automatically imported upon adding them to a project, and their contents can be viewed directly by double-clicking on their resources in the FileSystem tab:

To use a set of WAD files with QodotMap, simply add them to its Texture Wads property in the inspector:

Upon clicking reload, the texture loader will scan each WAD for textures present in the map and load them as appropriate.

Note

As the palette.lmp file from Quake was released into the public domain, it's included with Qodot to simplify the import of common texture WADs.