From 40a191059699f37d947d6822b0df69f30803b167 Mon Sep 17 00:00:00 2001 From: Jere Tuliniemi Date: Fri, 30 Nov 2018 11:56:58 +0200 Subject: Allow .shader suffix for .material files Also renames *.material files to *.shader files inside the Material Library. Task-number: QT3DS-2787 Change-Id: Iaa3e64fae934b526ad0903c19d3cdb2b6923cc95 Reviewed-by: Miikka Heikkinen --- .../Material Library/aluminium_anodized.material | 178 -------- .../Material Library/aluminium_anodized.shader | 178 ++++++++ .../aluminium_anodized_emissive.material | 214 --------- .../aluminium_anodized_emissive.shader | 214 +++++++++ Studio/Content/Material Library/aluminum.material | 223 ---------- Studio/Content/Material Library/aluminum.shader | 223 ++++++++++ .../Material Library/aluminum_anisotropic.material | 260 ----------- .../Material Library/aluminum_anisotropic.shader | 260 +++++++++++ .../Material Library/aluminum_brushed.material | 224 ---------- .../Material Library/aluminum_brushed.shader | 224 ++++++++++ .../Material Library/aluminum_emissive.material | 230 ---------- .../Material Library/aluminum_emissive.shader | 230 ++++++++++ .../aluminum_textured_aniso.material | 263 ----------- .../aluminum_textured_aniso.shader | 263 +++++++++++ Studio/Content/Material Library/asphalt.material | 236 ---------- Studio/Content/Material Library/asphalt.shader | 236 ++++++++++ .../Material Library/bamboo_natural_matte.material | 236 ---------- .../Material Library/bamboo_natural_matte.shader | 236 ++++++++++ .../bamboo_natural_matte_emissive.material | 242 ---------- .../bamboo_natural_matte_emissive.shader | 242 ++++++++++ .../Content/Material Library/carbon_fiber.material | 271 ------------ .../Content/Material Library/carbon_fiber.shader | 271 ++++++++++++ .../carbon_fiber_emissive.material | 277 ------------ .../Material Library/carbon_fiber_emissive.shader | 277 ++++++++++++ .../carpaint_blue_standard.material | 231 ---------- .../Material Library/carpaint_blue_standard.shader | 231 ++++++++++ .../carpaint_color_peel_2_layer.material | 255 ----------- .../carpaint_color_peel_2_layer.shader | 255 +++++++++++ .../carpaint_yellow_standard.material | 231 ---------- .../carpaint_yellow_standard.shader | 231 ++++++++++ Studio/Content/Material Library/concrete.material | 235 ---------- Studio/Content/Material Library/concrete.shader | 235 ++++++++++ Studio/Content/Material Library/copper.material | 178 -------- Studio/Content/Material Library/copper.shader | 178 ++++++++ .../leather_smoothed_black.material | 236 ---------- .../Material Library/leather_smoothed_black.shader | 236 ++++++++++ .../Content/Material Library/mesh_fence.material | 236 ---------- Studio/Content/Material Library/mesh_fence.shader | 236 ++++++++++ .../Material Library/metal_mesh_fine.material | 234 ---------- .../Material Library/metal_mesh_fine.shader | 234 ++++++++++ .../Material Library/paper_artistic.material | 257 ----------- .../Content/Material Library/paper_artistic.shader | 257 +++++++++++ .../Content/Material Library/paper_office.material | 255 ----------- .../Content/Material Library/paper_office.shader | 255 +++++++++++ .../plastic_structured_red.material | 204 --------- .../Material Library/plastic_structured_red.shader | 204 +++++++++ .../plastic_structured_red_emissive.material | 228 ---------- .../plastic_structured_red_emissive.shader | 228 ++++++++++ Studio/Content/Material Library/porcelain.material | 181 -------- Studio/Content/Material Library/porcelain.shader | 181 ++++++++ .../Content/Material Library/powder_coat.material | 221 ---------- Studio/Content/Material Library/powder_coat.shader | 221 ++++++++++ .../Material Library/powder_coat_emissive.material | 256 ----------- .../Material Library/powder_coat_emissive.shader | 256 +++++++++++ .../Material Library/rubber_studded_black.material | 219 ---------- .../Material Library/rubber_studded_black.shader | 219 ++++++++++ .../rubber_studded_emissive.material | 238 ---------- .../rubber_studded_emissive.shader | 238 ++++++++++ .../Content/Material Library/simple_glass.material | 197 --------- .../Content/Material Library/simple_glass.shader | 197 +++++++++ .../steel_milled_concentric.material | 237 ---------- .../steel_milled_concentric.shader | 237 ++++++++++ .../Material Library/thin_glass_frosted.material | 485 --------------------- .../Material Library/thin_glass_frosted.shader | 485 +++++++++++++++++++++ .../thin_glass_frosted_sp.material | 246 ----------- .../Material Library/thin_glass_frosted_sp.shader | 246 +++++++++++ .../thin_glass_refractive.material | 202 --------- .../Material Library/thin_glass_refractive.shader | 202 +++++++++ .../Content/Material Library/walnut_matte.material | 236 ---------- .../Content/Material Library/walnut_matte.shader | 236 ++++++++++ .../Client/Code/Core/Doc/DocumentEditor.cpp | 3 +- .../Client/Code/Core/Doc/IComposerSerializer.cpp | 4 +- src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp | 2 +- .../Palettes/Inspector/InspectorControlView.cpp | 3 +- src/Authoring/Studio/Workspace/Dialogs.cpp | 4 +- .../Source/UIPParser/Source/Qt3DSUIPParserImpl.cpp | 2 +- src/Runtime/testres.qrc | 12 +- .../Qt3DSRenderTestCustomMaterialGenerator.cpp | 6 +- 78 files changed, 8372 insertions(+), 8368 deletions(-) delete mode 100644 Studio/Content/Material Library/aluminium_anodized.material create mode 100644 Studio/Content/Material Library/aluminium_anodized.shader delete mode 100644 Studio/Content/Material Library/aluminium_anodized_emissive.material create mode 100644 Studio/Content/Material Library/aluminium_anodized_emissive.shader delete mode 100644 Studio/Content/Material Library/aluminum.material create mode 100644 Studio/Content/Material Library/aluminum.shader delete mode 100644 Studio/Content/Material Library/aluminum_anisotropic.material create mode 100644 Studio/Content/Material Library/aluminum_anisotropic.shader delete mode 100644 Studio/Content/Material Library/aluminum_brushed.material create mode 100644 Studio/Content/Material Library/aluminum_brushed.shader delete mode 100644 Studio/Content/Material Library/aluminum_emissive.material create mode 100644 Studio/Content/Material Library/aluminum_emissive.shader delete mode 100644 Studio/Content/Material Library/aluminum_textured_aniso.material create mode 100644 Studio/Content/Material Library/aluminum_textured_aniso.shader delete mode 100644 Studio/Content/Material Library/asphalt.material create mode 100644 Studio/Content/Material Library/asphalt.shader delete mode 100644 Studio/Content/Material Library/bamboo_natural_matte.material create mode 100644 Studio/Content/Material Library/bamboo_natural_matte.shader delete mode 100644 Studio/Content/Material Library/bamboo_natural_matte_emissive.material create mode 100644 Studio/Content/Material Library/bamboo_natural_matte_emissive.shader delete mode 100644 Studio/Content/Material Library/carbon_fiber.material create mode 100644 Studio/Content/Material Library/carbon_fiber.shader delete mode 100644 Studio/Content/Material Library/carbon_fiber_emissive.material create mode 100644 Studio/Content/Material Library/carbon_fiber_emissive.shader delete mode 100644 Studio/Content/Material Library/carpaint_blue_standard.material create mode 100644 Studio/Content/Material Library/carpaint_blue_standard.shader delete mode 100644 Studio/Content/Material Library/carpaint_color_peel_2_layer.material create mode 100644 Studio/Content/Material Library/carpaint_color_peel_2_layer.shader delete mode 100644 Studio/Content/Material Library/carpaint_yellow_standard.material create mode 100644 Studio/Content/Material Library/carpaint_yellow_standard.shader delete mode 100644 Studio/Content/Material Library/concrete.material create mode 100644 Studio/Content/Material Library/concrete.shader delete mode 100644 Studio/Content/Material Library/copper.material create mode 100644 Studio/Content/Material Library/copper.shader delete mode 100644 Studio/Content/Material Library/leather_smoothed_black.material create mode 100644 Studio/Content/Material Library/leather_smoothed_black.shader delete mode 100644 Studio/Content/Material Library/mesh_fence.material create mode 100644 Studio/Content/Material Library/mesh_fence.shader delete mode 100644 Studio/Content/Material Library/metal_mesh_fine.material create mode 100644 Studio/Content/Material Library/metal_mesh_fine.shader delete mode 100644 Studio/Content/Material Library/paper_artistic.material create mode 100644 Studio/Content/Material Library/paper_artistic.shader delete mode 100644 Studio/Content/Material Library/paper_office.material create mode 100644 Studio/Content/Material Library/paper_office.shader delete mode 100644 Studio/Content/Material Library/plastic_structured_red.material create mode 100644 Studio/Content/Material Library/plastic_structured_red.shader delete mode 100644 Studio/Content/Material Library/plastic_structured_red_emissive.material create mode 100644 Studio/Content/Material Library/plastic_structured_red_emissive.shader delete mode 100644 Studio/Content/Material Library/porcelain.material create mode 100644 Studio/Content/Material Library/porcelain.shader delete mode 100644 Studio/Content/Material Library/powder_coat.material create mode 100644 Studio/Content/Material Library/powder_coat.shader delete mode 100644 Studio/Content/Material Library/powder_coat_emissive.material create mode 100644 Studio/Content/Material Library/powder_coat_emissive.shader delete mode 100644 Studio/Content/Material Library/rubber_studded_black.material create mode 100644 Studio/Content/Material Library/rubber_studded_black.shader delete mode 100644 Studio/Content/Material Library/rubber_studded_emissive.material create mode 100644 Studio/Content/Material Library/rubber_studded_emissive.shader delete mode 100644 Studio/Content/Material Library/simple_glass.material create mode 100644 Studio/Content/Material Library/simple_glass.shader delete mode 100644 Studio/Content/Material Library/steel_milled_concentric.material create mode 100644 Studio/Content/Material Library/steel_milled_concentric.shader delete mode 100644 Studio/Content/Material Library/thin_glass_frosted.material create mode 100644 Studio/Content/Material Library/thin_glass_frosted.shader delete mode 100644 Studio/Content/Material Library/thin_glass_frosted_sp.material create mode 100644 Studio/Content/Material Library/thin_glass_frosted_sp.shader delete mode 100644 Studio/Content/Material Library/thin_glass_refractive.material create mode 100644 Studio/Content/Material Library/thin_glass_refractive.shader delete mode 100644 Studio/Content/Material Library/walnut_matte.material create mode 100644 Studio/Content/Material Library/walnut_matte.shader diff --git a/Studio/Content/Material Library/aluminium_anodized.material b/Studio/Content/Material Library/aluminium_anodized.material deleted file mode 100644 index f989cbcd..00000000 --- a/Studio/Content/Material Library/aluminium_anodized.material +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( 22, 22, 22 ), 1.000000, vec4( base_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminium_anodized.shader b/Studio/Content/Material Library/aluminium_anodized.shader new file mode 100644 index 00000000..f989cbcd --- /dev/null +++ b/Studio/Content/Material Library/aluminium_anodized.shader @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( 22, 22, 22 ), 1.000000, vec4( base_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/aluminium_anodized_emissive.material b/Studio/Content/Material Library/aluminium_anodized_emissive.material deleted file mode 100644 index 22ebcab4..00000000 --- a/Studio/Content/Material Library/aluminium_anodized_emissive.material +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fresnelLayer.glsllib" -#include "monoChannel.glsllib" -#include "fileTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*fileTexture(emissive_mask_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( 22, 22, 22 ), 1.000000, vec4( base_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminium_anodized_emissive.shader b/Studio/Content/Material Library/aluminium_anodized_emissive.shader new file mode 100644 index 00000000..22ebcab4 --- /dev/null +++ b/Studio/Content/Material Library/aluminium_anodized_emissive.shader @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fresnelLayer.glsllib" +#include "monoChannel.glsllib" +#include "fileTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*fileTexture(emissive_mask_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( 22, 22, 22 ), 1.000000, vec4( base_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/aluminum.material b/Studio/Content/Material Library/aluminum.material deleted file mode 100644 index 00909fa3..00000000 --- a/Studio/Content/Material Library/aluminum.material +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp1; -float tmp2; -float ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "weightedLayer.glsllib" -#include "fileTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, tmp2, tmp2, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, tmp2, tmp2 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, tmp2, tmp2, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, tmp2, tmp2 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); -} - -void computeTemporaries() -{ - tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), tiling ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp2 = fileTexture(roughness_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - ftmp0 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( ftmp0, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminum.shader b/Studio/Content/Material Library/aluminum.shader new file mode 100644 index 00000000..00909fa3 --- /dev/null +++ b/Studio/Content/Material Library/aluminum.shader @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp1; +float tmp2; +float ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "weightedLayer.glsllib" +#include "fileTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, tmp2, tmp2, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, tmp2, tmp2 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, tmp2, tmp2, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, tmp2, tmp2 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); +} + +void computeTemporaries() +{ + tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), tiling ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp2 = fileTexture(roughness_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + ftmp0 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp0, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/aluminum_anisotropic.material b/Studio/Content/Material Library/aluminum_anisotropic.material deleted file mode 100644 index b5fed9fd..00000000 --- a/Studio/Content/Material Library/aluminum_anisotropic.material +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -struct anisotropy_return -{ - float roughness_u; - float roughness_v; - vec3 tangent_u; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -texture_return tmp4; -anisotropy_return tmp5; -vec3 tmp6; -vec3 tmp8; -float ftmp0; -float ftmp1; -vec3 ftmp2; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "fileTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "anisotropyConversion.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( tmp8 ); -} - -void computeTemporaries() -{ - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( tiling[0], tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp4 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ); - tmp5 = anisotropyConversion( fileTexture(reflection_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, anisotropy, fileTexture(aniso_rot_texture, vec3( aniso_tex_color_offset ), vec3( aniso_tex_color_scale ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono, tangent, false ); - tmp6 = tmp4.tint; - tmp8 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = tmp5.roughness_u; - ftmp1 = tmp5.roughness_v; - ftmp2 = tmp5.tangent_u; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( base_weight, vec4( tmp6, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp8, vec3( material_ior ), tmp4.mono, vec4( tmp6, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( ftmp2, cross(tmp8, ftmp2), tmp8 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminum_anisotropic.shader b/Studio/Content/Material Library/aluminum_anisotropic.shader new file mode 100644 index 00000000..b5fed9fd --- /dev/null +++ b/Studio/Content/Material Library/aluminum_anisotropic.shader @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +struct anisotropy_return +{ + float roughness_u; + float roughness_v; + vec3 tangent_u; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +texture_return tmp4; +anisotropy_return tmp5; +vec3 tmp6; +vec3 tmp8; +float ftmp0; +float ftmp1; +vec3 ftmp2; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "fileTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "anisotropyConversion.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( tmp8 ); +} + +void computeTemporaries() +{ + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( tiling[0], tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp4 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ); + tmp5 = anisotropyConversion( fileTexture(reflection_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, anisotropy, fileTexture(aniso_rot_texture, vec3( aniso_tex_color_offset ), vec3( aniso_tex_color_scale ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono, tangent, false ); + tmp6 = tmp4.tint; + tmp8 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = tmp5.roughness_u; + ftmp1 = tmp5.roughness_v; + ftmp2 = tmp5.tangent_u; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( base_weight, vec4( tmp6, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp8, vec3( material_ior ), tmp4.mono, vec4( tmp6, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( ftmp2, cross(tmp8, ftmp2), tmp8 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/aluminum_brushed.material b/Studio/Content/Material Library/aluminum_brushed.material deleted file mode 100644 index a3492898..00000000 --- a/Studio/Content/Material Library/aluminum_brushed.material +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp1; -float ftmp0; -float ftmp1; -float ftmp2; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "weightedLayer.glsllib" -#include "fileTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp1, ftmp2, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp1, ftmp2 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp1, ftmp2, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp1, ftmp2 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); -} - -void computeTemporaries() -{ - tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), tiling ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - ftmp0 = fileTexture(brush_texture, vec3( 0.5, 0.5, 0.5 ), vec3( 0.5, 0.5, 0.5 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - ftmp1 = fileTexture(roughness_texture_u, vec3( 0.12, 0.12, 0.12 ), vec3( ( 0.800000*brushing_strength ) ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - ftmp2 = fileTexture(roughness_texture_v, vec3( ( 0.150000+( 0.400000*reflection_stretch ) ) ), vec3( ( 0.100000+( reflection_stretch*0.300000 ) ) ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( ftmp0, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminum_brushed.shader b/Studio/Content/Material Library/aluminum_brushed.shader new file mode 100644 index 00000000..a3492898 --- /dev/null +++ b/Studio/Content/Material Library/aluminum_brushed.shader @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp1; +float ftmp0; +float ftmp1; +float ftmp2; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "weightedLayer.glsllib" +#include "fileTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp1, ftmp2, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp1, ftmp2 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp1, ftmp2, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp1, ftmp2 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); +} + +void computeTemporaries() +{ + tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), tiling ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + ftmp0 = fileTexture(brush_texture, vec3( 0.5, 0.5, 0.5 ), vec3( 0.5, 0.5, 0.5 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + ftmp1 = fileTexture(roughness_texture_u, vec3( 0.12, 0.12, 0.12 ), vec3( ( 0.800000*brushing_strength ) ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + ftmp2 = fileTexture(roughness_texture_v, vec3( ( 0.150000+( 0.400000*reflection_stretch ) ) ), vec3( ( 0.100000+( reflection_stretch*0.300000 ) ) ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp0, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/aluminum_emissive.material b/Studio/Content/Material Library/aluminum_emissive.material deleted file mode 100644 index 5512dcd0..00000000 --- a/Studio/Content/Material Library/aluminum_emissive.material +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp1; -texture_coordinate_info tmp2; -float tmp3; -float ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "weightedLayer.glsllib" -#include "fileTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp1 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*fileTexture(emissive_mask_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), emissive_mask_offset, vec3( 1.000000, 1.000000, 1.000000 ) ), tmp1 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, tmp3, tmp3, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, tmp3, tmp3 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, tmp3, tmp3, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, tmp3, tmp3 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); -} - -void computeTemporaries() -{ - tmp1 = textureCoordinateInfo( texCoord0, tangent, binormal ); - tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), tiling ), tmp1 ); - tmp3 = fileTexture(roughness_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - ftmp0 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( ftmp0, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminum_emissive.shader b/Studio/Content/Material Library/aluminum_emissive.shader new file mode 100644 index 00000000..5512dcd0 --- /dev/null +++ b/Studio/Content/Material Library/aluminum_emissive.shader @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp1; +texture_coordinate_info tmp2; +float tmp3; +float ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "weightedLayer.glsllib" +#include "fileTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp1 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*fileTexture(emissive_mask_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), emissive_mask_offset, vec3( 1.000000, 1.000000, 1.000000 ) ), tmp1 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, tmp3, tmp3, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, tmp3, tmp3 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, tmp3, tmp3, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, tmp3, tmp3 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); +} + +void computeTemporaries() +{ + tmp1 = textureCoordinateInfo( texCoord0, tangent, binormal ); + tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), tiling ), tmp1 ); + tmp3 = fileTexture(roughness_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + ftmp0 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp0, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/aluminum_textured_aniso.material b/Studio/Content/Material Library/aluminum_textured_aniso.material deleted file mode 100644 index ed9fb88a..00000000 --- a/Studio/Content/Material Library/aluminum_textured_aniso.material +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -struct anisotropy_return -{ - float roughness_u; - float roughness_v; - vec3 tangent_u; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -texture_coordinate_info tmp4; -texture_return tmp5; -anisotropy_return tmp7; -vec3 tmp8; -vec3 tmp10; -float ftmp0; -float ftmp1; -vec3 ftmp2; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "fileTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "anisotropyConversion.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( tmp10 ); -} - -void computeTemporaries() -{ - tmp2 = textureCoordinateInfo( texCoord0, tangent, binormal ); - tmp4 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( tiling[0], tiling[1], 1.000000 ) ), tmp2 ); - tmp5 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ); - tmp7 = anisotropyConversion( fileTexture(reflection_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, anisotropy, fileTexture(aniso_rot_texture, vec3( aniso_tex_color_offset ), vec3( aniso_tex_color_scale ), mono_luminance, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( aniso_tiling[0], aniso_tiling[1], 1.000000 ) ), tmp2 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono, tangent, false ); - tmp8 = tmp5.tint; - tmp10 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = tmp7.roughness_u; - ftmp1 = tmp7.roughness_v; - ftmp2 = tmp7.tangent_u; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( base_weight, vec4( tmp8, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp10, vec3( material_ior ), tmp5.mono, vec4( tmp8, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( ftmp2, cross(tmp10, ftmp2), tmp10 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/aluminum_textured_aniso.shader b/Studio/Content/Material Library/aluminum_textured_aniso.shader new file mode 100644 index 00000000..ed9fb88a --- /dev/null +++ b/Studio/Content/Material Library/aluminum_textured_aniso.shader @@ -0,0 +1,263 @@ + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +struct anisotropy_return +{ + float roughness_u; + float roughness_v; + vec3 tangent_u; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +texture_coordinate_info tmp4; +texture_return tmp5; +anisotropy_return tmp7; +vec3 tmp8; +vec3 tmp10; +float ftmp0; +float ftmp1; +vec3 ftmp2; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "fileTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "anisotropyConversion.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( tmp10 ); +} + +void computeTemporaries() +{ + tmp2 = textureCoordinateInfo( texCoord0, tangent, binormal ); + tmp4 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( tiling[0], tiling[1], 1.000000 ) ), tmp2 ); + tmp5 = fileTexture(reflection_texture, vec3( reflection_map_offset ), vec3( reflection_map_scale ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ); + tmp7 = anisotropyConversion( fileTexture(reflection_texture, vec3( roughness_map_offset ), vec3( roughness_map_scale ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, anisotropy, fileTexture(aniso_rot_texture, vec3( aniso_tex_color_offset ), vec3( aniso_tex_color_scale ), mono_luminance, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( aniso_tiling[0], aniso_tiling[1], 1.000000 ) ), tmp2 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).mono, tangent, false ); + tmp8 = tmp5.tint; + tmp10 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = tmp7.roughness_u; + ftmp1 = tmp7.roughness_v; + ftmp2 = tmp7.tangent_u; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( base_weight, vec4( tmp8, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp10, vec3( material_ior ), tmp5.mono, vec4( tmp8, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( ftmp2, cross(tmp10, ftmp2), tmp10 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/asphalt.material b/Studio/Content/Material Library/asphalt.material deleted file mode 100644 index da37ed41..00000000 --- a/Studio/Content/Material Library/asphalt.material +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 tmp5; -vec3 ftmp0; -vec3 ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fileTexture.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/asphalt.shader b/Studio/Content/Material Library/asphalt.shader new file mode 100644 index 00000000..da37ed41 --- /dev/null +++ b/Studio/Content/Material Library/asphalt.shader @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 tmp5; +vec3 ftmp0; +vec3 ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fileTexture.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/bamboo_natural_matte.material b/Studio/Content/Material Library/bamboo_natural_matte.material deleted file mode 100644 index 28ab611d..00000000 --- a/Studio/Content/Material Library/bamboo_natural_matte.material +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 tmp5; -vec3 ftmp0; -vec3 ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fileTexture.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/bamboo_natural_matte.shader b/Studio/Content/Material Library/bamboo_natural_matte.shader new file mode 100644 index 00000000..28ab611d --- /dev/null +++ b/Studio/Content/Material Library/bamboo_natural_matte.shader @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 tmp5; +vec3 ftmp0; +vec3 ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fileTexture.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/bamboo_natural_matte_emissive.material b/Studio/Content/Material Library/bamboo_natural_matte_emissive.material deleted file mode 100644 index fde99ae1..00000000 --- a/Studio/Content/Material Library/bamboo_natural_matte_emissive.material +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -texture_coordinate_info tmp3; -vec3 tmp6; -vec3 ftmp0; -vec3 ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fileTexture.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp2 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = textureCoordinateInfo( texCoord0, tangent, binormal ); - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), tmp2 ); - tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp6, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/bamboo_natural_matte_emissive.shader b/Studio/Content/Material Library/bamboo_natural_matte_emissive.shader new file mode 100644 index 00000000..fde99ae1 --- /dev/null +++ b/Studio/Content/Material Library/bamboo_natural_matte_emissive.shader @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +texture_coordinate_info tmp3; +vec3 tmp6; +vec3 ftmp0; +vec3 ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fileTexture.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp2 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = textureCoordinateInfo( texCoord0, tangent, binormal ); + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), tmp2 ); + tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp6, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/carbon_fiber.material b/Studio/Content/Material Library/carbon_fiber.material deleted file mode 100644 index fd3eca38..00000000 --- a/Studio/Content/Material Library/carbon_fiber.material +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct anisotropy_return -{ - float roughness_u; - float roughness_v; - vec3 tangent_u; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -anisotropy_return tmp4; -vec3 tmp6; -float ftmp0; -float ftmp1; -vec3 ftmp2; -vec3 ftmp3; -vec3 ftmp4; - vec4 tmpShadowTerm; - -layer_result layers[3]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "fileTexture.glsllib" -#include "anisotropyConversion.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, coat_roughness, coat_roughness, scatter_reflect ); - - layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, coat_roughness, coat_roughness ); - - layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness, scatter_reflect ); - - layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness ); - - layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, ftmp0, ftmp1 ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp4 = anisotropyConversion( base_roughness, anisotropy, fileTexture(anisotropy_rotation_texture, vec3( 0, 0, 0 ), vec3( 3.14, 3.14, 3.14 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, tangent, false ); - tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = tmp4.roughness_u; - ftmp1 = tmp4.roughness_v; - ftmp2 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp3 = tmp4.tangent_u; - ftmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp4, 1.0).rgb, layers[2].layer, layers[2].base, alpha ); - color = fresnelLayer( tmp6, vec3( base_ior ), base_weight, vec4( ftmp2, 1.0).rgb, layers[1].layer, color, color.a ); - color = fresnelLayer( normal, vec3( coat_ior ), coat_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( ftmp3, cross(tmp6, ftmp3), tmp6 ) ); - layers[2].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[2].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[2].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/carbon_fiber.shader b/Studio/Content/Material Library/carbon_fiber.shader new file mode 100644 index 00000000..fd3eca38 --- /dev/null +++ b/Studio/Content/Material Library/carbon_fiber.shader @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct anisotropy_return +{ + float roughness_u; + float roughness_v; + vec3 tangent_u; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +anisotropy_return tmp4; +vec3 tmp6; +float ftmp0; +float ftmp1; +vec3 ftmp2; +vec3 ftmp3; +vec3 ftmp4; + vec4 tmpShadowTerm; + +layer_result layers[3]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "fileTexture.glsllib" +#include "anisotropyConversion.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, coat_roughness, coat_roughness, scatter_reflect ); + + layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, coat_roughness, coat_roughness ); + + layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness, scatter_reflect ); + + layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness ); + + layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, ftmp0, ftmp1 ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp4 = anisotropyConversion( base_roughness, anisotropy, fileTexture(anisotropy_rotation_texture, vec3( 0, 0, 0 ), vec3( 3.14, 3.14, 3.14 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, tangent, false ); + tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = tmp4.roughness_u; + ftmp1 = tmp4.roughness_v; + ftmp2 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp3 = tmp4.tangent_u; + ftmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp4, 1.0).rgb, layers[2].layer, layers[2].base, alpha ); + color = fresnelLayer( tmp6, vec3( base_ior ), base_weight, vec4( ftmp2, 1.0).rgb, layers[1].layer, color, color.a ); + color = fresnelLayer( normal, vec3( coat_ior ), coat_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( ftmp3, cross(tmp6, ftmp3), tmp6 ) ); + layers[2].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[2].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[2].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/carbon_fiber_emissive.material b/Studio/Content/Material Library/carbon_fiber_emissive.material deleted file mode 100644 index 255ec618..00000000 --- a/Studio/Content/Material Library/carbon_fiber_emissive.material +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct anisotropy_return -{ - float roughness_u; - float roughness_v; - vec3 tangent_u; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -texture_coordinate_info tmp4; -anisotropy_return tmp5; -vec3 tmp7; -float ftmp0; -float ftmp1; -vec3 ftmp2; -vec3 ftmp3; -vec3 ftmp4; - vec4 tmpShadowTerm; - -layer_result layers[3]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "fileTexture.glsllib" -#include "anisotropyConversion.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, coat_roughness, coat_roughness, scatter_reflect ); - - layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp7, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, coat_roughness, coat_roughness ); - - layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness, scatter_reflect ); - - layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp7, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness ); - - layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, ftmp0, ftmp1 ); - - layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[2].layer += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = textureCoordinateInfo( texCoord0, tangent, binormal ); - tmp4 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), tmp3 ); - tmp5 = anisotropyConversion( base_roughness, anisotropy, fileTexture(anisotropy_rotation_texture, vec3( 0, 0, 0 ), vec3( 3.14, 3.14, 3.14 ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, tangent, false ); - tmp7 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = tmp5.roughness_u; - ftmp1 = tmp5.roughness_v; - ftmp2 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp3 = tmp5.tangent_u; - ftmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp4, 1.0).rgb, layers[2].layer, layers[2].base, alpha ); - color = fresnelLayer( tmp7, vec3( base_ior ), base_weight, vec4( ftmp2, 1.0).rgb, layers[1].layer, color, color.a ); - color = fresnelLayer( normal, vec3( coat_ior ), coat_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( ftmp3, cross(tmp7, ftmp3), tmp7 ) ); - layers[2].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[2].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[2].tanFrame = orthoNormalize( mat3( tangent, cross(tmp7, tangent), tmp7 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/carbon_fiber_emissive.shader b/Studio/Content/Material Library/carbon_fiber_emissive.shader new file mode 100644 index 00000000..255ec618 --- /dev/null +++ b/Studio/Content/Material Library/carbon_fiber_emissive.shader @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct anisotropy_return +{ + float roughness_u; + float roughness_v; + vec3 tangent_u; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +texture_coordinate_info tmp4; +anisotropy_return tmp5; +vec3 tmp7; +float ftmp0; +float ftmp1; +vec3 ftmp2; +vec3 ftmp3; +vec3 ftmp4; + vec4 tmpShadowTerm; + +layer_result layers[3]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "fileTexture.glsllib" +#include "anisotropyConversion.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, coat_roughness, coat_roughness, scatter_reflect ); + + layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp7, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, coat_roughness, coat_roughness ); + + layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness, scatter_reflect ); + + layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp7, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness ); + + layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, ftmp0, ftmp1 ); + + layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[2].layer += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = textureCoordinateInfo( texCoord0, tangent, binormal ); + tmp4 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), tmp3 ); + tmp5 = anisotropyConversion( base_roughness, anisotropy, fileTexture(anisotropy_rotation_texture, vec3( 0, 0, 0 ), vec3( 3.14, 3.14, 3.14 ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, tangent, false ); + tmp7 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = tmp5.roughness_u; + ftmp1 = tmp5.roughness_v; + ftmp2 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp3 = tmp5.tangent_u; + ftmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp4, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp4, 1.0).rgb, layers[2].layer, layers[2].base, alpha ); + color = fresnelLayer( tmp7, vec3( base_ior ), base_weight, vec4( ftmp2, 1.0).rgb, layers[1].layer, color, color.a ); + color = fresnelLayer( normal, vec3( coat_ior ), coat_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( ftmp3, cross(tmp7, ftmp3), tmp7 ) ); + layers[2].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[2].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[2].tanFrame = orthoNormalize( mat3( tangent, cross(tmp7, tangent), tmp7 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/carpaint_blue_standard.material b/Studio/Content/Material Library/carpaint_blue_standard.material deleted file mode 100644 index 5fed8438..00000000 --- a/Studio/Content/Material Library/carpaint_blue_standard.material +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - -// add enum defines -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 ftmp0; -float ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "coordinateSource.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "miNoise.glsllib" -#include "flakeNoiseTexture.glsllib" -#include "directionalFactor.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ) ); - layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.200000, 0.200000, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ) ); - layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, 0.200000, 0.200000 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor ); - layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, 0.200000, 0.200000, scatter_reflect ); - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, sampleDiffuse( layers[1].tanFrame ) * aoFactor ); - layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, 0.200000, 0.200000 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = coordinateSource(texture_coordinate_object, 0 ); - ftmp0 = perlinNoiseBumpTexture( tmp2, ( peel_amount/10.000000 ), ( peel_size*unit_conversion ), false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); - ftmp1 = flakeNoiseTexture(tmp2, 0.000000, ( unit_conversion*0.002000 ), 0.350000 ).mono; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( ftmp1, vec4( vec3( 1, 0.117, 0.087 ), 1.0).rgb, layers[1].layer, layers[1].base * vec4( vec3( 1, 1, 1 ), 1.0), alpha ); - color = fresnelLayer( ftmp0, vec3( 1.5, 1.5, 1.5 ), 1.000000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp0, tangent), ftmp0 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/carpaint_blue_standard.shader b/Studio/Content/Material Library/carpaint_blue_standard.shader new file mode 100644 index 00000000..5fed8438 --- /dev/null +++ b/Studio/Content/Material Library/carpaint_blue_standard.shader @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 ftmp0; +float ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "miNoise.glsllib" +#include "flakeNoiseTexture.glsllib" +#include "directionalFactor.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ) ); + layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.200000, 0.200000, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ) ); + layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, 0.200000, 0.200000 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor ); + layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, 0.200000, 0.200000, scatter_reflect ); + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, sampleDiffuse( layers[1].tanFrame ) * aoFactor ); + layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, 0.200000, 0.200000 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = coordinateSource(texture_coordinate_object, 0 ); + ftmp0 = perlinNoiseBumpTexture( tmp2, ( peel_amount/10.000000 ), ( peel_size*unit_conversion ), false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); + ftmp1 = flakeNoiseTexture(tmp2, 0.000000, ( unit_conversion*0.002000 ), 0.350000 ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp1, vec4( vec3( 1, 0.117, 0.087 ), 1.0).rgb, layers[1].layer, layers[1].base * vec4( vec3( 1, 1, 1 ), 1.0), alpha ); + color = fresnelLayer( ftmp0, vec3( 1.5, 1.5, 1.5 ), 1.000000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp0, tangent), ftmp0 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/carpaint_color_peel_2_layer.material b/Studio/Content/Material Library/carpaint_color_peel_2_layer.material deleted file mode 100644 index 2db1bf52..00000000 --- a/Studio/Content/Material Library/carpaint_color_peel_2_layer.material +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - -// add enum defines -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 ftmp0; -vec3 ftmp1; -float ftmp2; -float ftmp3; - vec4 tmpShadowTerm; - -layer_result layers[3]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "coordinateSource.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "miNoise.glsllib" -#include "flakeNoiseBumpTexture.glsllib" -#include "flakeNoiseTexture.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, coat_roughness, coat_roughness, scatter_reflect ); - - layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, flake_roughness, flake_roughness, scatter_reflect ); - - layers[2].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - layers[2].layer += tmpShadowTerm * microfacetBSDF( layers[2].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.300000, 0.300000, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, coat_roughness, coat_roughness ); - - layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, flake_roughness, flake_roughness ); - - layers[2].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx ); - layers[2].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[2].tanFrame, varWorldPos, lightIdx, viewDir, 0.300000, 0.300000 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness, scatter_reflect ); - - layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, flake_roughness, flake_roughness, scatter_reflect ); - - layers[2].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - layers[2].layer += tmpShadowTerm * microfacetSampledBSDF( layers[2].tanFrame, viewDir, 0.300000, 0.300000, scatter_reflect ); - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness ); - - layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, flake_roughness, flake_roughness ); - - layers[2].base += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor; - layers[2].layer += tmpShadowTerm * sampleGlossyAniso( layers[2].tanFrame, viewDir, 0.300000, 0.300000 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = coordinateSource(texture_coordinate_object, 0 ); - ftmp0 = perlinNoiseBumpTexture( tmp2, peel_amount, peel_size, false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); - ftmp1 = flakeNoiseBumpTexture(tmp2, flake_size, flake_bumpiness, normal ); - ftmp2 = flakeNoiseTexture(tmp2, flake_intensity, flake_size, flake_amount ).mono; - ftmp3 = flakeNoiseTexture(tmp2, 0.000000, 0.002200, 1.000000 ).mono; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( ftmp3, vec4( vec3( 1, 0.01, 0.01 ), 1.0).rgb, layers[2].layer, layers[2].base * vec4( base_color, 1.0), alpha ); - color = weightedLayer( ftmp2, vec4( flake_color, 1.0).rgb, layers[1].layer, color, color.a ); - color = fresnelLayer( ftmp0, vec3( coating_ior ), coat_weight, vec4( coat_color, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp0, tangent), ftmp0 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp1, tangent), ftmp1 ) ); - layers[2].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[2].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[2].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/carpaint_color_peel_2_layer.shader b/Studio/Content/Material Library/carpaint_color_peel_2_layer.shader new file mode 100644 index 00000000..2db1bf52 --- /dev/null +++ b/Studio/Content/Material Library/carpaint_color_peel_2_layer.shader @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 ftmp0; +vec3 ftmp1; +float ftmp2; +float ftmp3; + vec4 tmpShadowTerm; + +layer_result layers[3]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "miNoise.glsllib" +#include "flakeNoiseBumpTexture.glsllib" +#include "flakeNoiseTexture.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, coat_roughness, coat_roughness, scatter_reflect ); + + layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, flake_roughness, flake_roughness, scatter_reflect ); + + layers[2].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + layers[2].layer += tmpShadowTerm * microfacetBSDF( layers[2].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.300000, 0.300000, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, coat_roughness, coat_roughness ); + + layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, flake_roughness, flake_roughness ); + + layers[2].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx ); + layers[2].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[2].tanFrame, varWorldPos, lightIdx, viewDir, 0.300000, 0.300000 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness, scatter_reflect ); + + layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, flake_roughness, flake_roughness, scatter_reflect ); + + layers[2].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + layers[2].layer += tmpShadowTerm * microfacetSampledBSDF( layers[2].tanFrame, viewDir, 0.300000, 0.300000, scatter_reflect ); + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, coat_roughness, coat_roughness ); + + layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, flake_roughness, flake_roughness ); + + layers[2].base += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor; + layers[2].layer += tmpShadowTerm * sampleGlossyAniso( layers[2].tanFrame, viewDir, 0.300000, 0.300000 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = coordinateSource(texture_coordinate_object, 0 ); + ftmp0 = perlinNoiseBumpTexture( tmp2, peel_amount, peel_size, false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); + ftmp1 = flakeNoiseBumpTexture(tmp2, flake_size, flake_bumpiness, normal ); + ftmp2 = flakeNoiseTexture(tmp2, flake_intensity, flake_size, flake_amount ).mono; + ftmp3 = flakeNoiseTexture(tmp2, 0.000000, 0.002200, 1.000000 ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp3, vec4( vec3( 1, 0.01, 0.01 ), 1.0).rgb, layers[2].layer, layers[2].base * vec4( base_color, 1.0), alpha ); + color = weightedLayer( ftmp2, vec4( flake_color, 1.0).rgb, layers[1].layer, color, color.a ); + color = fresnelLayer( ftmp0, vec3( coating_ior ), coat_weight, vec4( coat_color, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp0, tangent), ftmp0 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp1, tangent), ftmp1 ) ); + layers[2].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[2].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[2].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/carpaint_yellow_standard.material b/Studio/Content/Material Library/carpaint_yellow_standard.material deleted file mode 100644 index 52d32e8b..00000000 --- a/Studio/Content/Material Library/carpaint_yellow_standard.material +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - -// add enum defines -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 ftmp0; -float ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "coordinateSource.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "miNoise.glsllib" -#include "flakeNoiseTexture.glsllib" -#include "directionalFactor.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ) ); - layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.200000, 0.200000, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ) ); - layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, 0.200000, 0.200000 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor ); - layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, 0.200000, 0.200000, scatter_reflect ); - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); - - layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, sampleDiffuse( layers[1].tanFrame ) * aoFactor ); - layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, 0.200000, 0.200000 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = coordinateSource(texture_coordinate_object, 0 ); - ftmp0 = perlinNoiseBumpTexture( tmp2, ( peel_amount/10.000000 ), ( peel_size*unit_conversion ), false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); - ftmp1 = flakeNoiseTexture(tmp2, 0.000000, ( unit_conversion*0.002000 ), 0.350000 ).mono; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( ftmp1, vec4( vec3( 1, 0.117, 0.087 ), 1.0).rgb, layers[1].layer, layers[1].base * vec4( vec3( 1, 1, 1 ), 1.0), alpha ); - color = fresnelLayer( ftmp0, vec3( 1.5, 1.5, 1.5 ), 1.000000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp0, tangent), ftmp0 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/carpaint_yellow_standard.shader b/Studio/Content/Material Library/carpaint_yellow_standard.shader new file mode 100644 index 00000000..52d32e8b --- /dev/null +++ b/Studio/Content/Material Library/carpaint_yellow_standard.shader @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 ftmp0; +float ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "miNoise.glsllib" +#include "flakeNoiseTexture.glsllib" +#include "directionalFactor.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ) ); + layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.200000, 0.200000, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ) ); + layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, 0.200000, 0.200000 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor ); + layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, 0.200000, 0.200000, scatter_reflect ); + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color, grazing_base_color, 5.000000, sampleDiffuse( layers[1].tanFrame ) * aoFactor ); + layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, 0.200000, 0.200000 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = coordinateSource(texture_coordinate_object, 0 ); + ftmp0 = perlinNoiseBumpTexture( tmp2, ( peel_amount/10.000000 ), ( peel_size*unit_conversion ), false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); + ftmp1 = flakeNoiseTexture(tmp2, 0.000000, ( unit_conversion*0.002000 ), 0.350000 ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp1, vec4( vec3( 1, 0.117, 0.087 ), 1.0).rgb, layers[1].layer, layers[1].base * vec4( vec3( 1, 1, 1 ), 1.0), alpha ); + color = fresnelLayer( ftmp0, vec3( 1.5, 1.5, 1.5 ), 1.000000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(ftmp0, tangent), ftmp0 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/concrete.material b/Studio/Content/Material Library/concrete.material deleted file mode 100644 index 1bcdadcd..00000000 --- a/Studio/Content/Material Library/concrete.material +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -vec3 tmp6; -vec3 ftmp0; -vec3 ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fileTexture.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = fileTexture(bump_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp6, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/concrete.shader b/Studio/Content/Material Library/concrete.shader new file mode 100644 index 00000000..1bcdadcd --- /dev/null +++ b/Studio/Content/Material Library/concrete.shader @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +vec3 tmp6; +vec3 ftmp0; +vec3 ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fileTexture.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = fileTexture(bump_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp6, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/copper.material b/Studio/Content/Material Library/copper.material deleted file mode 100644 index 5f407def..00000000 --- a/Studio/Content/Material Library/copper.material +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( 25.65, 25.65, 25.65 ), 1.000000, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/copper.shader b/Studio/Content/Material Library/copper.shader new file mode 100644 index 00000000..5f407def --- /dev/null +++ b/Studio/Content/Material Library/copper.shader @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( 25.65, 25.65, 25.65 ), 1.000000, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/leather_smoothed_black.material b/Studio/Content/Material Library/leather_smoothed_black.material deleted file mode 100644 index 8d456694..00000000 --- a/Studio/Content/Material Library/leather_smoothed_black.material +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 tmp5; -vec3 ftmp0; -vec3 ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fileTexture.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/leather_smoothed_black.shader b/Studio/Content/Material Library/leather_smoothed_black.shader new file mode 100644 index 00000000..8d456694 --- /dev/null +++ b/Studio/Content/Material Library/leather_smoothed_black.shader @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 tmp5; +vec3 ftmp0; +vec3 ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fileTexture.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/mesh_fence.material b/Studio/Content/Material Library/mesh_fence.material deleted file mode 100644 index df5d8170..00000000 --- a/Studio/Content/Material Library/mesh_fence.material +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -texture_return tmp4; -vec3 tmp5; -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "tangentSpaceNormalTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( tmp4.mono ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ); - tmp5 = tangentSpaceNormalTexture( bump_texture, bump_amount, false, false, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat ); - ftmp0 = tmp4.tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp0, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp5, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/mesh_fence.shader b/Studio/Content/Material Library/mesh_fence.shader new file mode 100644 index 00000000..df5d8170 --- /dev/null +++ b/Studio/Content/Material Library/mesh_fence.shader @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +texture_return tmp4; +vec3 tmp5; +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "tangentSpaceNormalTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( tmp4.mono ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ); + tmp5 = tangentSpaceNormalTexture( bump_texture, bump_amount, false, false, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat ); + ftmp0 = tmp4.tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp0, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp5, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/metal_mesh_fine.material b/Studio/Content/Material Library/metal_mesh_fine.material deleted file mode 100644 index f4e2d9fe..00000000 --- a/Studio/Content/Material Library/metal_mesh_fine.material +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 tmp4; -vec3 tmp6; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "fileBumpTexture.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( fileTexture(cutout_opacity_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( tmp4, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp6, vec3( material_ior ), 1.000000, vec4( tmp4, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/metal_mesh_fine.shader b/Studio/Content/Material Library/metal_mesh_fine.shader new file mode 100644 index 00000000..f4e2d9fe --- /dev/null +++ b/Studio/Content/Material Library/metal_mesh_fine.shader @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 tmp4; +vec3 tmp6; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "fileBumpTexture.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( fileTexture(cutout_opacity_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmp6 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( tmp4, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp6, vec3( material_ior ), 1.000000, vec4( tmp4, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp6, tangent), tmp6 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/paper_artistic.material b/Studio/Content/Material Library/paper_artistic.material deleted file mode 100644 index 6c7b0755..00000000 --- a/Studio/Content/Material Library/paper_artistic.material +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define color_layer_blend 0 -#define color_layer_add 1 -#define color_layer_multiply 2 -#define color_layer_screen 3 -#define color_layer_overlay 4 -#define color_layer_brightness 5 -#define color_layer_color 6 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct bsdf_component -{ - float weight; - vec4 component; -}; - - -struct color_layer -{ - vec3 layer_color; - float weight; - int mode; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -texture_coordinate_info tmp1; -vec3 tmp2; -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "tangentSpaceNormalTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "normalizedMix.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "diffuseTransmissionBSDF.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileTexture.glsllib" -#include "blendColorLayers.glsllib" -#include "diffuseReflectionBSDF.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, diffuseTransmissionBSDF( -normal, lightDir, viewDir, lightDiffuse, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 )) ) ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, lightDiffuse * sampleAreaDiffuseTransmissive( layers[0].tanFrame, varWorldPos, lightIdx, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx )) ) ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - -#else - layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; - -#endif -} - -void computeFrontLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) -{ -#if QT3DS_ENABLE_RNM - layers[0].base += tmpShadowTerm * diffuseRNM( normal, rnmX, rnmY, rnmZ ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) -{ -#if QT3DS_ENABLE_RNM - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( tangentSpaceNormalTexture( bump_texture, bump_amount, false, false, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat ) ); -} - -void computeTemporaries() -{ - tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp2 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - ftmp0 = blendColorLayers( color_layer[1]( color_layer(blendColorLayers( color_layer[1]( color_layer(fileTexture(transmission_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint, 1.000000, color_layer_blend ) ), tmp2, mono_average ).tint, 1.000000, color_layer_multiply ) ), vec3( 1, 1, 1 ), mono_average ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = layers[0].base * vec4( tmp2, 1.0); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); -} - -vec4 computeOpacity(in vec4 color) -{ - vec4 rgba = color; - rgba.a = uOpacity * 0.01; - return rgba; -} - - - - - - - - - - - - diff --git a/Studio/Content/Material Library/paper_artistic.shader b/Studio/Content/Material Library/paper_artistic.shader new file mode 100644 index 00000000..6c7b0755 --- /dev/null +++ b/Studio/Content/Material Library/paper_artistic.shader @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define color_layer_blend 0 +#define color_layer_add 1 +#define color_layer_multiply 2 +#define color_layer_screen 3 +#define color_layer_overlay 4 +#define color_layer_brightness 5 +#define color_layer_color 6 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct bsdf_component +{ + float weight; + vec4 component; +}; + + +struct color_layer +{ + vec3 layer_color; + float weight; + int mode; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +texture_coordinate_info tmp1; +vec3 tmp2; +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "tangentSpaceNormalTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "normalizedMix.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "diffuseTransmissionBSDF.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileTexture.glsllib" +#include "blendColorLayers.glsllib" +#include "diffuseReflectionBSDF.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, diffuseTransmissionBSDF( -normal, lightDir, viewDir, lightDiffuse, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 )) ) ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, lightDiffuse * sampleAreaDiffuseTransmissive( layers[0].tanFrame, varWorldPos, lightIdx, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx )) ) ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + +#else + layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; + +#endif +} + +void computeFrontLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) +{ +#if QT3DS_ENABLE_RNM + layers[0].base += tmpShadowTerm * diffuseRNM( normal, rnmX, rnmY, rnmZ ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) +{ +#if QT3DS_ENABLE_RNM + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( tangentSpaceNormalTexture( bump_texture, bump_amount, false, false, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat ) ); +} + +void computeTemporaries() +{ + tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp2 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + ftmp0 = blendColorLayers( color_layer[1]( color_layer(blendColorLayers( color_layer[1]( color_layer(fileTexture(transmission_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint, 1.000000, color_layer_blend ) ), tmp2, mono_average ).tint, 1.000000, color_layer_multiply ) ), vec3( 1, 1, 1 ), mono_average ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = layers[0].base * vec4( tmp2, 1.0); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); +} + +vec4 computeOpacity(in vec4 color) +{ + vec4 rgba = color; + rgba.a = uOpacity * 0.01; + return rgba; +} + + + + + + + + + + + + diff --git a/Studio/Content/Material Library/paper_office.material b/Studio/Content/Material Library/paper_office.material deleted file mode 100644 index 22f60721..00000000 --- a/Studio/Content/Material Library/paper_office.material +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define color_layer_blend 0 -#define color_layer_add 1 -#define color_layer_multiply 2 -#define color_layer_screen 3 -#define color_layer_overlay 4 -#define color_layer_brightness 5 -#define color_layer_color 6 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct bsdf_component -{ - float weight; - vec4 component; -}; - - -struct color_layer -{ - vec3 layer_color; - float weight; - int mode; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -texture_coordinate_info tmp1; -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "normalizedMix.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "diffuseTransmissionBSDF.glsllib" -#include "fileTexture.glsllib" -#include "blendColorLayers.glsllib" -#include "diffuseReflectionBSDF.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, diffuseTransmissionBSDF( -normal, lightDir, viewDir, lightDiffuse, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 )) ) ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, lightDiffuse * sampleAreaDiffuseTransmissive( layers[0].tanFrame, varWorldPos, lightIdx, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx )) ) ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - -#else - layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; - -#endif -} - -void computeFrontLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) -{ -#if QT3DS_ENABLE_RNM - layers[0].base += tmpShadowTerm * diffuseRNM( normal, rnmX, rnmY, rnmZ ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) -{ -#if QT3DS_ENABLE_RNM - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); -} - -void computeTemporaries() -{ - tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - ftmp0 = blendColorLayers( color_layer[1]( color_layer(blendColorLayers( color_layer[1]( color_layer(fileTexture(transmission_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint, 0.700000, color_layer_blend ) ), paper_color, mono_average ).tint, 1.000000, color_layer_multiply ) ), vec3( 1, 1, 1 ), mono_average ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = layers[0].base * vec4( paper_color, 1.0); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); -} - -vec4 computeOpacity(in vec4 color) -{ - vec4 rgba = color; - rgba.a = uOpacity * 0.01; - return rgba; -} - - - - - - - - - - - - diff --git a/Studio/Content/Material Library/paper_office.shader b/Studio/Content/Material Library/paper_office.shader new file mode 100644 index 00000000..22f60721 --- /dev/null +++ b/Studio/Content/Material Library/paper_office.shader @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define color_layer_blend 0 +#define color_layer_add 1 +#define color_layer_multiply 2 +#define color_layer_screen 3 +#define color_layer_overlay 4 +#define color_layer_brightness 5 +#define color_layer_color 6 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct bsdf_component +{ + float weight; + vec4 component; +}; + + +struct color_layer +{ + vec3 layer_color; + float weight; + int mode; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +texture_coordinate_info tmp1; +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "normalizedMix.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "diffuseTransmissionBSDF.glsllib" +#include "fileTexture.glsllib" +#include "blendColorLayers.glsllib" +#include "diffuseReflectionBSDF.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, diffuseTransmissionBSDF( -normal, lightDir, viewDir, lightDiffuse, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 )) ) ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * normalizedMix( bsdf_component[2]( bsdf_component(transmission_weight, lightDiffuse * sampleAreaDiffuseTransmissive( layers[0].tanFrame, varWorldPos, lightIdx, vec4( ftmp0, 1.0), uTranslucentFalloff, uDiffuseLightWrap )) ,bsdf_component(reflection_weight, lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx )) ) ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + +#else + layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; + +#endif +} + +void computeFrontLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) +{ +#if QT3DS_ENABLE_RNM + layers[0].base += tmpShadowTerm * diffuseRNM( normal, rnmX, rnmY, rnmZ ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) +{ +#if QT3DS_ENABLE_RNM + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( fileBumpTexture(bump_texture, bump_amount, mono_average, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); +} + +void computeTemporaries() +{ + tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + ftmp0 = blendColorLayers( color_layer[1]( color_layer(blendColorLayers( color_layer[1]( color_layer(fileTexture(transmission_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp1, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint, 0.700000, color_layer_blend ) ), paper_color, mono_average ).tint, 1.000000, color_layer_multiply ) ), vec3( 1, 1, 1 ), mono_average ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = layers[0].base * vec4( paper_color, 1.0); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); +} + +vec4 computeOpacity(in vec4 color) +{ + vec4 rgba = color; + rgba.a = uOpacity * 0.01; + return rgba; +} + + + + + + + + + + + + diff --git a/Studio/Content/Material Library/plastic_structured_red.material b/Studio/Content/Material Library/plastic_structured_red.material deleted file mode 100644 index f9be9ec3..00000000 --- a/Studio/Content/Material Library/plastic_structured_red.material +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - -// add enum defines -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "coordinateSource.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( perlinNoiseBumpTexture( transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( ( texture_scaling*10.000000 ) ) ), coordinateSource(texture_coordinate_object, 0 ) ), bump_factor, 1.000000, false, false, 0.000000, 6, true, vec3( 0.000000, 0.000000, 0.000000 ), 0.070000, 0.300000, 1.000000, normal ) ); -} - -void computeTemporaries() -{ - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( material_ior ), 0.350000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, layers[0].base * vec4( diffuse_color, 1.0), alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/plastic_structured_red.shader b/Studio/Content/Material Library/plastic_structured_red.shader new file mode 100644 index 00000000..f9be9ec3 --- /dev/null +++ b/Studio/Content/Material Library/plastic_structured_red.shader @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( perlinNoiseBumpTexture( transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( ( texture_scaling*10.000000 ) ) ), coordinateSource(texture_coordinate_object, 0 ) ), bump_factor, 1.000000, false, false, 0.000000, 6, true, vec3( 0.000000, 0.000000, 0.000000 ), 0.070000, 0.300000, 1.000000, normal ) ); +} + +void computeTemporaries() +{ + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( material_ior ), 0.350000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, layers[0].base * vec4( diffuse_color, 1.0), alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/plastic_structured_red_emissive.material b/Studio/Content/Material Library/plastic_structured_red_emissive.material deleted file mode 100644 index 9e834df2..00000000 --- a/Studio/Content/Material Library/plastic_structured_red_emissive.material +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - -// add enum defines -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "coordinateSource.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" -#include "monoChannel.glsllib" -#include "fileTexture.glsllib" -#include "textureCoordinateInfo.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( perlinNoiseBumpTexture( transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( ( texture_scaling*10.000000 ) ) ), coordinateSource(texture_coordinate_object, 0 ) ), bump_factor, 1.000000, false, false, 0.000000, 6, true, vec3( 0.000000, 0.000000, 0.000000 ), 0.070000, 0.300000, 1.000000, normal ) ); -} - -void computeTemporaries() -{ - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( material_ior ), 0.350000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, layers[0].base * vec4( diffuse_color, 1.0), alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/plastic_structured_red_emissive.shader b/Studio/Content/Material Library/plastic_structured_red_emissive.shader new file mode 100644 index 00000000..9e834df2 --- /dev/null +++ b/Studio/Content/Material Library/plastic_structured_red_emissive.shader @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" +#include "monoChannel.glsllib" +#include "fileTexture.glsllib" +#include "textureCoordinateInfo.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( perlinNoiseBumpTexture( transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( ( texture_scaling*10.000000 ) ) ), coordinateSource(texture_coordinate_object, 0 ) ), bump_factor, 1.000000, false, false, 0.000000, 6, true, vec3( 0.000000, 0.000000, 0.000000 ), 0.070000, 0.300000, 1.000000, normal ) ); +} + +void computeTemporaries() +{ + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( material_ior ), 0.350000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, layers[0].base * vec4( diffuse_color, 1.0), alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/porcelain.material b/Studio/Content/Material Library/porcelain.material deleted file mode 100644 index b21cda76..00000000 --- a/Studio/Content/Material Library/porcelain.material +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, layers[0].base * vec4( porcelain_color, 1.0), alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/porcelain.shader b/Studio/Content/Material Library/porcelain.shader new file mode 100644 index 00000000..b21cda76 --- /dev/null +++ b/Studio/Content/Material Library/porcelain.shader @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, layers[0].base * vec4( porcelain_color, 1.0), alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/powder_coat.material b/Studio/Content/Material Library/powder_coat.material deleted file mode 100644 index e5c55ae5..00000000 --- a/Studio/Content/Material Library/powder_coat.material +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( fileBumpTexture(powdercoat_bump_texture, bump_factor, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), texture_scaling ), textureCoordinateInfo( texCoord0, tangent, binormal ) ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); -} - -void computeTemporaries() -{ - ftmp0 = vec3( reflectivity ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( diffuse_weight, vec4( powdercoat_diffuse_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( normal, vec3( material_ior ), glossy_weight, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/powder_coat.shader b/Studio/Content/Material Library/powder_coat.shader new file mode 100644 index 00000000..e5c55ae5 --- /dev/null +++ b/Studio/Content/Material Library/powder_coat.shader @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( fileBumpTexture(powdercoat_bump_texture, bump_factor, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), texture_scaling ), textureCoordinateInfo( texCoord0, tangent, binormal ) ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); +} + +void computeTemporaries() +{ + ftmp0 = vec3( reflectivity ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( diffuse_weight, vec4( powdercoat_diffuse_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( normal, vec3( material_ior ), glossy_weight, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/powder_coat_emissive.material b/Studio/Content/Material Library/powder_coat_emissive.material deleted file mode 100644 index 4470c960..00000000 --- a/Studio/Content/Material Library/powder_coat_emissive.material +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" -#include "fileTexture.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( ( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*emission_color )*intensity ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -void computeFrontLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) -{ -#if QT3DS_ENABLE_RNM - layers[0].layer += tmpShadowTerm * glossyRNM( normal, rnmX, rnmY, rnmZ ); - - layers[1].layer += tmpShadowTerm * diffuseRNM( normal, rnmX, rnmY, rnmZ ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) -{ -#if QT3DS_ENABLE_RNM - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( fileBumpTexture(powdercoat_bump_texture, bump_factor, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), texture_scaling ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); -} - -void computeTemporaries() -{ - tmp3 = textureCoordinateInfo( texCoord0, tangent, binormal ); - ftmp0 = vec3( reflectivity ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( diffuse_weight, vec4( powdercoat_diffuse_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( normal, vec3( material_ior ), glossy_weight, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/powder_coat_emissive.shader b/Studio/Content/Material Library/powder_coat_emissive.shader new file mode 100644 index 00000000..4470c960 --- /dev/null +++ b/Studio/Content/Material Library/powder_coat_emissive.shader @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" +#include "fileTexture.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( ( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*emission_color )*intensity ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +void computeFrontLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) +{ +#if QT3DS_ENABLE_RNM + layers[0].layer += tmpShadowTerm * glossyRNM( normal, rnmX, rnmY, rnmZ ); + + layers[1].layer += tmpShadowTerm * diffuseRNM( normal, rnmX, rnmY, rnmZ ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in vec3 rnmZ ) +{ +#if QT3DS_ENABLE_RNM + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( fileBumpTexture(powdercoat_bump_texture, bump_factor, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), texture_scaling ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ) ); +} + +void computeTemporaries() +{ + tmp3 = textureCoordinateInfo( texCoord0, tangent, binormal ); + ftmp0 = vec3( reflectivity ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( diffuse_weight, vec4( powdercoat_diffuse_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( normal, vec3( material_ior ), glossy_weight, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/rubber_studded_black.material b/Studio/Content/Material Library/rubber_studded_black.material deleted file mode 100644 index b6173812..00000000 --- a/Studio/Content/Material Library/rubber_studded_black.material +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -// temporary declarations -vec3 tmp4; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp4, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp4, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp4 = fileBumpTexture(bump_texture, bump_amount, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( base_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp4, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp4, tangent), tmp4 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp4, tangent), tmp4 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/rubber_studded_black.shader b/Studio/Content/Material Library/rubber_studded_black.shader new file mode 100644 index 00000000..b6173812 --- /dev/null +++ b/Studio/Content/Material Library/rubber_studded_black.shader @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +// temporary declarations +vec3 tmp4; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp4, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp4, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp4 = fileBumpTexture(bump_texture, bump_amount, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( base_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp4, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp4, tangent), tmp4 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp4, tangent), tmp4 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/rubber_studded_emissive.material b/Studio/Content/Material Library/rubber_studded_emissive.material deleted file mode 100644 index ff4526ae..00000000 --- a/Studio/Content/Material Library/rubber_studded_emissive.material +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -vec3 tmp5; -texture_coordinate_info tmp6; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" -#include "fileTexture.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp6, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*fileTexture(emissive_mask_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp6, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = textureCoordinateInfo( texCoord0, tangent, binormal ); - tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - tmp6 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp3 ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( base_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp5, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/rubber_studded_emissive.shader b/Studio/Content/Material Library/rubber_studded_emissive.shader new file mode 100644 index 00000000..ff4526ae --- /dev/null +++ b/Studio/Content/Material Library/rubber_studded_emissive.shader @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +vec3 tmp5; +texture_coordinate_info tmp6; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" +#include "fileTexture.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 1.0, 1.0, 1.0) * vec3( vec3( ( intensity*( emission_color*( fileTexture(emissive_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp6, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint*fileTexture(emissive_mask_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_alpha, tmp6, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_default ).tint ) ) ) ) ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = textureCoordinateInfo( texCoord0, tangent, binormal ); + tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), tmp3 ), vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + tmp6 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( 1.000000, 1.000000, 1.000000 ) ), tmp3 ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( base_color, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp5, vec3( material_ior ), glossy_weight, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/simple_glass.material b/Studio/Content/Material Library/simple_glass.material deleted file mode 100644 index bf3b75c6..00000000 --- a/Studio/Content/Material Library/simple_glass.material +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "abbeNumberIOR.glsllib" -#include "fresnelLayer.glsllib" -#include "refraction.glsllib" - -bool evalTwoSided() -{ - return( true ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect_transmit ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect_transmit ); - -#else - layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( true ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - ftmp0 = vec3( reflectivity_amount ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = layers[0].base * vec4( ftmp0, 1.0); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); -} - -vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) -{ - vec4 rgba = color; - float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); - vec3 absorb_color = ( log( glass_color )/-1.000000 ); - // prevent log(0) -> inf number issue - if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; - if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; - if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; - rgba.rgb = mix(vec3(1.0) - absorb_color, rgba.rgb * (vec3(1.0) - absorb_color), ratio); - rgba.a = mix(uMinOpacity, alpha, ratio); - return rgba; -} - - - - - - - - - - - - - diff --git a/Studio/Content/Material Library/simple_glass.shader b/Studio/Content/Material Library/simple_glass.shader new file mode 100644 index 00000000..bf3b75c6 --- /dev/null +++ b/Studio/Content/Material Library/simple_glass.shader @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "abbeNumberIOR.glsllib" +#include "fresnelLayer.glsllib" +#include "refraction.glsllib" + +bool evalTwoSided() +{ + return( true ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect_transmit ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect_transmit ); + +#else + layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( true ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + ftmp0 = vec3( reflectivity_amount ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = layers[0].base * vec4( ftmp0, 1.0); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); +} + +vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) +{ + vec4 rgba = color; + float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); + vec3 absorb_color = ( log( glass_color )/-1.000000 ); + // prevent log(0) -> inf number issue + if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; + if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; + if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; + rgba.rgb = mix(vec3(1.0) - absorb_color, rgba.rgb * (vec3(1.0) - absorb_color), ratio); + rgba.a = mix(uMinOpacity, alpha, ratio); + return rgba; +} + + + + + + + + + + + + + diff --git a/Studio/Content/Material Library/steel_milled_concentric.material b/Studio/Content/Material Library/steel_milled_concentric.material deleted file mode 100644 index 3cf95851..00000000 --- a/Studio/Content/Material Library/steel_milled_concentric.material +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct anisotropy_return -{ - float roughness_u; - float roughness_v; - vec3 tangent_u; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp3; -texture_return tmp4; -anisotropy_return tmp5; -float ftmp0; -float ftmp1; -vec3 ftmp2; -vec3 ftmp3; -vec3 ftmp4; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "monoChannel.glsllib" -#include "fileTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "anisotropyConversion.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); - -#else - layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ); - tmp5 = anisotropyConversion( tmp4.mono, anisotropy, fileTexture(anisotropy_rot_texture, vec3( -1, -1, -1 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, tangent, false ); - ftmp0 = tmp5.roughness_u; - ftmp1 = tmp5.roughness_v; - ftmp2 = fileTexture(diffuse_texture, vec3( 1, 1, 1 ), vec3( -1, -1, -1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp3 = tmp5.tangent_u; - ftmp4 = tmp4.tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = fresnelLayer( normal, vec3( material_ior ), 1.000000, vec4( ftmp2, 1.0).rgb, layers[0].layer, layers[0].base * vec4( ftmp4, 1.0), alpha ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( ftmp3, cross(normal, ftmp3), normal ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/steel_milled_concentric.shader b/Studio/Content/Material Library/steel_milled_concentric.shader new file mode 100644 index 00000000..3cf95851 --- /dev/null +++ b/Studio/Content/Material Library/steel_milled_concentric.shader @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct anisotropy_return +{ + float roughness_u; + float roughness_v; + vec3 tangent_u; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp3; +texture_return tmp4; +anisotropy_return tmp5; +float ftmp0; +float ftmp1; +vec3 ftmp2; +vec3 ftmp3; +vec3 ftmp4; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "monoChannel.glsllib" +#include "fileTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "anisotropyConversion.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ); + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[0].tanFrame, varWorldPos, lightIdx ); + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor; + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect ); + +#else + layers[0].base += tmpShadowTerm * sampleDiffuse( layers[0].tanFrame ) * aoFactor; + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp3 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp4 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ); + tmp5 = anisotropyConversion( tmp4.mono, anisotropy, fileTexture(anisotropy_rot_texture, vec3( -1, -1, -1 ), vec3( 1, 1, 1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).mono, tangent, false ); + ftmp0 = tmp5.roughness_u; + ftmp1 = tmp5.roughness_v; + ftmp2 = fileTexture(diffuse_texture, vec3( 1, 1, 1 ), vec3( -1, -1, -1 ), mono_luminance, tmp3, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp3 = tmp5.tangent_u; + ftmp4 = tmp4.tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = fresnelLayer( normal, vec3( material_ior ), 1.000000, vec4( ftmp2, 1.0).rgb, layers[0].layer, layers[0].base * vec4( ftmp4, 1.0), alpha ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( ftmp3, cross(normal, ftmp3), normal ) ); +} + + + + + + + + + + + diff --git a/Studio/Content/Material Library/thin_glass_frosted.material b/Studio/Content/Material Library/thin_glass_frosted.material deleted file mode 100644 index d1719431..00000000 --- a/Studio/Content/Material Library/thin_glass_frosted.material +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - -struct texture_return -{ - vec3 tint; - float mono; -}; - -// temporary declarations -texture_coordinate_info tmp0; -texture_coordinate_info tmp1; -vec3 ftmp0; -vec3 ftmp1; -vec3 ftmp2; -vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "coordinateSource.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "abbeNumberIOR.glsllib" -#include "average.glsllib" -#include "perlinNoiseTexture.glsllib" -#include "fresnelLayer.glsllib" -#include "refraction.glsllib" - -uniform sampler2D refractiveTexture; - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect_transmit ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect_transmit ); - -#else - layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - if ( glass_bfactor > 0.0 ) - { - ftmp2 = fileBumpTexture(glass_bump, glass_bfactor, mono_average, tmp0, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - if (!glass_binside) { normal = ftmp2; } - } - - return( perlinNoiseBumpTexture( tmp1, bumpScale, 1.000000, false, false, 0.000000, bumpBands, false, vec3( 0.000000, 0.000000, 0.000000 ), 0.5, 0.0, 1.000000, normal ) ); -} - -void computeTemporaries() -{ - //tmp0 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), refractCoords ), coordinateSource(texture_coordinate_world, 0 ) ); - //ftmp1 = perlinNoiseBumpTexture( tmp0, refractScale, 1.000000, false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.0, 0.5, 1.000000, viewDir ); - tmp0 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), bumpCoords ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), bumpCoords ), coordinateSource(texture_coordinate_world, 0 ) ); - ftmp1 = viewDir; - ftmp0 = vec3( reflectivity_amount ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = layers[0].base * vec4( ftmp0, 1.0); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); -} - -vec3 getRefractUV( in vec2 baseUV, in vec3 normal, in float materialIOR, in float refractDepth ) -{ - // Real honest-to-goodness refraction! - vec3 refractedDir = refract( -viewDir, normal, 1.0 / materialIOR ); - float thickness = refractDepth / clamp( dot(viewDir, normal), 0.0001, 1.0 ); - - // This will do an "AA" version of that loss due to critical angle and TIR - // fakes the same effect than using the glsl refract. - float weight = smoothstep( 0.0, 1.0, abs(dot(viewDir, normal)) * 100.0 ); - - // Trace out the refracted ray and the straight view ray - refractedDir *= thickness; - vec3 rawDir = -viewDir * thickness; - - vec3 displace = refractedDir - rawDir; - vec3 newUV = vec3(baseUV + displace.xy, weight); - return newUV; -} - -vec4 doFakeInnerLight( in vec3 normal, in vec3 absorb_color ) -{ - vec3 lightColor = intLightCol * intLightBrt; - - float cosRot = cos(intLightRot * 0.01745329251); - float sinRot = sin(intLightRot * 0.01745329251); - vec2 uvDir = vec2(sinRot, cosRot); - - vec2 dvec = texCoord0.xy - intLightPos; - float dist = dot( dvec, uvDir ); - float fallRate = log2( max( abs(intLightFall), 1.01 ) ); - vec3 fallCol = exp2( -abs(dist) * fallRate / absorb_color ); - - vec3 projDir = (tangent * uvDir.x + binormal * uvDir.y) * dist * intLightFall - surfNormal * refract_depth; - projDir = normalize(projDir); - - vec4 retVal = vec4(lightColor * fallCol, 1.0); - retVal *= abs(dot( projDir, -ftmp2 )); - retVal.a = pow( retVal.a, uFresnelPower ); - retVal.a *= clamp( intLightBrt * exp2(-dist * fallRate), 0.0, 1.0 ); - - return retVal; -} - -vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) -{ - vec4 rgba = color; - float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); - vec3 absorb_color = ( log( glass_color ) * -1.000000 ); - // prevent log(0) -> inf number issue - if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; - if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; - if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; - rgba.rgb *= (vec3(1.0) - absorb_color); - - vec2 texSize = vec2( textureSize( refractiveTexture, 0 ) ); - vec3 newUV = vec3((gl_FragCoord.xy * 0.5) / texSize, 0.0); - vec4 value = texture( refractiveTexture, newUV.xy ); - - newUV = getRefractUV( newUV.xy, normal, materialIOR, 0.01 * refract_depth ); - vec4 refractValue = texture( refractiveTexture, newUV.xy ); - - vec3 refractColor = refractValue.a * refractValue.rgb + (1.0 - refractValue.a) * value.rgb; - refractColor = refractColor * (vec3(1.0) - absorb_color); - vec4 internalColor = doFakeInnerLight( normal, glass_color ); - refractColor += internalColor.rgb * internalColor.a; - - rgba = vec4(mix(refractColor, rgba.rgb, ratio), 1.0); - return rgba; -} - - - - - - - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 - -vec3 texCoord0; - -void main() -{ - - // This is a bit silly, but the thing is that a buffer blit takes place on this - // pass, and if you do a buffer blit on a pass that outputs to lower-resolution, - // it only blits a smaller portion of the backbuffer that occupies that number of - // pixels. So we need a dummy no-op pass that is full-res in order to blit everything. - - - - - - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 - -vec3 texCoord0; - -uniform sampler2D OriginBuffer; - -void main() -{ - vec2 texSize = vec2( textureSize( OriginBuffer, 0 ) ); - texSize = vec2(1.0) / texSize; - texCoord0.z = 0.0; - texCoord0.xy = vec2(gl_FragCoord.xy * 2.0 * texSize); - - float wtSum = 0.0; - vec4 totSum = vec4(0.0); - for (int ix = -1; ix <= 1; ++ix) - { - for (int iy = -1; iy <= 1; ++iy) - { - float wt = float(ix*ix + iy*iy) * 4.0; - wt = exp2( -wt ); - vec2 texOfs = vec2(ix, iy) * texSize; - totSum += wt * texture( OriginBuffer, texCoord0.xy + texOfs ); - wtSum += wt; - } - } - - totSum /= wtSum; - gl_FragColor = totSum; - // No close paren because the generator adds it for us. - - - - - - - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 - -vec3 texCoord0; - -uniform sampler2D BlurBuffer; - -void main() -{ - vec2 texSize = vec2( textureSize( BlurBuffer, 0 ) ); - texSize = vec2(1.0) / texSize; - texCoord0.z = 0.0; - texCoord0.xy = vec2(gl_FragCoord.xy * texSize); - - float sigma = clamp(blur_size * 0.5, 0.5, 100.0); - int smpCount = int(ceil( sigma )); - vec4 value = texture(BlurBuffer, texCoord0.xy); - float wtsum = 1.0; - for (int i = 1; i <= smpCount; ++i) - { - // Base 2 Gaussian blur - float wt = float(i) / (sigma * 0.5); - wt = exp2( -wt*wt ); - vec2 texOfs = vec2(i, 0) * texSize; - value += wt * texture(BlurBuffer, texCoord0.xy+texOfs); - value += wt * texture(BlurBuffer, texCoord0.xy-texOfs); - wtsum += wt * 2.0; - } - - gl_FragColor = value / wtsum; - gl_FragColor.a = 1.0; - - // No close paren because the generator adds it for us. - - - - - - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 - -vec3 texCoord0; - -uniform sampler2D BlurBuffer; -uniform sampler2D OriginBuffer; - -void main() -{ - vec2 texSize = vec2( textureSize( BlurBuffer, 0 ) ); - texSize = vec2(1.0) / texSize; - texCoord0.z = 0.0; - texCoord0.xy = vec2(gl_FragCoord.xy * texSize); - - float sigma = clamp(blur_size * 0.5, 0.5, 100.0); - int smpCount = int(ceil( sigma )); - vec4 value = texture(BlurBuffer, texCoord0.xy); - - float wtsum = 1.0; - for (int i = 1; i <= smpCount; ++i) - { - // Base 2 Gaussian blur - float wt = float(i) / (sigma * 0.5); - wt = exp2( -wt*wt ); - vec2 texOfs = vec2(0, i) * texSize; - vec4 posValue = texture(BlurBuffer, texCoord0.xy+texOfs); - vec4 negValue = texture(BlurBuffer, texCoord0.xy-texOfs); - posValue = posValue.a * posValue + (1.0 - posValue.a) * texture(OriginBuffer, texCoord0.xy+texOfs); - negValue = negValue.a * negValue + (1.0 - negValue.a) * texture(OriginBuffer, texCoord0.xy-texOfs); - - value += wt * posValue; - value += wt * negValue; - wtsum += wt * 2.0; - } - - gl_FragColor = (value / wtsum); - gl_FragColor.a = 1.0; - - // No close paren because the generator adds it for us. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Studio/Content/Material Library/thin_glass_frosted.shader b/Studio/Content/Material Library/thin_glass_frosted.shader new file mode 100644 index 00000000..d1719431 --- /dev/null +++ b/Studio/Content/Material Library/thin_glass_frosted.shader @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + +struct texture_return +{ + vec3 tint; + float mono; +}; + +// temporary declarations +texture_coordinate_info tmp0; +texture_coordinate_info tmp1; +vec3 ftmp0; +vec3 ftmp1; +vec3 ftmp2; +vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "coordinateSource.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "abbeNumberIOR.glsllib" +#include "average.glsllib" +#include "perlinNoiseTexture.glsllib" +#include "fresnelLayer.glsllib" +#include "refraction.glsllib" + +uniform sampler2D refractiveTexture; + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect_transmit ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect_transmit ); + +#else + layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + if ( glass_bfactor > 0.0 ) + { + ftmp2 = fileBumpTexture(glass_bump, glass_bfactor, mono_average, tmp0, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + if (!glass_binside) { normal = ftmp2; } + } + + return( perlinNoiseBumpTexture( tmp1, bumpScale, 1.000000, false, false, 0.000000, bumpBands, false, vec3( 0.000000, 0.000000, 0.000000 ), 0.5, 0.0, 1.000000, normal ) ); +} + +void computeTemporaries() +{ + //tmp0 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), refractCoords ), coordinateSource(texture_coordinate_world, 0 ) ); + //ftmp1 = perlinNoiseBumpTexture( tmp0, refractScale, 1.000000, false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.0, 0.5, 1.000000, viewDir ); + tmp0 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), bumpCoords ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), bumpCoords ), coordinateSource(texture_coordinate_world, 0 ) ); + ftmp1 = viewDir; + ftmp0 = vec3( reflectivity_amount ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = layers[0].base * vec4( ftmp0, 1.0); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); +} + +vec3 getRefractUV( in vec2 baseUV, in vec3 normal, in float materialIOR, in float refractDepth ) +{ + // Real honest-to-goodness refraction! + vec3 refractedDir = refract( -viewDir, normal, 1.0 / materialIOR ); + float thickness = refractDepth / clamp( dot(viewDir, normal), 0.0001, 1.0 ); + + // This will do an "AA" version of that loss due to critical angle and TIR + // fakes the same effect than using the glsl refract. + float weight = smoothstep( 0.0, 1.0, abs(dot(viewDir, normal)) * 100.0 ); + + // Trace out the refracted ray and the straight view ray + refractedDir *= thickness; + vec3 rawDir = -viewDir * thickness; + + vec3 displace = refractedDir - rawDir; + vec3 newUV = vec3(baseUV + displace.xy, weight); + return newUV; +} + +vec4 doFakeInnerLight( in vec3 normal, in vec3 absorb_color ) +{ + vec3 lightColor = intLightCol * intLightBrt; + + float cosRot = cos(intLightRot * 0.01745329251); + float sinRot = sin(intLightRot * 0.01745329251); + vec2 uvDir = vec2(sinRot, cosRot); + + vec2 dvec = texCoord0.xy - intLightPos; + float dist = dot( dvec, uvDir ); + float fallRate = log2( max( abs(intLightFall), 1.01 ) ); + vec3 fallCol = exp2( -abs(dist) * fallRate / absorb_color ); + + vec3 projDir = (tangent * uvDir.x + binormal * uvDir.y) * dist * intLightFall - surfNormal * refract_depth; + projDir = normalize(projDir); + + vec4 retVal = vec4(lightColor * fallCol, 1.0); + retVal *= abs(dot( projDir, -ftmp2 )); + retVal.a = pow( retVal.a, uFresnelPower ); + retVal.a *= clamp( intLightBrt * exp2(-dist * fallRate), 0.0, 1.0 ); + + return retVal; +} + +vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) +{ + vec4 rgba = color; + float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); + vec3 absorb_color = ( log( glass_color ) * -1.000000 ); + // prevent log(0) -> inf number issue + if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; + if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; + if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; + rgba.rgb *= (vec3(1.0) - absorb_color); + + vec2 texSize = vec2( textureSize( refractiveTexture, 0 ) ); + vec3 newUV = vec3((gl_FragCoord.xy * 0.5) / texSize, 0.0); + vec4 value = texture( refractiveTexture, newUV.xy ); + + newUV = getRefractUV( newUV.xy, normal, materialIOR, 0.01 * refract_depth ); + vec4 refractValue = texture( refractiveTexture, newUV.xy ); + + vec3 refractColor = refractValue.a * refractValue.rgb + (1.0 - refractValue.a) * value.rgb; + refractColor = refractColor * (vec3(1.0) - absorb_color); + vec4 internalColor = doFakeInnerLight( normal, glass_color ); + refractColor += internalColor.rgb * internalColor.a; + + rgba = vec4(mix(refractColor, rgba.rgb, ratio), 1.0); + return rgba; +} + + + + + + + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 + +vec3 texCoord0; + +void main() +{ + + // This is a bit silly, but the thing is that a buffer blit takes place on this + // pass, and if you do a buffer blit on a pass that outputs to lower-resolution, + // it only blits a smaller portion of the backbuffer that occupies that number of + // pixels. So we need a dummy no-op pass that is full-res in order to blit everything. + + + + + + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 + +vec3 texCoord0; + +uniform sampler2D OriginBuffer; + +void main() +{ + vec2 texSize = vec2( textureSize( OriginBuffer, 0 ) ); + texSize = vec2(1.0) / texSize; + texCoord0.z = 0.0; + texCoord0.xy = vec2(gl_FragCoord.xy * 2.0 * texSize); + + float wtSum = 0.0; + vec4 totSum = vec4(0.0); + for (int ix = -1; ix <= 1; ++ix) + { + for (int iy = -1; iy <= 1; ++iy) + { + float wt = float(ix*ix + iy*iy) * 4.0; + wt = exp2( -wt ); + vec2 texOfs = vec2(ix, iy) * texSize; + totSum += wt * texture( OriginBuffer, texCoord0.xy + texOfs ); + wtSum += wt; + } + } + + totSum /= wtSum; + gl_FragColor = totSum; + // No close paren because the generator adds it for us. + + + + + + + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 + +vec3 texCoord0; + +uniform sampler2D BlurBuffer; + +void main() +{ + vec2 texSize = vec2( textureSize( BlurBuffer, 0 ) ); + texSize = vec2(1.0) / texSize; + texCoord0.z = 0.0; + texCoord0.xy = vec2(gl_FragCoord.xy * texSize); + + float sigma = clamp(blur_size * 0.5, 0.5, 100.0); + int smpCount = int(ceil( sigma )); + vec4 value = texture(BlurBuffer, texCoord0.xy); + float wtsum = 1.0; + for (int i = 1; i <= smpCount; ++i) + { + // Base 2 Gaussian blur + float wt = float(i) / (sigma * 0.5); + wt = exp2( -wt*wt ); + vec2 texOfs = vec2(i, 0) * texSize; + value += wt * texture(BlurBuffer, texCoord0.xy+texOfs); + value += wt * texture(BlurBuffer, texCoord0.xy-texOfs); + wtsum += wt * 2.0; + } + + gl_FragColor = value / wtsum; + gl_FragColor.a = 1.0; + + // No close paren because the generator adds it for us. + + + + + + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 + +vec3 texCoord0; + +uniform sampler2D BlurBuffer; +uniform sampler2D OriginBuffer; + +void main() +{ + vec2 texSize = vec2( textureSize( BlurBuffer, 0 ) ); + texSize = vec2(1.0) / texSize; + texCoord0.z = 0.0; + texCoord0.xy = vec2(gl_FragCoord.xy * texSize); + + float sigma = clamp(blur_size * 0.5, 0.5, 100.0); + int smpCount = int(ceil( sigma )); + vec4 value = texture(BlurBuffer, texCoord0.xy); + + float wtsum = 1.0; + for (int i = 1; i <= smpCount; ++i) + { + // Base 2 Gaussian blur + float wt = float(i) / (sigma * 0.5); + wt = exp2( -wt*wt ); + vec2 texOfs = vec2(0, i) * texSize; + vec4 posValue = texture(BlurBuffer, texCoord0.xy+texOfs); + vec4 negValue = texture(BlurBuffer, texCoord0.xy-texOfs); + posValue = posValue.a * posValue + (1.0 - posValue.a) * texture(OriginBuffer, texCoord0.xy+texOfs); + negValue = negValue.a * negValue + (1.0 - negValue.a) * texture(OriginBuffer, texCoord0.xy-texOfs); + + value += wt * posValue; + value += wt * negValue; + wtsum += wt * 2.0; + } + + gl_FragColor = (value / wtsum); + gl_FragColor.a = 1.0; + + // No close paren because the generator adds it for us. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Studio/Content/Material Library/thin_glass_frosted_sp.material b/Studio/Content/Material Library/thin_glass_frosted_sp.material deleted file mode 100644 index d6a20ecd..00000000 --- a/Studio/Content/Material Library/thin_glass_frosted_sp.material +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - - -// add enum defines -#define texture_coordinate_uvw 0 -#define texture_coordinate_world 1 -#define texture_coordinate_object 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - -// add structure defines -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp0; -texture_coordinate_info tmp1; -vec3 ftmp0; -vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "cube.glsllib" -#include "random255.glsllib" -#include "perlinNoise.glsllib" -#include "perlinNoiseBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "coordinateSource.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "abbeNumberIOR.glsllib" -#include "average.glsllib" -#include "perlinNoiseTexture.glsllib" -#include "fresnelLayer.glsllib" -#include "refraction.glsllib" - -uniform sampler2D refractiveTexture; - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect_transmit ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect_transmit ); - -#else - layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - //return( normal ); - return( perlinNoiseBumpTexture( tmp1, bumpScale, 1.000000, false, false, 0.000000, bumpBands, false, vec3( 0.000000, 0.000000, 0.000000 ), 0.5, 0.0, 1.000000, normal ) ); -} - -void computeTemporaries() -{ - tmp0 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), noiseCoords ), coordinateSource(texture_coordinate_world, 0 ) ); - tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), bumpCoords ), coordinateSource(texture_coordinate_world, 0 ) ); - ftmp0 = vec3( reflectivity_amount ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = layers[0].base * vec4( ftmp0, 1.0); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); -} - -vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) -{ - vec4 rgba = color; - float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); - vec3 absorb_color = ( log( glass_color )/-1.000000 ); - // prevent log(0) -> inf number issue - if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; - if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; - if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; - rgba.rgb *= (vec3(1.0) - absorb_color); - - vec3 refractDir = perlinNoiseBumpTexture( tmp0, noiseScale, 1.000000, false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.0, 0.5, 1.000000, normalize(viewDir) ); - - vec3 refractColor = refractBlur( refractiveTexture, normalize(refractDir), materialIOR, blur_size ) * (vec3(1.0) - absorb_color); - rgba = vec4(mix(refractColor, rgba.rgb, ratio), 1.0); - return rgba; -} - - - - - - - - - - - - - - - diff --git a/Studio/Content/Material Library/thin_glass_frosted_sp.shader b/Studio/Content/Material Library/thin_glass_frosted_sp.shader new file mode 100644 index 00000000..d6a20ecd --- /dev/null +++ b/Studio/Content/Material Library/thin_glass_frosted_sp.shader @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + +// add structure defines +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp0; +texture_coordinate_info tmp1; +vec3 ftmp0; +vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "abbeNumberIOR.glsllib" +#include "average.glsllib" +#include "perlinNoiseTexture.glsllib" +#include "fresnelLayer.glsllib" +#include "refraction.glsllib" + +uniform sampler2D refractiveTexture; + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect_transmit ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect_transmit ); + +#else + layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + //return( normal ); + return( perlinNoiseBumpTexture( tmp1, bumpScale, 1.000000, false, false, 0.000000, bumpBands, false, vec3( 0.000000, 0.000000, 0.000000 ), 0.5, 0.0, 1.000000, normal ) ); +} + +void computeTemporaries() +{ + tmp0 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), noiseCoords ), coordinateSource(texture_coordinate_world, 0 ) ); + tmp1 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), bumpCoords ), coordinateSource(texture_coordinate_world, 0 ) ); + ftmp0 = vec3( reflectivity_amount ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = layers[0].base * vec4( ftmp0, 1.0); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); +} + +vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) +{ + vec4 rgba = color; + float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); + vec3 absorb_color = ( log( glass_color )/-1.000000 ); + // prevent log(0) -> inf number issue + if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; + if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; + if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; + rgba.rgb *= (vec3(1.0) - absorb_color); + + vec3 refractDir = perlinNoiseBumpTexture( tmp0, noiseScale, 1.000000, false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.0, 0.5, 1.000000, normalize(viewDir) ); + + vec3 refractColor = refractBlur( refractiveTexture, normalize(refractDir), materialIOR, blur_size ) * (vec3(1.0) - absorb_color); + rgba = vec4(mix(refractColor, rgba.rgb, ratio), 1.0); + return rgba; +} + + + + + + + + + + + + + + + diff --git a/Studio/Content/Material Library/thin_glass_refractive.material b/Studio/Content/Material Library/thin_glass_refractive.material deleted file mode 100644 index 958faf0c..00000000 --- a/Studio/Content/Material Library/thin_glass_refractive.material +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - - - - - - - -// add enum defines -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 0 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -// temporary declarations -vec3 ftmp0; - vec4 tmpShadowTerm; - -layer_result layers[1]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "luminance.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "abbeNumberIOR.glsllib" -#include "fresnelLayer.glsllib" -#include "refraction.glsllib" - -uniform sampler2D refractiveTexture; - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect_transmit ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect_transmit ); - -#else - layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - ftmp0 = vec3( reflectivity_amount ); - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = layers[0].base * vec4( ftmp0, 1.0); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); -} - -vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) -{ - vec4 rgba = color; - float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); - vec3 absorb_color = ( log( glass_color )/-1.000000 ); - // prevent log(0) -> inf number issue - if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; - if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; - if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; - rgba.rgb *= (vec3(1.0) - absorb_color); - vec3 refractColor = refraction( refractiveTexture, materialIOR ) * (vec3(1.0) - absorb_color); - rgba = vec4(mix(refractColor, rgba.rgb, ratio), 1.0); - return rgba; -} - - - - - - - - - - - - - - - diff --git a/Studio/Content/Material Library/thin_glass_refractive.shader b/Studio/Content/Material Library/thin_glass_refractive.shader new file mode 100644 index 00000000..958faf0c --- /dev/null +++ b/Studio/Content/Material Library/thin_glass_refractive.shader @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + +// add enum defines +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 0 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +// temporary declarations +vec3 ftmp0; + vec4 tmpShadowTerm; + +layer_result layers[1]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "abbeNumberIOR.glsllib" +#include "fresnelLayer.glsllib" +#include "refraction.glsllib" + +uniform sampler2D refractiveTexture; + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect_transmit ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect_transmit ); + +#else + layers[0].base += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + ftmp0 = vec3( reflectivity_amount ); + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = layers[0].base * vec4( ftmp0, 1.0); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( tangentFrame( normal, varWorldPos ) ); +} + +vec4 computeGlass(in vec3 normal, in float materialIOR, in float alpha, in vec4 color) +{ + vec4 rgba = color; + float ratio = simpleFresnel( normal, materialIOR, uFresnelPower ); + vec3 absorb_color = ( log( glass_color )/-1.000000 ); + // prevent log(0) -> inf number issue + if ( isinf(absorb_color.r) ) absorb_color.r = 1.0; + if ( isinf(absorb_color.g) ) absorb_color.g = 1.0; + if ( isinf(absorb_color.b) ) absorb_color.b = 1.0; + rgba.rgb *= (vec3(1.0) - absorb_color); + vec3 refractColor = refraction( refractiveTexture, materialIOR ) * (vec3(1.0) - absorb_color); + rgba = vec4(mix(refractColor, rgba.rgb, ratio), 1.0); + return rgba; +} + + + + + + + + + + + + + + + diff --git a/Studio/Content/Material Library/walnut_matte.material b/Studio/Content/Material Library/walnut_matte.material deleted file mode 100644 index 45412415..00000000 --- a/Studio/Content/Material Library/walnut_matte.material +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -// add enum defines -#define mono_alpha 0 -#define mono_average 1 -#define mono_luminance 2 -#define mono_maximum 3 -#define wrap_clamp 0 -#define wrap_repeat 1 -#define wrap_mirrored_repeat 2 -#define gamma_default 0 -#define gamma_linear 1 -#define gamma_srgb 2 -#define scatter_reflect 0 -#define scatter_transmit 1 -#define scatter_reflect_transmit 2 - -#define QT3DS_ENABLE_UV0 1 -#define QT3DS_ENABLE_WORLD_POSITION 1 -#define QT3DS_ENABLE_TEXTAN 1 -#define QT3DS_ENABLE_BINORMAL 1 - -#include "vertexFragmentBase.glsllib" - -// set shader output -out vec4 fragColor; - -// add structure defines -struct layer_result -{ - vec4 base; - vec4 layer; - mat3 tanFrame; -}; - - -struct texture_coordinate_info -{ - vec3 position; - vec3 tangent_u; - vec3 tangent_v; -}; - - -struct texture_return -{ - vec3 tint; - float mono; -}; - - -// temporary declarations -texture_coordinate_info tmp2; -vec3 tmp5; -vec3 ftmp0; -vec3 ftmp1; - vec4 tmpShadowTerm; - -layer_result layers[2]; - -#include "SSAOCustomMaterial.glsllib" -#include "sampleLight.glsllib" -#include "sampleProbe.glsllib" -#include "sampleArea.glsllib" -#include "luminance.glsllib" -#include "monoChannel.glsllib" -#include "fileBumpTexture.glsllib" -#include "transformCoordinate.glsllib" -#include "rotationTranslationScale.glsllib" -#include "textureCoordinateInfo.glsllib" -#include "square.glsllib" -#include "calculateRoughness.glsllib" -#include "evalBakedShadowMap.glsllib" -#include "evalEnvironmentMap.glsllib" -#include "microfacetBSDF.glsllib" -#include "physGlossyBSDF.glsllib" -#include "simpleGlossyBSDF.glsllib" -#include "fileTexture.glsllib" -#include "weightedLayer.glsllib" -#include "diffuseReflectionBSDF.glsllib" -#include "fresnelLayer.glsllib" - -bool evalTwoSided() -{ - return( false ); -} - -vec3 computeFrontMaterialEmissive() -{ - return( vec3( 0, 0, 0 ) ); -} - -void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); - -#endif -} - -void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); - -#endif -} - -void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; - -#else - layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); - - layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; - -#endif -} - -vec3 computeBackMaterialEmissive() -{ - return( vec3(0, 0, 0) ); -} - -void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) -{ -#if QT3DS_ENABLE_CG_LIGHTING - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) -{ -#if !QT3DS_ENABLE_LIGHT_PROBE - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#else - layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); - layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); -#endif -} - -float computeIOR() -{ - return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); -} - -float evalCutout() -{ - return( 1.000000 ); -} - -vec3 computeNormal() -{ - return( normal ); -} - -void computeTemporaries() -{ - tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); - tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); - ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; - ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; - tmpShadowTerm = evalBakedShadowMap( texCoord0 ); -} - -vec4 computeLayerWeights( in float alpha ) -{ - vec4 color; - color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); - color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); - return color; -} - - -void initializeLayerVariables(void) -{ - // clear layers - layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); - layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); - layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); -} - - - - - - - - - - - diff --git a/Studio/Content/Material Library/walnut_matte.shader b/Studio/Content/Material Library/walnut_matte.shader new file mode 100644 index 00000000..45412415 --- /dev/null +++ b/Studio/Content/Material Library/walnut_matte.shader @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + +// add enum defines +#define mono_alpha 0 +#define mono_average 1 +#define mono_luminance 2 +#define mono_maximum 3 +#define wrap_clamp 0 +#define wrap_repeat 1 +#define wrap_mirrored_repeat 2 +#define gamma_default 0 +#define gamma_linear 1 +#define gamma_srgb 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 tmp5; +vec3 ftmp0; +vec3 ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "luminance.glsllib" +#include "monoChannel.glsllib" +#include "fileBumpTexture.glsllib" +#include "transformCoordinate.glsllib" +#include "rotationTranslationScale.glsllib" +#include "textureCoordinateInfo.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "fileTexture.glsllib" +#include "weightedLayer.glsllib" +#include "diffuseReflectionBSDF.glsllib" +#include "fresnelLayer.glsllib" + +bool evalTwoSided() +{ + return( false ); +} + +vec3 computeFrontMaterialEmissive() +{ + return( vec3( 0, 0, 0 ) ); +} + +void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor; + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness ); + + layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor; + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#else + layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 ); + layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 ); +#endif +} + +float computeIOR() +{ + return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = transformCoordinate( rotationTranslationScale( vec3( 0.000000, 0.000000, 0.000000 ), vec3( 0.000000, 0.000000, 0.000000 ), vec3( texture_tiling[0], texture_tiling[1], 1.000000 ) ), textureCoordinateInfo( texCoord0, tangent, binormal ) ); + tmp5 = fileBumpTexture(bump_texture, bump_amount, mono_average, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, normal ); + ftmp0 = fileTexture(reflect_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_linear ).tint; + ftmp1 = fileTexture(diffuse_texture, vec3( 0, 0, 0 ), vec3( 1, 1, 1 ), mono_luminance, tmp2, vec2( 0.000000, 1.000000 ), vec2( 0.000000, 1.000000 ), wrap_repeat, wrap_repeat, gamma_srgb ).tint; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( 1.000000, vec4( ftmp1, 1.0).rgb, layers[1].layer, layers[1].base, alpha ); + color = fresnelLayer( tmp5, vec3( material_ior ), 1.000000, vec4( ftmp0, 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // clear layers + layers[0].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(tmp5, tangent), tmp5 ) ); +} + + + + + + + + + + + diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index eab8b2eb..e4c9c6ef 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -869,7 +869,8 @@ public: absAssetPath = QDir::cleanPath(projDir.absoluteFilePath(path)); } if (recurseSourceMaterial - && absAssetPath.endsWith(QLatin1String(".material")) + && (absAssetPath.endsWith(QLatin1String(".material")) + || absAssetPath.endsWith(QLatin1String(".shader"))) && !outPathMap.contains(path)) { ParseSourcePathsOutOfEffectFile(absAssetPath, projectPath, false, outPathMap, outPropertySet); diff --git a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp index 94c3a29f..2e8f44a4 100644 --- a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp +++ b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp @@ -2530,7 +2530,9 @@ struct SComposerSerializerImpl : public IComposerSerializer warnings); } } else if (theFullPath.GetExtension().Compare( - L"material", CString::ENDOFSTRING, false)) { + L"material", CString::ENDOFSTRING, false) + || theFullPath.GetExtension().Compare( + L"shader", CString::ENDOFSTRING, false)) { if (theFullPath.Exists()) { std::vector warnings; NVScopedRefCounted diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp index 9ac7a3ea..8c599cfb 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp @@ -3828,7 +3828,7 @@ public: qt3ds::foundation::IInStream &inStream) override { QString shaderFile(inShaderFile); - if (shaderFile.endsWith(".material")) { + if (shaderFile.endsWith(".material") || shaderFile.endsWith(".shader")) { LoadMaterialClassFromSourcePath(inShaderFile, inInstance, inName, outWarnings, inStream); } else { diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp index f9dedc12..4016fb33 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp @@ -95,6 +95,7 @@ void InspectorControlView::filterMaterials(std::vector &ma { static const wchar_t *extensions[] = { L"material", + L"shader", nullptr }; for (size_t i = 0; i < m_fileList.size(); ++i) { @@ -139,7 +140,7 @@ void InspectorControlView::onFilesChanged( const Q3DStudio::TFileModificationList &inFileModificationList) { static const wchar_t *materialExtensions[] = { - L"material", L"materialdef", + L"material", L"shader", L"materialdef", nullptr }; static const wchar_t *fontExtensions[] = { diff --git a/src/Authoring/Studio/Workspace/Dialogs.cpp b/src/Authoring/Studio/Workspace/Dialogs.cpp index e9ad3ede..7d3ea989 100644 --- a/src/Authoring/Studio/Workspace/Dialogs.cpp +++ b/src/Authoring/Studio/Workspace/Dialogs.cpp @@ -155,11 +155,11 @@ const wchar_t *wideEffectExts[] = { }; const char *materialExts[] = { - "material", "materialdef", nullptr, + "material", "shader", "materialdef", nullptr, }; const wchar_t *wideMaterialExts[] = { - L"material", L"materialdef", nullptr, + L"material", L"shader", L"materialdef", nullptr, }; const char *soundExts[] = { diff --git a/src/Runtime/Source/UIPParser/Source/Qt3DSUIPParserImpl.cpp b/src/Runtime/Source/UIPParser/Source/Qt3DSUIPParserImpl.cpp index 52aaa180..a9c581aa 100644 --- a/src/Runtime/Source/UIPParser/Source/Qt3DSUIPParserImpl.cpp +++ b/src/Runtime/Source/UIPParser/Source/Qt3DSUIPParserImpl.cpp @@ -653,7 +653,7 @@ BOOL CUIPParserImpl::LoadClasses(IPresentation & /*inPresentation*/, IDOMReader theLoadFlag = m_MetaData.LoadEffectXMLFile(inReader.GetNarrowElementName(), theId, theName, theFullPath.toUtf8().data()); - } else if (theFullPath.endsWith(".material")) { + } else if (theFullPath.endsWith(".material") || theFullPath.endsWith(".shader")) { theLoadFlag = m_MetaData.LoadMaterialXMLFile( inReader.GetNarrowElementName(), theId, theName, theFullPath.toUtf8().data()); diff --git a/src/Runtime/testres.qrc b/src/Runtime/testres.qrc index d099c345..7b3c20bc 100644 --- a/src/Runtime/testres.qrc +++ b/src/Runtime/testres.qrc @@ -1,11 +1,11 @@ - ../../Studio/Content/Material Library/aluminum.material - ../../Studio/Content/Material Library/asphalt.material - ../../Studio/Content/Material Library/concrete.material - ../../Studio/Content/Material Library/copper.material - ../../Studio/Content/Material Library/porcelain.material - ../../Studio/Content/Material Library/simple_glass.material + ../../Studio/Content/Material Library/aluminum.shader + ../../Studio/Content/Material Library/asphalt.shader + ../../Studio/Content/Material Library/concrete.shader + ../../Studio/Content/Material Library/copper.shader + ../../Studio/Content/Material Library/porcelain.shader + ../../Studio/Content/Material Library/simple_glass.shader ../../Studio/Content/Effect Library/Desaturate.effect ../../Studio/Content/Effect Library/Gaussian Blur.effect ../../Studio/Content/Effect Library/Sepia.effect diff --git a/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp b/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp index a071fb82..75e1ce3d 100644 --- a/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp +++ b/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp @@ -436,11 +436,11 @@ bool Qt3DSRenderTestCustomMaterialGenerator::run(NVRenderContext *context, } if (success) { - CRegisteredString name = context->GetStringTable().RegisterStr("qrc:/copper.material"); + CRegisteredString name = context->GetStringTable().RegisterStr("qrc:/copper.shader"); - metadata()->LoadMaterialXMLFile("CustomMaterial", "", "copper", "qrc:/copper.material"); + metadata()->LoadMaterialXMLFile("CustomMaterial", "", "copper", "qrc:/copper.shader"); Option metaMaterial = - metadata()->GetMaterialMetaDataBySourcePath("qrc:/copper.material"); + metadata()->GetMaterialMetaDataBySourcePath("qrc:/copper.shader"); if (metaMaterial.hasValue()) { qt3ds::render::IUIPLoader::CreateMaterialClassFromMetaMaterial( -- cgit v1.2.3