From 245ef29259a3a14c8746ed3d69a1821b702809b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4=C3=A4tt=C3=A4=20Antti?= Date: Mon, 22 Oct 2018 13:51:24 +0300 Subject: Fix default material fresnel calculations Task-number: QT3DS-2526 Change-Id: Ic295cc14b2b27b717b94c6927a2c7ad325139c80 Reviewed-by: Mahmoud Badri Reviewed-by: Jere Tuliniemi Reviewed-by: Miikka Heikkinen --- .../res/DataModelMetadata/en-us/MetaData.xml | 2 +- .../res/effectlib/defaultMaterialFresnel.glsllib | 3 +- .../effectlib/defaultMaterialFresnelNoDvn.glsllib | 43 ---------------------- 3 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 src/Runtime/res/effectlib/defaultMaterialFresnelNoDvn.glsllib (limited to 'src/Runtime/res') diff --git a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml index 2744c0af..e365a604 100644 --- a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml +++ b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml @@ -255,7 +255,7 @@ - + diff --git a/src/Runtime/res/effectlib/defaultMaterialFresnel.glsllib b/src/Runtime/res/effectlib/defaultMaterialFresnel.glsllib index 303a55b1..e0eff4ff 100644 --- a/src/Runtime/res/effectlib/defaultMaterialFresnel.glsllib +++ b/src/Runtime/res/effectlib/defaultMaterialFresnel.glsllib @@ -35,11 +35,10 @@ float defaultMaterialSimpleFresnel( in vec3 N, in vec3 viewDir, in float ior, fl { float F = ((1.0-ior) * (1.0-ior)) / ((1.0+ior) * (1.0+ior)); float VdotN = dot(viewDir, N); - float dvn = abs( dFdx(VdotN) * dFdy(VdotN) ); VdotN = clamp( VdotN, 0.0, 1.0 ); float ratio = F + (1.0 - F) * pow(1.0 - VdotN, fresnelPower); - return clamp( ratio * pow( VdotN, dvn * fresnelPower ), 0.0, 1.0 ); + return ratio; } #endif diff --git a/src/Runtime/res/effectlib/defaultMaterialFresnelNoDvn.glsllib b/src/Runtime/res/effectlib/defaultMaterialFresnelNoDvn.glsllib deleted file mode 100644 index 90958a3f..00000000 --- a/src/Runtime/res/effectlib/defaultMaterialFresnelNoDvn.glsllib +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DEFAULT_MATERIAL_FRESNEL_NO_DVN_GLSLLIB -#define DEFAULT_MATERIAL_FRESNEL_NO_DVN_GLSLLIB - -float defaultMaterialSimpleFresnel( in vec3 N, in vec3 viewDir, in float ior, float fresnelPower ) -{ - float F = ((1.0-ior) * (1.0-ior)) / ((1.0+ior) * (1.0+ior)); - float VdotN = dot(viewDir, N); - VdotN = clamp( VdotN, 0.0, 1.0 ); - float ratio = F + (1.0 - F) * pow(1.0 - VdotN, fresnelPower); - return clamp( ratio * pow( VdotN, fresnelPower ), 0.0, 1.0 ); -} - -#endif -- cgit v1.2.3