Switch the order of ORM combined texture

Red: Ambient Occlusion
Green: Roughness
Blue: Metallic
master
Jeremy Hu 2018-11-18 07:30:26 +08:00
parent f6bafdb720
commit aea7b0cb74
2 changed files with 8 additions and 4 deletions

View File

@ -328,6 +328,10 @@ void main()
normal = normalize(normal * 2.0 - 1.0); normal = normalize(normal * 2.0 - 1.0);
} }
// Red: Ambient Occlusion
// Green: Roughness
// Blue: Metallic
float metalness = vertMetalness; float metalness = vertMetalness;
if (metalnessMapEnabled == 1) { if (metalnessMapEnabled == 1) {
metalness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).b; metalness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).b;
@ -335,12 +339,12 @@ void main()
float roughness = vertRoughness; float roughness = vertRoughness;
if (roughnessMapEnabled == 1) { if (roughnessMapEnabled == 1) {
roughness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).r; roughness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).g;
} }
float ambientOcclusion = 1.0; float ambientOcclusion = 1.0;
if (ambientOcclusionMapEnabled == 1) { if (ambientOcclusionMapEnabled == 1) {
ambientOcclusion = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).g; ambientOcclusion = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).r;
} }
roughness = min(0.99, roughness); roughness = min(0.99, roughness);

View File

@ -380,9 +380,9 @@ void TextureGenerator::generate()
if (hasMetalnessMap) if (hasMetalnessMap)
color.setBlue(qGray(m_resultTextureMetalnessImage->pixel(col, row))); color.setBlue(qGray(m_resultTextureMetalnessImage->pixel(col, row)));
if (hasRoughnessMap) if (hasRoughnessMap)
color.setRed(qGray(m_resultTextureRoughnessImage->pixel(col, row))); color.setGreen(qGray(m_resultTextureRoughnessImage->pixel(col, row)));
if (hasAmbientOcclusionMap) if (hasAmbientOcclusionMap)
color.setGreen(qGray(m_resultTextureAmbientOcclusionImage->pixel(col, row))); color.setRed(qGray(m_resultTextureAmbientOcclusionImage->pixel(col, row)));
m_resultTextureMetalnessRoughnessAmbientOcclusionImage->setPixelColor(col, row, color); m_resultTextureMetalnessRoughnessAmbientOcclusionImage->setPixelColor(col, row, color);
} }
} }