Skip to content

Substance Painter

KW71 edited this page Apr 22, 2021 · 6 revisions

Substance Painter

Export profile for Outerra

The following configuration is recommended for exporting textures for outerra. It supports all common texture slots which outerra currently uses. Export profile for Outerra

Texture converter

If nvcompress is installed globally or installed in System32 its possible to convert the output of substance painter automatically to dds textures. The following powershell-script generates the dds textures and copies them into the outerra package folder. Just configure the source- and target path of the textures and also the used extensions. In this example substance painter generates .tga files which are converted to .dds.

$source_path = "C:\Users\Thomas\Documents\Substance Painter 2\export\pbr-reference"
$target_path = "C:\Users\Thomas\Outerra\packages\necro\pbr-reference"
$source_ext = ".tga"
$target_ext = ".dds"

#get-childitem $target_path $target_ext -recurse | foreach ($_) {remove-item $_.fullname}

#albedo
$files_alb = ls -Path $source_path *_tex_albedo.tga
foreach ($file in $files_alb)
{
    $out_file = $file -replace $source_ext, $target_ext
    Write-Host ((Get-Date).ToLongTimeString() + ": " + "Exporting " + $out_file) -foregroundcolor "DarkYellow"
    (nvcompress -bc1 $file.FullName $target_path\$out_file) | Out-Null
}

#normal
$files_nrm = ls -Path $source_path *_tex_normal.tga
foreach ($file in $files_nrm)
{
    $out_file = $file -replace $source_ext, $target_ext
    Write-Host ((Get-Date).ToLongTimeString() + ": " + "Exporting " + $out_file) -foregroundcolor "DarkYellow"
    (nvcompress -bc5 -normal $file.FullName $target_path\$out_file) | Out-Null
}

#roughness
$files_rgh = ls -Path $source_path *_tex_roughness.tga
foreach ($file in $files_rgh)
{
    $out_file = $file -replace $source_ext, $target_ext
    Write-Host ((Get-Date).ToLongTimeString() + ": " + "Exporting " + $out_file) -foregroundcolor "DarkYellow"
    (nvcompress -bc4 -linear $file.FullName $target_path\$out_file) | Out-Null
}

#reflectance
$files_ref = ls -Path $source_path *_tex_reflectance.tga
foreach ($file in $files_ref)
{
    $out_file = $file -replace $source_ext, $target_ext
    Write-Host ((Get-Date).ToLongTimeString() + ": " + "Exporting " + $out_file) -foregroundcolor "DarkYellow"
    (nvcompress -bc4 -linear $file.FullName $target_path\$out_file) | Out-Null
}

#opactiy
$files_opa = ls -Path $source_path *_tex_opacity.tga
foreach ($file in $files_opa)
{
    $out_file = $file -replace $source_ext, $target_ext
    Write-Host ((Get-Date).ToLongTimeString() + ": " + "Exporting " + $out_file) -foregroundcolor "DarkYellow"
    (nvcompress -bc4 -linear $file.FullName $target_path\$out_file) | Out-Null
}

#emissive
$files_emi = ls -Path $source_path *_tex_emissive.tga
foreach ($file in $files_emi)
{
    $out_file = $file -replace $source_ext, $target_ext
    Write-Host ((Get-Date).ToLongTimeString() + ": " + "Exporting " + $out_file) -foregroundcolor "DarkYellow"
    (nvcompress -bc1 $file.FullName $target_path\$out_file) | out-null
}

Write-Host ((Get-Date).ToLongTimeString() + ": " + "Job finished") -foregroundcolor "yellow"

Write-Host ((Get-Date).ToLongTimeString() + ": " + "Starting OT.. ") -foregroundcolor "DarkYellow"
    (& "C:\Program Files (x86)\Outerra\Anteworld\outerra.exe" -autologin) | out-null