diff --git a/shaders/pbr-qt.frag b/shaders/pbr-qt.frag index ee15bfcd..b89d1b3f 100644 --- a/shaders/pbr-qt.frag +++ b/shaders/pbr-qt.frag @@ -330,17 +330,17 @@ void main() float metalness = vertMetalness; if (metalnessMapEnabled == 1) { - metalness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).b / 255.0; + metalness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).b; } float roughness = vertRoughness; if (roughnessMapEnabled == 1) { - roughness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).r / 255.0; + roughness = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).r; } float ambientOcclusion = 1.0; if (ambientOcclusionMapEnabled == 1) { - ambientOcclusion = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).g / 255.0; + ambientOcclusion = texture2D(metalnessRoughnessAmbientOcclusionMapId, vertTexCoord).g; } roughness = min(0.99, roughness); diff --git a/src/meshloader.cpp b/src/meshloader.cpp index 806b4554..8e5dd73e 100644 --- a/src/meshloader.cpp +++ b/src/meshloader.cpp @@ -218,6 +218,12 @@ MeshLoader::MeshLoader(const MeshLoader &mesh) : if (nullptr != mesh.m_normalMapImage) { this->m_normalMapImage = new QImage(*mesh.m_normalMapImage); } + if (nullptr != mesh.m_metalnessRoughnessAmbientOcclusionImage) { + this->m_metalnessRoughnessAmbientOcclusionImage = new QImage(*mesh.m_metalnessRoughnessAmbientOcclusionImage); + this->m_hasMetalnessInImage = mesh.m_hasMetalnessInImage; + this->m_hasRoughnessInImage = mesh.m_hasRoughnessInImage; + this->m_hasAmbientOcclusionInImage = mesh.m_hasAmbientOcclusionInImage; + } this->m_vertices = mesh.m_vertices; this->m_faces = mesh.m_faces; this->m_triangulatedVertices = mesh.m_triangulatedVertices; @@ -301,6 +307,7 @@ MeshLoader::~MeshLoader() m_edgeVertexCount = 0; delete m_textureImage; delete m_normalMapImage; + delete m_metalnessRoughnessAmbientOcclusionImage; } const std::vector &MeshLoader::vertices() diff --git a/src/texturegenerator.cpp b/src/texturegenerator.cpp index 0a1854ea..5fa8eba4 100644 --- a/src/texturegenerator.cpp +++ b/src/texturegenerator.cpp @@ -216,13 +216,13 @@ void TextureGenerator::generate() m_resultTextureMetalnessRoughnessAmbientOcclusionImage->fill(Qt::transparent); m_resultTextureMetalnessImage = new QImage(TextureGenerator::m_textureSize, TextureGenerator::m_textureSize, QImage::Format_ARGB32); - m_resultTextureMetalnessImage->fill(Qt::transparent); + m_resultTextureMetalnessImage->fill(Qt::black); m_resultTextureRoughnessImage = new QImage(TextureGenerator::m_textureSize, TextureGenerator::m_textureSize, QImage::Format_ARGB32); - m_resultTextureRoughnessImage->fill(Qt::transparent); + m_resultTextureRoughnessImage->fill(Qt::white); m_resultTextureAmbientOcclusionImage = new QImage(TextureGenerator::m_textureSize, TextureGenerator::m_textureSize, QImage::Format_ARGB32); - m_resultTextureAmbientOcclusionImage->fill(Qt::transparent); + m_resultTextureAmbientOcclusionImage->fill(Qt::white); auto createImageEndTime = countTimeConsumed.elapsed();