diff --git a/ArchitectureColoredPainting/res/Shaders/model.frag b/ArchitectureColoredPainting/res/Shaders/model.frag index 420b814..df9c1e5 100644 --- a/ArchitectureColoredPainting/res/Shaders/model.frag +++ b/ArchitectureColoredPainting/res/Shaders/model.frag @@ -50,6 +50,8 @@ void main() gNormal = getNormalFromMap(); else gNormal = Normal; + if(!gl_FrontFacing) + gNormal = -gNormal; if(texture_metallic_roughness_available) gMetallicRoughness = texture(texture_metallic_roughness, TexCoords).bg; else diff --git a/ArchitectureColoredPainting/res/Shaders/shadow_mapping.comp b/ArchitectureColoredPainting/res/Shaders/shadow_mapping.comp index a7410c9..f65c5f6 100644 --- a/ArchitectureColoredPainting/res/Shaders/shadow_mapping.comp +++ b/ArchitectureColoredPainting/res/Shaders/shadow_mapping.comp @@ -204,9 +204,6 @@ void main() vec3 V = normalize(camPos - worldPos); - if(dot(V, normal)<0) - normal = -normal; - vec3 F0 = vec3(0.04); F0 = mix(F0, albedo, metallic); diff --git a/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp b/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp index a46ffa4..6708558 100644 --- a/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp +++ b/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp @@ -91,7 +91,7 @@ void PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform transfo //qDebug() << leafLayer<<"------" << painterPath; // transform to -1£¬ 1 QTransform trans; - double maxLen = (std::max(bound.width(), bound.height()) + 2 * maxWidth) * 1.00001 * 2; + double maxLen = (std::max(bound.width(), bound.height()) + 2 * maxWidth) * 1.00001 / 2; //qDebug() << maxLen << bound; trans.scale(1 / maxLen, 1 / maxLen); trans.translate(-bound.center().x(), -bound.center().y());