summaryrefslogtreecommitdiffstats
path: root/src/Runtime/res
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2018-10-22 13:51:24 +0300
committerAntti Määttä <antti.maatta@qt.io>2018-10-22 12:51:35 +0000
commit245ef29259a3a14c8746ed3d69a1821b702809b1 (patch)
treec5f690bf117e046bfac3346b63609810b814421c /src/Runtime/res
parent31364dde49ce8e62a5787886da8578b58db8a03c (diff)
Fix default material fresnel calculations
Task-number: QT3DS-2526 Change-Id: Ic295cc14b2b27b717b94c6927a2c7ad325139c80 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Runtime/res')
-rw-r--r--src/Runtime/res/DataModelMetadata/en-us/MetaData.xml2
-rw-r--r--src/Runtime/res/effectlib/defaultMaterialFresnel.glsllib3
-rw-r--r--src/Runtime/res/effectlib/defaultMaterialFresnelNoDvn.glsllib43
3 files changed, 2 insertions, 46 deletions
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 @@
<Property name="specularroughness" formalName="Specular Roughness" description="Softening applied to reflections and\nhighlights" min='0.001' max='1' category="Material" />
<Property name="roughnessmap" formalName="Roughness Map" description="Image to vary the specular roughness across\nthe material" type="Image" category="Material" />
<Property name="fresnelPower" formalName="Fresnel Power" description="Damping of head-on reflections" category="Material" />
- <Property name="ior" formalName="Index of Refraction" description="Angle at which fresnel reflection damping\napplies" min="0" max="1" default=".2" category="Material" />
+ <Property name="ior" formalName="Index of Refraction" description="Index of refraction of the material" min="1" default="1.5" category="Material" />
<Property name="bumpmap" formalName="Bump Map" description="Grayscale image simulating roughness in the\nlighting" type="Image" category="Material" />
<Property name="normalmap" formalName="Normal Map" description="Special RGB image describing surface\nroughness" type="Image" category="Material" />
<Property name="bumpamount" formalName="Bump Amount" description="Strength of bump/normal map effect" type="float" default=".5" category="Material" />
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