diff --git a/shaders/pbr-qt.frag b/shaders/pbr-qt.frag index b89d1b3f..6f95cb46 100644 --- a/shaders/pbr-qt.frag +++ b/shaders/pbr-qt.frag @@ -328,6 +328,10 @@ void main() normal = normalize(normal * 2.0 - 1.0); } + // Red: Ambient Occlusion + // Green: Roughness + // Blue: Metallic + float metalness = vertMetalness; if (metalnessMapEnabled == 1) { metalness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).b; @@ -335,12 +339,12 @@ void main() float roughness = vertRoughness; if (roughnessMapEnabled == 1) { - roughness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).r; + roughness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).g; } float ambientOcclusion = 1.0; if (ambientOcclusionMapEnabled == 1) { - ambientOcclusion = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).g; + ambientOcclusion = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).r; } roughness = min(0.99, roughness); diff --git a/src/texturegenerator.cpp b/src/texturegenerator.cpp index aa2e6a03..94ef88c1 100644 --- a/src/texturegenerator.cpp +++ b/src/texturegenerator.cpp @@ -380,9 +380,9 @@ void TextureGenerator::generate() if (hasMetalnessMap) color.setBlue(qGray(m_resultTextureMetalnessImage->pixel(col, row))); if (hasRoughnessMap) - color.setRed(qGray(m_resultTextureRoughnessImage->pixel(col, row))); + color.setGreen(qGray(m_resultTextureRoughnessImage->pixel(col, row))); if (hasAmbientOcclusionMap) - color.setGreen(qGray(m_resultTextureAmbientOcclusionImage->pixel(col, row))); + color.setRed(qGray(m_resultTextureAmbientOcclusionImage->pixel(col, row))); m_resultTextureMetalnessRoughnessAmbientOcclusionImage->setPixelColor(col, row, color); } }