Author Topic: [FF7PC] Script to batch convert PBR textures for the new lighting engine  (Read 3042 times)

Cosmos

  • *
  • Posts: 34
    • View Profile
Overview

This is a script to automatically batch convert an entire folder of PBR textures to be used with Cosmos Lighting, the new lighting engine integrated into FFNx.
For more details see link below:
http://forums.qhimm.com/index.php?topic=20612.0

Download
https://mega.nz/file/uIA3Ha6Y#W0SDmjAh2Qws1dMgu64kILluxdD9maz746cbc37clXw

Input texture example
https://mega.nz/file/XRYFUarJ#wyA8-oC2Pfg38QgLNNvZ8o1mO9l4JPIoAncnSnQ_uOw

You can put these textures in the input folder to quickly test the converter.

How to use

1. Put the pbr textures in the input folder. For example, for a color texture called aaaa_00.png, the new textures should be named with suffixes as follows:
- aaaa_00_n.png: normal texture
- aaaa_00_r.png : roughness texture. You can alternatively provide a aaaa_s.png smoothness texture. The script will automatically convert smoothness to roughness.
- aaaa_00_m.png : metallic texture. If no metallic texture is provided, a texture with constant value of 0.0 will be created automatically.
- aaaa_00_sp.png: Specular texture. If no specular texture is provided, a texture with constant value of 0.5 will be created automatically.
- aaaa_00_ao.png: Ambient Occlusion (AO) texture.

See image bellow for reference.



2. Execute the "pbrCombine.bat" script by double-clicking it
A console window will appear showing the progress of the texture conversion.


The converted textures will appear in a new folder called output
Inside the output folder you will have png and dds versions. I recommend using dds versions because it will have better quality and a smaller file size.
There will be two output texture.
- aaaa_00_nml.png/dds: this is the normal map, it just changes its filename to with the required _nml suffix.
- aaaa_00_pbr.png/dds: this one combines the input textures where the R channels is roughness. the G channel is metallic. the blue channel is specular and the alpha channel is AO.




Where to place the pbr textures

For characters textures: Final Fantasy VII\mods\textures\char
For battle textures: Final Fantasy VII\mods\textures\battle

Be careful with the filenames. It seems that it is expected to have "_00" at the end of the filename for it to work correctly.
For example cloud textures it should be aaaa_00_nml.dds and aaaa_00_pbr.dds (if you replace the color texture too then add also aaaa_00.dds)
For the first battle arena textures it should be STAGE09_T00_00_nml.dds and STAGE09_T00_00_pbr.dds (if you replace the color texture too then add also STAGE09_T00_00.dds)

Credits

Satsuki Yatoshi for helping me setting the portable imagemagick exe and the dds converter
« Last Edit: 2022-02-18 10:37:52 by Cosmos »

Cosmos

  • *
  • Posts: 34
    • View Profile
I updated the script and instructions to work with the latest FFNx implementation.