From d7389a09adef67217e1ba9b2b8d27195487589c9 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 20 Apr 2026 14:44:20 +0800 Subject: [PATCH 01/27] refactor: migrate all shaders from raw GLSL to ShaderLab format Convert all shader code to ShaderLab syntax: - Wrap in Shader/SubShader/Pass structure - Replace attribute/varying/uniform with struct Attributes/Varyings - Replace #include macros with explicit vertex transform code - Replace old #include paths with engine ShaderLibrary paths - Change Shader.create(name, vs, fs) to Shader.create(shaderLabSource) - Consolidate separate .glsl files into .ts ShaderLab strings - Fix advanced-shader include paths for future extension use - Keep render states in TS material code (not in shader) Deleted: 10 .glsl files, 4 global.d.ts, bake-pbr vertex/fragment.ts BakePBRMaterial skipped (TODO: full PBR pipeline migration) --- .../box-selection/BoxSelectionSSMaterial.ts | 61 +++-- .../advanced-shader/eye/EyeForwardPass.glsl | 16 +- .../advanced-shader/hair/HairForwardPass.glsl | 14 +- .../advanced-shader/hair/HairLightDirect.glsl | 4 +- .../advanced-shader/sss/SSSForwardPass.glsl | 14 +- .../advanced-shader/sss/SSSLightDirect.glsl | 6 +- .../src/bake-pbr/BakePBRMaterial.ts | 113 ++++++++- .../custom-material/src/bake-pbr/fragment.ts | 94 -------- .../custom-material/src/bake-pbr/vertex.ts | 28 --- packages/custom-material/src/global.d.ts | 4 - .../custom-material/src/grid/GridMaterial.ts | 214 +++++++++--------- .../src/plain-color/PlainColorMaterial.ts | 127 ++++++++--- .../PlanarShadowShaderFactory.ts | 165 +++++++------- .../src/water/WaterMaterial.ts | 109 ++++----- .../src/water/WaterRippleMaterial.ts | 99 ++++---- .../src/water/WaterfallMaterial.ts | 132 +++++------ .../src/FramebufferPicker.ts | 107 ++++++++- packages/framebuffer-picker/src/color.fs.glsl | 7 - packages/framebuffer-picker/src/color.vs.glsl | 11 - packages/framebuffer-picker/src/global.d.ts | 4 - .../src/material/GeometryShader.ts | 46 ++-- .../src/material/TBNMaterial.ts | 165 ++++++++------ .../src/material/WireframeMaterial.ts | 159 +++++++------ packages/gizmo/src/icon/IconMaterial.ts | 167 +++++++++----- packages/lines/src/global.d.ts | 1 - .../lines/src/line/material/dashShader.ts | 130 +++++------ .../lines/src/line/material/lineShader.ts | 113 ++++----- packages/outline/src/OutlineManager.ts | 200 +++++++++++++++- packages/outline/src/global.d.ts | 4 - packages/outline/src/outline.fs.glsl | 76 ------- packages/outline/src/outline.vs.glsl | 10 - packages/outline/src/replace.fs.glsl | 6 - packages/outline/src/replace.vs.glsl | 11 - .../skeleton-viewer/src/SkeletonViewer.ts | 69 +++--- 34 files changed, 1415 insertions(+), 1071 deletions(-) delete mode 100644 packages/custom-material/src/bake-pbr/fragment.ts delete mode 100644 packages/custom-material/src/bake-pbr/vertex.ts delete mode 100644 packages/custom-material/src/global.d.ts delete mode 100644 packages/framebuffer-picker/src/color.fs.glsl delete mode 100644 packages/framebuffer-picker/src/color.vs.glsl delete mode 100644 packages/framebuffer-picker/src/global.d.ts delete mode 100644 packages/lines/src/global.d.ts delete mode 100644 packages/outline/src/global.d.ts delete mode 100644 packages/outline/src/outline.fs.glsl delete mode 100644 packages/outline/src/outline.vs.glsl delete mode 100644 packages/outline/src/replace.fs.glsl delete mode 100644 packages/outline/src/replace.vs.glsl diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index 4b7bf4dc..177567b3 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -1,5 +1,41 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Vector2, Vector4 } from "@galacean/engine"; +const shaderSource = `Shader "box" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + + struct Attributes { + vec3 POSITION; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = vec4(attr.POSITION, 1.0); + return v; + } + + vec2 u_min; + vec2 u_max; + vec4 u_boxColor; + vec4 u_borderColor; + float u_width; + + void frag(Varyings v) { + float vColor = step(u_min.x + u_width, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x - u_width) * step(u_min.y + u_width, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y - u_width); + float vBorder = step(u_min.x, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x) * step(u_min.y, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y); + gl_FragColor = u_boxColor * vColor + (1. - vColor) * vBorder * u_borderColor; + } + } + } +}`; + +Shader.find("box") || Shader.create(shaderSource); + export class BoxSelectionSSMaterial extends BaseMaterial { private static _borderWidth = ShaderProperty.getByName("u_width"); private static _minPoint = ShaderProperty.getByName("u_min"); @@ -54,28 +90,3 @@ export class BoxSelectionSSMaterial extends BaseMaterial { this.shaderData.setFloat(BoxSelectionSSMaterial._borderWidth, value); } } - -Shader.create( - "box", - ` -#include -#include - -void main() { - gl_Position = vec4(POSITION, 1.0); -}`, - - ` -uniform vec2 u_min; -uniform vec2 u_max; -uniform vec4 u_boxColor; -uniform vec4 u_borderColor; -uniform float u_width; - -void main() { - float vColor = step(u_min.x + u_width, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x - u_width) * step(u_min.y + u_width, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y - u_width); - float vBorder = step(u_min.x, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x) * step(u_min.y, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y); - gl_FragColor = u_boxColor * vColor + (1. - vColor) * vBorder * u_borderColor; -} -` -); diff --git a/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl b/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl index d6aa6700..641ad3f9 100644 --- a/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl @@ -1,16 +1,16 @@ #ifndef FORWARD_PASS_PBR_INCLUDED #define FORWARD_PASS_PBR_INCLUDED -#include "Common.glsl" -#include "Fog.glsl" +#include "Common/Common.glsl" +#include "Common/Fog.glsl" -#include "AttributesPBR.glsl" -#include "VaryingsPBR.glsl" -#include "LightDirectPBR.glsl" -#include "LightIndirectPBR.glsl" +#include "PBR/AttributesPBR.glsl" +#include "PBR/VaryingsPBR.glsl" +#include "PBR/LightDirectPBR.glsl" +#include "PBR/LightIndirectPBR.glsl" -#include "VertexPBR.glsl" -#include "FragmentPBR.glsl" +#include "PBR/VertexPBR.glsl" +#include "PBR/FragmentPBR.glsl" #include "./EyeFunction.glsl" diff --git a/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl b/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl index 4c939cc7..d594f7c2 100644 --- a/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl @@ -1,16 +1,16 @@ #ifndef FORWARD_PASS_PBR_INCLUDED #define FORWARD_PASS_PBR_INCLUDED -#include "Common.glsl" -#include "Fog.glsl" +#include "Common/Common.glsl" +#include "Common/Fog.glsl" -#include "AttributesPBR.glsl" -#include "VaryingsPBR.glsl" +#include "PBR/AttributesPBR.glsl" +#include "PBR/VaryingsPBR.glsl" #include "./HairLightDirect.glsl" -#include "LightIndirectPBR.glsl" +#include "PBR/LightIndirectPBR.glsl" -#include "VertexPBR.glsl" -#include "FragmentPBR.glsl" +#include "PBR/VertexPBR.glsl" +#include "PBR/FragmentPBR.glsl" Varyings PBRVertex(Attributes attributes) { diff --git a/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl b/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl index ee878cd6..e7bebdae 100644 --- a/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl +++ b/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl @@ -1,6 +1,6 @@ #define FUNCTION_SPECULAR_LOBE specularLobehair -#include "BRDF.glsl" +#include "PBR/BSDF.glsl" #include "./HairFunction.glsl" @@ -29,4 +29,4 @@ void specularLobehair(Varyings varyings, SurfaceData surfaceData, BRDFData brdfD specularColor += attenuationIrradiance * hairSpecular; } -#include "LightDirectPBR.glsl" \ No newline at end of file +#include "PBR/LightDirectPBR.glsl" \ No newline at end of file diff --git a/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl b/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl index c8d762c3..2024ed66 100644 --- a/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl @@ -1,16 +1,16 @@ #ifndef FORWARD_PASS_PBR_INCLUDED #define FORWARD_PASS_PBR_INCLUDED -#include "Common.glsl" -#include "Fog.glsl" +#include "Common/Common.glsl" +#include "Common/Fog.glsl" -#include "AttributesPBR.glsl" -#include "VaryingsPBR.glsl" +#include "PBR/AttributesPBR.glsl" +#include "PBR/VaryingsPBR.glsl" #include "./SSSLightDirect.glsl" -#include "LightIndirectPBR.glsl" +#include "PBR/LightIndirectPBR.glsl" -#include "VertexPBR.glsl" -#include "FragmentPBR.glsl" +#include "PBR/VertexPBR.glsl" +#include "PBR/FragmentPBR.glsl" Varyings PBRVertex(Attributes attributes) { Varyings varyings; diff --git a/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl b/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl index df8c4f2c..cce4d270 100644 --- a/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl +++ b/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl @@ -1,7 +1,7 @@ #define FUNCTION_SURFACE_SHADING surfaceShadingSSS -#include "BRDF.glsl" -#include "ReflectionLobe.glsl" +#include "PBR/BSDF.glsl" +#include "PBR/ReflectionLobe.glsl" #include "./SSSFunction.glsl" void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor) { @@ -36,4 +36,4 @@ void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdf totalSpecularColor += specularColor; } -#include "LightDirectPBR.glsl" \ No newline at end of file +#include "PBR/LightDirectPBR.glsl" \ No newline at end of file diff --git a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts index 6598a7a7..b77c7850 100644 --- a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts +++ b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts @@ -1,8 +1,115 @@ import { Engine, PBRMaterial, Shader, ShaderProperty, Texture2D } from "@galacean/engine"; -import fragment from "./fragment"; -import vertex from "./vertex"; -Shader.create("bake-pbr", vertex, fragment); +const shaderSource = `Shader "bake-pbr" { + SubShader "Default" { + UsePass "Utility/ShadowMap/Default/ShadowCaster" + UsePass "Utility/DepthOnly/Default/DepthOnly" + + Pass "Forward Pass" { + Tags { pipelineStage = "Forward" } + + RenderQueueType renderQueueType; + BlendFactor sourceColorBlendFactor; + BlendFactor destinationColorBlendFactor; + BlendFactor sourceAlphaBlendFactor; + BlendFactor destinationAlphaBlendFactor; + CullMode rasterStateCullMode; + Bool blendEnabled; + Bool depthWriteEnabled; + + DepthState = { + WriteEnabled = depthWriteEnabled; + } + + BlendState = { + Enabled = blendEnabled; + SourceColorBlendFactor = sourceColorBlendFactor; + DestinationColorBlendFactor = destinationColorBlendFactor; + SourceAlphaBlendFactor = sourceAlphaBlendFactor; + DestinationAlphaBlendFactor = destinationAlphaBlendFactor; + } + + RasterState = { + CullMode = rasterStateCullMode; + } + + RenderQueueType = renderQueueType; + + VertexShader = BakePBRVertex; + FragmentShader = BakePBRFragment; + + #include "PBR/ForwardPassPBR.glsl" + + #ifdef LIGHTMAP_TEXTURE + sampler2D u_lightMapTexture; + float u_lightMapIntensity; + #endif + + Varyings BakePBRVertex(Attributes attributes) { + return PBRVertex(attributes); + } + + void BakePBRFragment(Varyings varyings) { + BSDFData bsdfData; + + vec2 aoUV = varyings.uv; + #if defined(MATERIAL_HAS_OCCLUSION_TEXTURE) && defined(RENDERER_HAS_UV1) + if(material_OcclusionTextureCoord == 1.0){ + aoUV = varyings.uv1; + } + #endif + + SurfaceData surfaceData = getSurfaceData(varyings, aoUV, gl_FrontFacing); + initBSDFData(surfaceData, bsdfData); + + vec3 totalDiffuseColor = vec3(0, 0, 0); + vec3 totalSpecularColor = vec3(0, 0, 0); + + // Shadow + float shadowAttenuation = 1.0; + #if defined(SCENE_DIRECT_LIGHT_COUNT) && defined(NEED_CALCULATE_SHADOWS) + #if SCENE_SHADOW_CASCADED_COUNT == 1 + vec3 shadowCoord = varyings.shadowCoord; + #else + vec3 shadowCoord = getShadowCoord(varyings.positionWS); + #endif + shadowAttenuation *= sampleShadowMap(varyings.positionWS, shadowCoord); + #endif + + // Direct lighting + evaluateDirectRadiance(varyings, surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor); + + // IBL (engine standard) + evaluateIBL(varyings, surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor); + + // Lightmap: replace/supplement IBL diffuse with baked lightmap + #ifdef LIGHTMAP_TEXTURE + vec2 lightMapUV = varyings.uv; + #ifdef RENDERER_HAS_UV1 + lightMapUV = varyings.uv1; + #endif + totalDiffuseColor += texture2D(u_lightMapTexture, lightMapUV).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor); + #endif + + #ifdef MATERIAL_ENABLE_TRANSMISSION + vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData); + totalDiffuseColor = mix(totalDiffuseColor, refractionTransmitted, surfaceData.transmission); + #endif + + vec4 color = vec4((totalDiffuseColor + totalSpecularColor).rgb, surfaceData.opacity); + color.rgb += surfaceData.emissiveColor; + + #if SCENE_FOG_MODE != 0 + color = fog(color, varyings.positionVS); + #endif + + gl_FragColor = color; + } + } + } +}`; + +Shader.find("bake-pbr") || Shader.create(shaderSource); /** * Bake PBR Material. diff --git a/packages/custom-material/src/bake-pbr/fragment.ts b/packages/custom-material/src/bake-pbr/fragment.ts deleted file mode 100644 index 76f451a8..00000000 --- a/packages/custom-material/src/bake-pbr/fragment.ts +++ /dev/null @@ -1,94 +0,0 @@ -export default ` -#define IS_METALLIC_WORKFLOW -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#ifdef LIGHTMAP_TEXTURE - uniform sampler2D u_lightMapTexture; - uniform float u_lightMapIntensity; -#endif - - -void main() { - Geometry geometry; - Material material; - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - - initGeometry(geometry, gl_FrontFacing); - initMaterial(material, geometry); - - addTotalDirectRadiance(geometry, material, reflectedLight); - - - // IBL diffuse - #ifdef LIGHTMAP_TEXTURE - vec2 lightMapUV = v_uv; - #ifdef RENDERER_HAS_UV1 - lightMapUV = v_uv1; - #endif - reflectedLight.indirectDiffuse += texture2D(u_lightMapTexture, lightMapUV).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert( material.diffuseColor ); - #endif - - // IBL specular - vec3 radiance = getLightProbeRadiance(geometry, geometry.normal, material.roughness, int(scene_EnvMapLight.mipMapLevel), scene_EnvMapLight.specularIntensity); - float radianceAttenuation = 1.0; - - #ifdef MATERIAL_CLEARCOAT - vec3 clearCoatRadiance = getLightProbeRadiance( geometry, geometry.clearCoatNormal, material.clearCoatRoughness, int(scene_EnvMapLight.mipMapLevel), scene_EnvMapLight.specularIntensity ); - - reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * envBRDFApprox(vec3( 0.04 ), material.clearCoatRoughness, geometry.clearCoatDotNV); - radianceAttenuation -= material.clearCoat * F_Schlick(geometry.clearCoatDotNV); - #endif - - reflectedLight.indirectSpecular += radianceAttenuation * radiance * envBRDFApprox(material.specularColor, material.roughness, geometry.dotNV ); - - - // Occlusion - #ifdef MATERIAL_OCCLUSIONTEXTURE - vec2 aoUV = v_uv; - #ifdef RENDERER_HAS_UV1 - if(material_OcclusionTextureCoord == 1.0){ - aoUV = v_uv1; - } - #endif - float ambientOcclusion = (texture2D(material_OcclusionTexture, aoUV).r - 1.0) * material_OcclusionIntensity + 1.0; - reflectedLight.indirectDiffuse *= ambientOcclusion; - #ifdef SCENE_USE_SPECULAR_ENV - reflectedLight.indirectSpecular *= computeSpecularOcclusion(ambientOcclusion, material.roughness, geometry.dotNV); - #endif - #endif - - - // Emissive - vec3 emissiveRadiance = material_EmissiveColor; - #ifdef MATERIAL_HAS_EMISSIVETEXTURE - vec4 emissiveColor = texture2D(material_EmissiveTexture, v_uv); - emissiveRadiance *= emissiveColor.rgb; - #endif - - // Total - vec3 totalRadiance = reflectedLight.directDiffuse + - reflectedLight.indirectDiffuse + - reflectedLight.directSpecular + - reflectedLight.indirectSpecular + - emissiveRadiance; - - - gl_FragColor = vec4(totalRadiance, material.opacity); - - #include - - -} -`; diff --git a/packages/custom-material/src/bake-pbr/vertex.ts b/packages/custom-material/src/bake-pbr/vertex.ts deleted file mode 100644 index 9aecd6ec..00000000 --- a/packages/custom-material/src/bake-pbr/vertex.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default ` -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -void main() { - - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #include - #include -} -`; diff --git a/packages/custom-material/src/global.d.ts b/packages/custom-material/src/global.d.ts deleted file mode 100644 index 8d32d621..00000000 --- a/packages/custom-material/src/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.shader" { - const value: string; - export default value; -} diff --git a/packages/custom-material/src/grid/GridMaterial.ts b/packages/custom-material/src/grid/GridMaterial.ts index 54f72c22..93b09709 100644 --- a/packages/custom-material/src/grid/GridMaterial.ts +++ b/packages/custom-material/src/grid/GridMaterial.ts @@ -1,5 +1,114 @@ import { BaseMaterial, Engine, MathUtil, Shader, ShaderProperty } from "@galacean/engine"; +const shaderSource = `Shader "grid" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + + mat4 camera_ViewInvMat; + mat4 camera_ProjMat; + + struct Attributes { + vec4 POSITION_FLIP; + }; + + struct Varyings { + vec3 nearPoint; + vec3 farPoint; + }; + + vec3 UnprojectPoint(float x, float y, float z, mat4 viewInvMat, mat4 projInvMat) { + vec4 unprojectedPoint = viewInvMat * projInvMat * vec4(x, y, z, 1.0); + return unprojectedPoint.xyz / unprojectedPoint.w; + } + + Varyings vert(Attributes attr) { + Varyings v; + float tol = 0.0001; + mat4 viewInvMat = camera_ViewInvMat; + if (abs(viewInvMat[3][1]) < tol) { + viewInvMat[3][1] = tol; + } + mat4 projInvMat = INVERSE_MAT(camera_ProjMat); + + bool flipY = camera_ProjectionParams.x < 0.0; + float x = flipY? attr.POSITION_FLIP.z : attr.POSITION_FLIP.x; + float y = flipY? attr.POSITION_FLIP.w : attr.POSITION_FLIP.y; + + v.nearPoint = UnprojectPoint(x, y, -1.0, viewInvMat, projInvMat); + v.farPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat); + gl_Position = vec4(x, y, 0.0, 1.0); + return v; + } + + #include "Common/Transform.glsl" + + float u_far; + float u_near; + float u_primaryScale; + float u_secondaryScale; + float u_gridIntensity; + float u_axisIntensity; + float u_flipProgress; + float u_fade; + + vec4 grid(vec3 fragPos3D, float scale, float fade) { + vec2 coord = mix(fragPos3D.xz, fragPos3D.xy, u_flipProgress) * scale; + vec2 derivative = fwidth(coord); + vec2 grid = abs(fract(coord - 0.5) - 0.5) / derivative; + float line = min(grid.x, grid.y); + float minimumz = min(derivative.y, 1.0); + float minimumx = min(derivative.x, 1.0); + vec4 color = vec4(u_gridIntensity, u_gridIntensity, u_gridIntensity, fade * (1.0 - min(line, 1.0))); + // z-axis + if (fragPos3D.x > -u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx) + color.z = 1.0; + // x-axis or y-axis + float xy = mix(fragPos3D.z, fragPos3D.y, u_flipProgress); + if (xy > -u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz) + color.x = 1.0; + return color; + } + + float computeDepth(vec3 pos) { + vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); + // map to 0-1 + return (clip_space_pos.z / clip_space_pos.w) * 0.5 + 0.5; + } + + float computeLinearDepth(vec3 pos) { + vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); + float clip_space_depth = clip_space_pos.z / clip_space_pos.w; + float linearDepth = (2.0 * u_near * u_far) / (u_far + u_near - clip_space_depth * (u_far - u_near)); + return linearDepth / u_far; + } + + void frag(Varyings v) { + float ty = -v.nearPoint.y / (v.farPoint.y - v.nearPoint.y); + float tz = -v.nearPoint.z / (v.farPoint.z - v.nearPoint.z); + float t = mix(ty, tz, u_flipProgress); + vec3 fragPos3D = v.nearPoint + t * (v.farPoint - v.nearPoint); + + gl_FragDepth = computeDepth(fragPos3D); + + float linearDepth = computeLinearDepth(fragPos3D); + float fading = max(0.0, (0.5 - linearDepth)); + + // adding multiple resolution for the grid + gl_FragColor = (grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade)); + gl_FragColor.a *= fading; + + gl_FragColor = sRGBToLinear(gl_FragColor); + } + } + } +}`; + +Shader.find("grid") || Shader.create(shaderSource); + /** * Grid Material. */ @@ -116,108 +225,3 @@ export class GridMaterial extends BaseMaterial { shaderData.setFloat(GridMaterial._fadeProperty, 0.0); } } - -Shader.create( - "grid", - ` -#include - -attribute vec4 POSITION_FLIP; - -uniform mat4 camera_ViewInvMat; -uniform mat4 camera_ProjMat; - -varying vec3 nearPoint; -varying vec3 farPoint; - - -vec3 UnprojectPoint(float x, float y, float z, mat4 viewInvMat, mat4 projInvMat) { - vec4 unprojectedPoint = viewInvMat * projInvMat * vec4(x, y, z, 1.0); - return unprojectedPoint.xyz / unprojectedPoint.w; -} - - -void main() { - float tol = 0.0001; - mat4 viewInvMat = camera_ViewInvMat; - if (abs(viewInvMat[3][1]) < tol) { - viewInvMat[3][1] = tol; - } - mat4 projInvMat = INVERSE_MAT(camera_ProjMat); - - bool flipY = camera_ProjectionParams.x < 0.0; - float x = flipY? POSITION_FLIP.z : POSITION_FLIP.x; - float y = flipY? POSITION_FLIP.w : POSITION_FLIP.y; - - nearPoint = UnprojectPoint(x, y, -1.0, viewInvMat, projInvMat);// unprojecting on the near plane - farPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat);// unprojecting on the far plane - gl_Position = vec4(x, y, 0.0, 1.0);// using directly the clipped coordinates -}`, - - ` -#include -#include - -uniform float u_far; -uniform float u_near; -uniform float u_primaryScale; -uniform float u_secondaryScale; -uniform float u_gridIntensity; -uniform float u_axisIntensity; -uniform float u_flipProgress; -uniform float u_fade; - -varying vec3 nearPoint; -varying vec3 farPoint; - -vec4 grid(vec3 fragPos3D, float scale, float fade) { - vec2 coord = mix(fragPos3D.xz, fragPos3D.xy, u_flipProgress) * scale; - vec2 derivative = fwidth(coord); - vec2 grid = abs(fract(coord - 0.5) - 0.5) / derivative; - float line = min(grid.x, grid.y); - float minimumz = min(derivative.y, 1.0); - float minimumx = min(derivative.x, 1.0); - vec4 color = vec4(u_gridIntensity, u_gridIntensity, u_gridIntensity, fade * (1.0 - min(line, 1.0))); - // z-axis - if (fragPos3D.x > -u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx) - color.z = 1.0; - // x-axis or y-axis - float xy = mix(fragPos3D.z, fragPos3D.y, u_flipProgress); - if (xy > -u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz) - color.x = 1.0; - return color; -} - -float computeDepth(vec3 pos) { - vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); - // map to 0-1 - return (clip_space_pos.z / clip_space_pos.w) * 0.5 + 0.5; -} - -float computeLinearDepth(vec3 pos) { - vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); - float clip_space_depth = clip_space_pos.z / clip_space_pos.w; - float linearDepth = (2.0 * u_near * u_far) / (u_far + u_near - clip_space_depth * (u_far - u_near)); - return linearDepth / u_far;// normalize -} - -void main() { - float ty = -nearPoint.y / (farPoint.y - nearPoint.y); - float tz = -nearPoint.z / (farPoint.z - nearPoint.z); - float t = mix(ty, tz, u_flipProgress); - vec3 fragPos3D = nearPoint + t * (farPoint - nearPoint); - - gl_FragDepth = computeDepth(fragPos3D); - - float linearDepth = computeLinearDepth(fragPos3D); - float fading = max(0.0, (0.5 - linearDepth)); - - // adding multiple resolution for the grid - gl_FragColor = (grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade)); - gl_FragColor.a *= fading; - - gl_FragColor = sRGBToLinear(gl_FragColor); - -} -` -); diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index d1bd3f63..b1795bae 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -1,5 +1,98 @@ import { BaseMaterial, Color, CullMode, Engine, Shader } from "@galacean/engine"; +const shaderSource = `Shader "plain-color" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + struct Attributes { + vec3 POSITION; + #ifdef RENDERER_HAS_BLENDSHAPE + #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE + vec3 POSITION_BS0; + vec3 POSITION_BS1; + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + #else + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 POSITION_BS2; + vec3 POSITION_BS3; + #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 NORMAL_BS2; + vec3 NORMAL_BS3; + #endif + #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + vec3 TANGENT_BS2; + vec3 TANGENT_BS3; + #endif + #else + vec3 POSITION_BS2; + vec3 POSITION_BS3; + vec3 POSITION_BS4; + vec3 POSITION_BS5; + vec3 POSITION_BS6; + vec3 POSITION_BS7; + #endif + #endif + #endif + #endif + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + }; + + Varyings vert(Attributes attr) { + Varyings v; + + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = renderer_MVPMat * position; + + return v; + } + + vec4 material_BaseColor; + + void frag(Varyings v) { + vec4 baseColor = material_BaseColor; + + #ifdef MATERIAL_IS_ALPHA_CUTOFF + if( baseColor.a < material_AlphaCutoff ) { + discard; + } + #endif + + gl_FragColor = baseColor; + } + } + } +}`; + +Shader.find("plain-color") || Shader.create(shaderSource); + /** * plain color Material. don't effected by light and fog. */ @@ -40,37 +133,3 @@ export class PlainColorMaterial extends BaseMaterial { return dest; } } - -Shader.create( - "plain-color", - ` -#include -#include -#include - -void main() { - #include - #include - #include - #include -} -`, - - ` -#include - -uniform vec4 material_BaseColor; - -void main() { - vec4 baseColor = material_BaseColor; - - #ifdef MATERIAL_IS_ALPHA_CUTOFF - if( baseColor.a < material_AlphaCutoff ) { - discard; - } - #endif - - gl_FragColor = baseColor; -} -` -); diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index a85cdd07..1a86b855 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -18,8 +18,8 @@ export class PlanarShadowShaderFactory { private static _shadowFalloffProp = ShaderProperty.getByName("u_planarShadowFalloff"); /** - * Replace material Shader and initialization。 - * @param material - Material to replace and initialization。 + * Replace material Shader and initialization. + * @param material - Material to replace and initialization. */ static replaceShader(material: Material) { material.shader = Shader.find("planarShadowShader"); @@ -92,96 +92,103 @@ export class PlanarShadowShaderFactory { } } -const planarShadow = new ShaderPass( - ` - attribute vec4 POSITION; - varying vec4 color; +const planarShadowPassSource = ` +Pass "PlanarShadow" { + VertexShader = vert; + FragmentShader = frag; - uniform vec3 u_lightDir; - uniform float u_planarHeight; - uniform vec4 u_planarShadowColor; - uniform float u_planarShadowFalloff; + vec3 u_lightDir; + float u_planarHeight; + vec4 u_planarShadowColor; + float u_planarShadowFalloff; - uniform mat4 renderer_ModelMat; - uniform mat4 camera_VPMat; + mat4 renderer_ModelMat; + mat4 camera_VPMat; + struct Attributes { + vec4 POSITION; #ifdef RENDERER_HAS_SKIN - attribute vec4 JOINTS_0; - attribute vec4 WEIGHTS_0; + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + }; + + struct Varyings { + vec4 color; + }; + + #ifdef RENDERER_HAS_SKIN + #ifdef RENDERER_USE_JOINT_TEXTURE + sampler2D renderer_JointSampler; + float renderer_JointCount; + mat4 getJointMatrix(sampler2D smp, float index) { + float base = index / renderer_JointCount; + float hf = 0.5 / renderer_JointCount; + float v = base + hf; + + vec4 m0 = texture2D(smp, vec2(0.125, v )); + vec4 m1 = texture2D(smp, vec2(0.375, v )); + vec4 m2 = texture2D(smp, vec2(0.625, v )); + vec4 m3 = texture2D(smp, vec2(0.875, v )); + + return mat4(m0, m1, m2, m3); + } + #else + mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ]; + #endif + #endif + + vec3 ShadowProjectPos(vec4 vertPos) { + vec3 shadowPos; + + vec3 worldPos = (renderer_ModelMat * vertPos).xyz; + + shadowPos.y = min(worldPos.y, u_planarHeight); + shadowPos.xz = worldPos.xz - u_lightDir.xz * max(0.0, worldPos.y - u_planarHeight) / u_lightDir.y; + return shadowPos; + } + + Varyings vert(Attributes attr) { + Varyings v; + vec4 position = vec4(attr.POSITION.xyz, 1.0); + #ifdef RENDERER_HAS_SKIN #ifdef RENDERER_USE_JOINT_TEXTURE - uniform sampler2D renderer_JointSampler; - uniform float renderer_JointCount; - mat4 getJointMatrix(sampler2D smp, float index) { - float base = index / renderer_JointCount; - float hf = 0.5 / renderer_JointCount; - float v = base + hf; - - vec4 m0 = texture2D(smp, vec2(0.125, v )); - vec4 m1 = texture2D(smp, vec2(0.375, v )); - vec4 m2 = texture2D(smp, vec2(0.625, v )); - vec4 m3 = texture2D(smp, vec2(0.875, v )); - - return mat4(m0, m1, m2, m3); - } + mat4 skinMatrix = + attr.WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.x) + + attr.WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.y) + + attr.WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.z) + + attr.WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.w); #else - uniform mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ]; + mat4 skinMatrix = + attr.WEIGHTS_0.x * renderer_JointMatrix[ int( attr.JOINTS_0.x ) ] + + attr.WEIGHTS_0.y * renderer_JointMatrix[ int( attr.JOINTS_0.y ) ] + + attr.WEIGHTS_0.z * renderer_JointMatrix[ int( attr.JOINTS_0.z ) ] + + attr.WEIGHTS_0.w * renderer_JointMatrix[ int( attr.JOINTS_0.w ) ]; #endif + position = skinMatrix * position; #endif - vec3 ShadowProjectPos(vec4 vertPos) { - vec3 shadowPos; + vec3 shadowPos = ShadowProjectPos(position); - // get the world space coordinates of the vertex - vec3 worldPos = (renderer_ModelMat * vertPos).xyz; - - // world space coordinates of the shadow (the part below the ground is unchanged) - shadowPos.y = min(worldPos.y , u_planarHeight); - shadowPos.xz = worldPos.xz - u_lightDir.xz * max(0.0, worldPos.y - u_planarHeight) / u_lightDir.y; + gl_Position = camera_VPMat * vec4(shadowPos, 1.0); - return shadowPos; - } + vec3 center = vec3(renderer_ModelMat[3].x, u_planarHeight, renderer_ModelMat[3].z); + float falloff = 0.5 - clamp(distance(shadowPos, center) * u_planarShadowFalloff, 0.0, 1.0); - void main() { - vec4 position = vec4(POSITION.xyz, 1.0 ); - #ifdef RENDERER_HAS_SKIN - #ifdef RENDERER_USE_JOINT_TEXTURE - mat4 skinMatrix = - WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x ) + - WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y ) + - WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z ) + - WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w ); - #else - mat4 skinMatrix = - WEIGHTS_0.x * renderer_JointMatrix[ int( JOINTS_0.x ) ] + - WEIGHTS_0.y * renderer_JointMatrix[ int( JOINTS_0.y ) ] + - WEIGHTS_0.z * renderer_JointMatrix[ int( JOINTS_0.z ) ] + - WEIGHTS_0.w * renderer_JointMatrix[ int( JOINTS_0.w ) ]; - #endif - position = skinMatrix * position; - #endif - - // get the shadow's world space coordinates - vec3 shadowPos = ShadowProjectPos(position); + v.color = u_planarShadowColor; + v.color.a *= falloff; + return v; + } - // convert to clip space - gl_Position = camera_VPMat * vec4(shadowPos, 1.0); + void frag(Varyings v) { + gl_FragColor = v.color; + } +} +`; - // get the world coordinates of the center point - vec3 center = vec3(renderer_ModelMat[3].x, u_planarHeight, renderer_ModelMat[3].z); - // calculate shadow falloff - float falloff = 0.5 - clamp(distance(shadowPos , center) * u_planarShadowFalloff, 0.0, 1.0); +const planarShadow = new ShaderPass(planarShadowPassSource); - // shadow color - color = u_planarShadowColor; - color.a *= falloff; - } - `, - ` - varying vec4 color; - void main() { - gl_FragColor = color; - } - ` -); -Shader.create("planarShadowShader", [Shader.find("pbr").subShaders[0].passes[0], planarShadow]); +if (!Shader.find("planarShadowShader")) { + Shader.create("planarShadowShader", [Shader.find("pbr").subShaders[0].passes[0], planarShadow]); +} diff --git a/packages/custom-material/src/water/WaterMaterial.ts b/packages/custom-material/src/water/WaterMaterial.ts index c0208590..4827c149 100644 --- a/packages/custom-material/src/water/WaterMaterial.ts +++ b/packages/custom-material/src/water/WaterMaterial.ts @@ -1,58 +1,65 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; -const vertexSource = ` - attribute vec3 POSITION; - attribute vec2 TEXCOORD_0; - attribute vec4 COLOR_0; - - uniform mat4 renderer_MVPMat; - - uniform float u_time; - uniform vec2 u_water_speed; - uniform vec2 u_distorsion_speed; - - varying vec4 v_color; - varying vec2 waterTexCoords; - varying vec2 normalTexCoords; - - void main() { - gl_Position = renderer_MVPMat * vec4(POSITION, 1.0); - - waterTexCoords = TEXCOORD_0 + vec2(u_water_speed.x * sin(u_time), u_water_speed.y * cos(u_time)); - normalTexCoords = TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - - v_color = COLOR_0; +const shaderSource = `Shader "water" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_time; + vec2 u_water_speed; + vec2 u_distorsion_speed; + + struct Attributes { + vec3 POSITION; + vec2 TEXCOORD_0; + vec4 COLOR_0; + }; + + struct Varyings { + vec4 v_color; + vec2 waterTexCoords; + vec2 normalTexCoords; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * sin(u_time), u_water_speed.y * cos(u_time)); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + + v.v_color = attr.COLOR_0; + return v; + } + + #include "Common/Common.glsl" + + sampler2D material_NormalTexture; + sampler2D u_waterTex; + sampler2D u_edgeTex; + + vec4 u_edgeColor; + vec2 u_edgeParam; + float u_distorsion_amount; + + void frag(Varyings v) { + vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; + vec4 waterTex = texture2D(u_waterTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + vec4 edgeTex = texture2D(u_edgeTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + + float edge = pow((v.v_color.r + edgeTex.r) * v.v_color.r, 2.0); + edge = saturate(1.0 - smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edge)); + vec4 finalCol = mix(waterTex, u_edgeColor, edge); + + gl_FragColor = finalCol; + } } - `; - -const fragmentSource = ` - #include - varying vec4 v_color; - varying vec2 waterTexCoords; - varying vec2 normalTexCoords; - - uniform sampler2D material_NormalTexture; - uniform sampler2D u_waterTex; - uniform sampler2D u_edgeTex; - - uniform vec4 u_edgeColor; - uniform vec2 u_edgeParam; - uniform float u_distorsion_amount; - - void main() { - vec4 normalTex = texture2D(material_NormalTexture, normalTexCoords) * 2.0 - 1.0; - vec4 waterTex = texture2D(u_waterTex, waterTexCoords + (normalTex.rg * u_distorsion_amount)); - vec4 edgeTex = texture2D(u_edgeTex, waterTexCoords + (normalTex.rg * u_distorsion_amount)); - - float edge = pow((v_color.r + edgeTex.r) * v_color.r, 2.0); - edge = saturate(1.0 - smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edge)); - vec4 finalCol = mix(waterTex, u_edgeColor, edge); - - gl_FragColor = finalCol; - } - `; + } +}`; -Shader.create("water", vertexSource, fragmentSource); +Shader.find("water") || Shader.create(shaderSource); export class WaterMaterial extends BaseMaterial { private static _waterSpeed = ShaderProperty.getByName("u_water_speed"); diff --git a/packages/custom-material/src/water/WaterRippleMaterial.ts b/packages/custom-material/src/water/WaterRippleMaterial.ts index 6723a4dd..b4047e4d 100644 --- a/packages/custom-material/src/water/WaterRippleMaterial.ts +++ b/packages/custom-material/src/water/WaterRippleMaterial.ts @@ -1,49 +1,60 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector3 } from "@galacean/engine"; -const vertexSource = ` - attribute vec3 POSITION; - attribute vec2 TEXCOORD_0; - attribute vec4 COLOR_0; - uniform mat4 renderer_MVPMat; - - uniform float u_time; - uniform vec2 u_foam_speed; - uniform vec2 u_distorsion_speed; - varying vec2 waterTexCoords; - varying vec2 normalTexCoords; - varying vec4 v_color; - - void main() { - gl_Position = renderer_MVPMat * vec4(POSITION, 1.0); - waterTexCoords = TEXCOORD_0 + vec2(u_foam_speed.x * u_time, u_foam_speed.y * u_time); - normalTexCoords = TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - v_color = COLOR_0; - } - `; - -const fragmentSource = ` - #include - varying vec4 v_color; - varying vec2 waterTexCoords; - varying vec2 normalTexCoords; - uniform sampler2D material_NormalTexture; - uniform sampler2D u_foamTex; - uniform vec3 u_foamColor; - uniform vec2 u_foam_param; - uniform float u_distorsion_amount; - void main() { - vec4 normalTex = texture2D(material_NormalTexture, normalTexCoords) * 2.0 - 1.0; - vec4 waterTex = texture2D(u_foamTex, waterTexCoords + (normalTex.rg * u_distorsion_amount)); - float alphaComp = v_color.r * waterTex.r * u_foam_param.x; - float alpha = pow(alphaComp,2.0); - alpha = smoothstep(0.5 - u_foam_param.y, 0.5+ u_foam_param.y, alpha); - alpha = saturate(alpha); - - gl_FragColor = vec4(u_foamColor.rgb, alpha); - } - `; - -Shader.create("water-ripple", vertexSource, fragmentSource); +const shaderSource = `Shader "water-ripple" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_time; + vec2 u_foam_speed; + vec2 u_distorsion_speed; + + struct Attributes { + vec3 POSITION; + vec2 TEXCOORD_0; + vec4 COLOR_0; + }; + + struct Varyings { + vec2 waterTexCoords; + vec2 normalTexCoords; + vec4 v_color; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_foam_speed.x * u_time, u_foam_speed.y * u_time); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + v.v_color = attr.COLOR_0; + return v; + } + + #include "Common/Common.glsl" + + sampler2D material_NormalTexture; + sampler2D u_foamTex; + vec3 u_foamColor; + vec2 u_foam_param; + float u_distorsion_amount; + + void frag(Varyings v) { + vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; + vec4 waterTex = texture2D(u_foamTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + float alphaComp = v.v_color.r * waterTex.r * u_foam_param.x; + float alpha = pow(alphaComp, 2.0); + alpha = smoothstep(0.5 - u_foam_param.y, 0.5 + u_foam_param.y, alpha); + alpha = saturate(alpha); + + gl_FragColor = vec4(u_foamColor.rgb, alpha); + } + } + } +}`; + +Shader.find("water-ripple") || Shader.create(shaderSource); export class WaterRippleMaterial extends BaseMaterial { private static _foamColor = ShaderProperty.getByName("u_foamColor"); diff --git a/packages/custom-material/src/water/WaterfallMaterial.ts b/packages/custom-material/src/water/WaterfallMaterial.ts index 64dfffea..5db7229f 100644 --- a/packages/custom-material/src/water/WaterfallMaterial.ts +++ b/packages/custom-material/src/water/WaterfallMaterial.ts @@ -1,70 +1,76 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; -const vertexSource = ` - attribute vec3 POSITION; - attribute vec2 TEXCOORD_0; - attribute vec4 COLOR_0; - - uniform mat4 renderer_MVPMat; - - uniform float u_time; - uniform vec2 u_water_speed; - uniform vec2 u_waterfall_speed; - uniform vec2 u_distorsion_speed; - - varying vec2 waterTexCoords; - varying vec2 waterfallTexCoords; - varying vec2 normalTexCoords; - varying vec4 v_color; - - void main() { - gl_Position = renderer_MVPMat * vec4(POSITION, 1.0); - - waterTexCoords = TEXCOORD_0 + vec2(u_water_speed.x * u_time, u_water_speed.y * u_time); - waterfallTexCoords = TEXCOORD_0 + vec2(u_waterfall_speed.x * u_time, u_waterfall_speed.y * u_time); - normalTexCoords = TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - - v_color = COLOR_0; +const shaderSource = `Shader "water-fall" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_time; + vec2 u_water_speed; + vec2 u_waterfall_speed; + vec2 u_distorsion_speed; + + struct Attributes { + vec3 POSITION; + vec2 TEXCOORD_0; + vec4 COLOR_0; + }; + + struct Varyings { + vec2 waterTexCoords; + vec2 waterfallTexCoords; + vec2 normalTexCoords; + vec4 v_color; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * u_time, u_water_speed.y * u_time); + v.waterfallTexCoords = attr.TEXCOORD_0 + vec2(u_waterfall_speed.x * u_time, u_waterfall_speed.y * u_time); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + + v.v_color = attr.COLOR_0; + return v; + } + + #include "Common/Common.glsl" + + sampler2D material_NormalTexture; + sampler2D u_waterTex; + sampler2D u_waterfallTex; + sampler2D u_edgeNoiseTex; + + vec4 u_edgeColor; + vec2 u_edgeParam; + float u_distorsion_amount; + + void frag(Varyings v) { + vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; + + vec4 waterTex = texture2D(u_waterTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + vec4 waterfallTex = texture2D(u_waterfallTex, v.waterfallTexCoords + (normalTex.rg * u_distorsion_amount)); + + vec4 streamEdge = texture2D(u_edgeNoiseTex, v.waterTexCoords); + vec4 fallEdge = texture2D(u_edgeNoiseTex, v.waterfallTexCoords); + + float edgeShape = mix(fallEdge.r, streamEdge.r, v.v_color.r); + edgeShape = saturate(edgeShape * v.v_color.g); + edgeShape = saturate(smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edgeShape)); + + vec4 waterAll = mix(waterfallTex, waterTex, v.v_color.r); + vec4 finalCol = mix(waterAll, u_edgeColor, edgeShape); + + gl_FragColor = finalCol; + } } - `; - -const fragmentSource = ` - #include - varying vec4 v_color; - varying vec2 waterTexCoords; - varying vec2 waterfallTexCoords; - varying vec2 normalTexCoords; - - uniform sampler2D material_NormalTexture; - uniform sampler2D u_waterTex; - uniform sampler2D u_waterfallTex; - uniform sampler2D u_edgeNoiseTex; - - uniform vec4 u_edgeColor; - uniform vec2 u_edgeParam; - uniform float u_distorsion_amount; - - void main() { - vec4 normalTex = texture2D(material_NormalTexture, normalTexCoords) * 2.0 - 1.0; - - vec4 waterTex = texture2D(u_waterTex, waterTexCoords + (normalTex.rg * u_distorsion_amount)); - vec4 waterfallTex = texture2D(u_waterfallTex, waterfallTexCoords + (normalTex.rg * u_distorsion_amount)); - - vec4 streamEdge = texture2D(u_edgeNoiseTex, waterTexCoords); - vec4 fallEdge = texture2D(u_edgeNoiseTex, waterfallTexCoords); - - float edgeShape = mix(fallEdge.r, streamEdge.r, v_color.r); - edgeShape = saturate(edgeShape * v_color.g); - edgeShape = saturate(smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edgeShape)); - - vec4 waterAll = mix(waterfallTex, waterTex, v_color.r); - vec4 finalCol = mix(waterAll, u_edgeColor, edgeShape); - - gl_FragColor = finalCol; - } - `; + } +}`; -Shader.create("water-fall", vertexSource, fragmentSource); +Shader.find("water-fall") || Shader.create(shaderSource); export class WaterFallMaterial extends BaseMaterial { private static _waterSpeed = ShaderProperty.getByName("u_water_speed"); diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index 9ff3109a..1fd616d6 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -18,10 +18,111 @@ import { Vector2, Vector3 } from "@galacean/engine"; -import fs from "./color.fs.glsl"; -import vs from "./color.vs.glsl"; -const pickShader = Shader.create("framebuffer-picker-color", vs, fs); +const colorShaderSource = `Shader "framebuffer-picker-color" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + struct Attributes { + vec3 POSITION; + #ifdef RENDERER_HAS_BLENDSHAPE + #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE + vec3 POSITION_BS0; + vec3 POSITION_BS1; + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + #else + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 POSITION_BS2; + vec3 POSITION_BS3; + #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 NORMAL_BS2; + vec3 NORMAL_BS3; + #endif + #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + vec3 TANGENT_BS2; + vec3 TANGENT_BS3; + #endif + #else + vec3 POSITION_BS2; + vec3 POSITION_BS3; + vec3 POSITION_BS4; + vec3 POSITION_BS5; + vec3 POSITION_BS6; + vec3 POSITION_BS7; + #endif + #endif + #endif + #endif + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + #ifdef RENDERER_HAS_NORMAL + vec3 NORMAL; + #endif + #ifdef RENDERER_HAS_TANGENT + vec4 TANGENT; + #endif + }; + + Varyings vert(Attributes attr) { + Varyings v; + + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(attr.NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(attr.TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position + #ifdef RENDERER_HAS_NORMAL + , normal + #ifdef RENDERER_HAS_TANGENT + , tangent + #endif + #endif + ); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = renderer_MVPMat * position; + + return v; + } + + vec3 u_pickColor; + + void frag(Varyings v) { + gl_FragColor = vec4(u_pickColor, 1.0); + } + } + } +}`; + +const pickShader = Shader.find("framebuffer-picker-color") || Shader.create(colorShaderSource); pickShader.subShaders.forEach((subShader: SubShader) => { subShader.passes.forEach((pass) => { pass.setTag("spriteDisableBatching", true); diff --git a/packages/framebuffer-picker/src/color.fs.glsl b/packages/framebuffer-picker/src/color.fs.glsl deleted file mode 100644 index 1df0b3bd..00000000 --- a/packages/framebuffer-picker/src/color.fs.glsl +++ /dev/null @@ -1,7 +0,0 @@ -#include - -uniform vec3 u_pickColor; - -void main() { - gl_FragColor = vec4( u_pickColor, 1.0 ); -} diff --git a/packages/framebuffer-picker/src/color.vs.glsl b/packages/framebuffer-picker/src/color.vs.glsl deleted file mode 100644 index 13a38e84..00000000 --- a/packages/framebuffer-picker/src/color.vs.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -void main() { - #include - #include - #include - #include - #include -} diff --git a/packages/framebuffer-picker/src/global.d.ts b/packages/framebuffer-picker/src/global.d.ts deleted file mode 100644 index 35e0469e..00000000 --- a/packages/framebuffer-picker/src/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.glsl" { - const value: string; - export default value; -} diff --git a/packages/geometry-sketch/src/material/GeometryShader.ts b/packages/geometry-sketch/src/material/GeometryShader.ts index b44fb2ca..3ec2a178 100644 --- a/packages/geometry-sketch/src/material/GeometryShader.ts +++ b/packages/geometry-sketch/src/material/GeometryShader.ts @@ -1,60 +1,60 @@ export const geometryTextureDefine = ` - uniform sampler2D u_verticesSampler; - uniform float u_verticesTextureWidth; - uniform float u_verticesTextureHeight; - - uniform sampler2D u_indicesSampler; - uniform float u_indicesTextureWidth; - uniform float u_indicesTextureHeight; - + sampler2D u_verticesSampler; + float u_verticesTextureWidth; + float u_verticesTextureHeight; + + sampler2D u_indicesSampler; + float u_indicesTextureWidth; + float u_indicesTextureHeight; + vec4 getVertexElement(float row, float col) { return texture2D(u_verticesSampler, vec2((col + 0.5) / u_verticesTextureWidth, (row + 0.5) / u_verticesTextureHeight)); } - + vec3 getIndicesElement(float row, float col) { return texture2D(u_indicesSampler, vec2((col + 0.5) / u_indicesTextureWidth, (row + 0.5) / u_indicesTextureHeight )).xyz; } - + vec2 getVec2(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { row_index += (value_index+1)/4; value_index = (value_index+1)%4; float x = rows[row_index][value_index]; - + row_index += (value_index+1)/4; value_index = (value_index+1)%4; float y = rows[row_index][value_index]; - + return vec2(x, y); } - + vec3 getVec3(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { row_index += (value_index+1)/4; value_index = (value_index+1)%4; float x = rows[row_index][value_index]; - + row_index += (value_index+1)/4; value_index = (value_index+1)%4; float y = rows[row_index][value_index]; - + row_index += (value_index+1)/4; value_index = (value_index+1)%4; float z = rows[row_index][value_index]; return vec3(x, y, z); } - + vec4 getVec4(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { row_index += (value_index+1)/4; value_index = (value_index+1)%4; float x = rows[row_index][value_index]; - + row_index += (value_index+1)/4; value_index = (value_index+1)%4; float y = rows[row_index][value_index]; - + row_index += (value_index+1)/4; value_index = (value_index+1)%4; float z = rows[row_index][value_index]; - + row_index += (value_index+1)/4; value_index = (value_index+1)%4; float w = rows[row_index][value_index]; @@ -65,16 +65,16 @@ export const geometryTextureDefine = ` export const geometryTextureVert = ` int row = pointIndex * ELEMENT_COUNT / int(u_verticesTextureWidth); int col = pointIndex * ELEMENT_COUNT % int(u_verticesTextureWidth); - + vec4 rows[ELEMENT_COUNT]; for( int i = 0; i < ELEMENT_COUNT; i++ ) { rows[i] = getVertexElement(float(row), float(col + i)); } - - vec3 POSITION = vec3(rows[0].x, rows[0].y, rows[0].z); + + vec3 POSITION = vec3(rows[0].x, rows[0].y, rows[0].z); int row_index = 0; int value_index = 2; -#ifdef RENDERER_HAS_NORMAL +#ifdef RENDERER_HAS_NORMAL vec3 NORMAL = getVec3(rows, row_index, value_index); #endif diff --git a/packages/geometry-sketch/src/material/TBNMaterial.ts b/packages/geometry-sketch/src/material/TBNMaterial.ts index 5ec27074..89fd3dcb 100644 --- a/packages/geometry-sketch/src/material/TBNMaterial.ts +++ b/packages/geometry-sketch/src/material/TBNMaterial.ts @@ -1,82 +1,99 @@ import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; import { geometryTextureDefine, geometryTextureVert } from "./GeometryShader"; -Shader.create( - "tbnShader", - ` -#include - uniform float u_lineScale; - uniform mat4 camera_VPMat; - uniform mat4 u_worldMatrix; - uniform mat4 u_worldNormal; - -#ifdef RENDERER_HAS_SKIN -#ifdef RENDERER_USE_JOINT_TEXTURE - uniform sampler2D renderer_JointSampler; - uniform float renderer_JointCount; - - mat4 getJointMatrix(sampler2D smp, float index) { - float base = index / renderer_JointCount; - float hf = 0.5 / renderer_JointCount; - float v = base + hf; - - vec4 m0 = texture2D(smp, vec2(0.125, v )); - vec4 m1 = texture2D(smp, vec2(0.375, v )); - vec4 m2 = texture2D(smp, vec2(0.625, v )); - vec4 m3 = texture2D(smp, vec2(0.875, v )); - - return mat4(m0, m1, m2, m3); +const shaderSource = `Shader "tbnShader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + + float u_lineScale; + mat4 camera_VPMat; + mat4 u_worldMatrix; + mat4 u_worldNormal; + + ${geometryTextureDefine} + + struct Attributes { + vec3 POSITION; + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + #ifdef RENDERER_HAS_NORMAL + vec3 NORMAL; + #endif + #ifdef RENDERER_HAS_TANGENT + vec4 TANGENT; + #endif + }; + + struct Varyings { + float _placeholder; + }; + + Varyings vert(Attributes attr) { + Varyings v; + int pointIndex = gl_VertexID / 2; + ${geometryTextureVert} + + vec4 position = vec4(POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = u_worldMatrix * position; + + #if defined(SHOW_NORMAL) && defined(RENDERER_HAS_NORMAL) + if (gl_VertexID % 2 == 1) { + vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); + gl_Position.xyz += normalize(normalW) * u_lineScale; + } + #endif + + #if defined(SHOW_TANGENT) && defined(RENDERER_HAS_TANGENT) + if (gl_VertexID % 2 == 1) { + vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); + gl_Position.xyz += normalize(tangentW) * u_lineScale; + } + #endif + + #if defined(SHOW_BITANGENT) && defined(RENDERER_HAS_TANGENT) && defined(RENDERER_HAS_NORMAL) + if (gl_VertexID % 2 == 1) { + vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); + vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); + vec3 bitangentW = cross( normalW, tangentW ) * tangent.w; + gl_Position.xyz += normalize(bitangentW) * u_lineScale; + } + #endif + + gl_Position = camera_VPMat * gl_Position; + return v; + } + + vec4 material_BaseColor; + + void frag(Varyings v) { + gl_FragColor = material_BaseColor; + } } -#else - uniform mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ]; -#endif -#endif - -${geometryTextureDefine} - -void main() { - int pointIndex = gl_VertexID / 2; - ${geometryTextureVert} - - #include - #include - #include - - gl_Position = u_worldMatrix * position; - -#if defined(SHOW_NORMAL) && defined(RENDERER_HAS_NORMAL) - if (gl_VertexID % 2 == 1) { - vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); - gl_Position.xyz += normalize(normalW) * u_lineScale; - } -#endif + } +}`; -#if defined(SHOW_TANGENT) && defined(RENDERER_HAS_TANGENT) - if (gl_VertexID % 2 == 1) { - vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); - gl_Position.xyz += normalize(tangentW) * u_lineScale; - } -#endif - -#if defined(SHOW_BITANGENT) && defined(RENDERER_HAS_TANGENT) && defined(RENDERER_HAS_NORMAL) - if (gl_VertexID % 2 == 1) { - vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); - vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); - vec3 bitangentW = cross( normalW, tangentW ) * tangent.w; - gl_Position.xyz += normalize(bitangentW) * u_lineScale; - } -#endif - - gl_Position = camera_VPMat * gl_Position; -} -`, - ` -uniform vec4 material_BaseColor; -void main() { - gl_FragColor = material_BaseColor; -} -` -); +Shader.find("tbnShader") || Shader.create(shaderSource); /** * Material for normal shading diff --git a/packages/geometry-sketch/src/material/WireframeMaterial.ts b/packages/geometry-sketch/src/material/WireframeMaterial.ts index c6b25066..425845c3 100644 --- a/packages/geometry-sketch/src/material/WireframeMaterial.ts +++ b/packages/geometry-sketch/src/material/WireframeMaterial.ts @@ -1,81 +1,94 @@ import { BaseMaterial, Color, Engine, RenderFace, Shader } from "@galacean/engine"; import { geometryTextureDefine, geometryTextureVert } from "./GeometryShader"; -Shader.create( - "wireframeShader", - ` -#include - uniform float u_lineScale; - uniform mat4 camera_VPMat; - uniform mat4 u_worldMatrix; - uniform mat4 u_worldNormal; - -#ifdef RENDERER_HAS_SKIN -#ifdef RENDERER_USE_JOINT_TEXTURE - uniform sampler2D renderer_JointSampler; - uniform float renderer_JointCount; - - mat4 getJointMatrix(sampler2D smp, float index) { - float base = index / renderer_JointCount; - float hf = 0.5 / renderer_JointCount; - float v = base + hf; - - vec4 m0 = texture2D(smp, vec2(0.125, v )); - vec4 m1 = texture2D(smp, vec2(0.375, v )); - vec4 m2 = texture2D(smp, vec2(0.625, v )); - vec4 m3 = texture2D(smp, vec2(0.875, v )); - - return mat4(m0, m1, m2, m3); - } -#else - uniform mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ]; -#endif -#endif - -${geometryTextureDefine} - -varying vec3 v_baryCenter; - -void main() { - int indicesIndex = gl_VertexID / 3; - int indicesRow = indicesIndex / int(u_indicesTextureWidth); - int indicesCol = indicesIndex % int(u_indicesTextureWidth); - vec3 triangleIndices = getIndicesElement(float(indicesRow), float(indicesCol)); - int subIndex = gl_VertexID % 3; - v_baryCenter = vec3(0.0); - v_baryCenter[subIndex] = 1.0; - - int pointIndex = int(triangleIndices[subIndex]); - ${geometryTextureVert} - - #include - #include - #include - - gl_Position = u_worldMatrix * position; - gl_Position = camera_VPMat * gl_Position; -} -`, - ` -varying vec3 v_baryCenter; - -float edgeFactor(){ - vec3 d = fwidth(v_baryCenter); - vec3 a3 = smoothstep(vec3(0.0), d * 1.5, v_baryCenter); - return min(min(a3.x, a3.y), a3.z); -} +const shaderSource = `Shader "wireframeShader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + + float u_lineScale; + mat4 camera_VPMat; + mat4 u_worldMatrix; + mat4 u_worldNormal; + + ${geometryTextureDefine} + + struct Attributes { + vec3 POSITION; + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + #ifdef RENDERER_HAS_NORMAL + vec3 NORMAL; + #endif + #ifdef RENDERER_HAS_TANGENT + vec4 TANGENT; + #endif + }; + + struct Varyings { + vec3 v_baryCenter; + }; + + Varyings vert(Attributes attr) { + Varyings v; + int indicesIndex = gl_VertexID / 3; + int indicesRow = indicesIndex / int(u_indicesTextureWidth); + int indicesCol = indicesIndex % int(u_indicesTextureWidth); + vec3 triangleIndices = getIndicesElement(float(indicesRow), float(indicesCol)); + int subIndex = gl_VertexID % 3; + v.v_baryCenter = vec3(0.0); + v.v_baryCenter[subIndex] = 1.0; + + int pointIndex = int(triangleIndices[subIndex]); + ${geometryTextureVert} -uniform vec4 material_BaseColor; -void main() { - if (gl_FrontFacing) { - gl_FragColor = vec4(material_BaseColor.xyz, 1.0 - edgeFactor()); - } else { - // fade back face - gl_FragColor = vec4(material_BaseColor.xyz, (1.0 - edgeFactor()) * 0.3); + vec4 position = vec4(POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = u_worldMatrix * position; + gl_Position = camera_VPMat * gl_Position; + return v; + } + + vec4 material_BaseColor; + + float edgeFactor(vec3 baryCenter) { + vec3 d = fwidth(baryCenter); + vec3 a3 = smoothstep(vec3(0.0), d * 1.5, baryCenter); + return min(min(a3.x, a3.y), a3.z); + } + + void frag(Varyings v) { + if (gl_FrontFacing) { + gl_FragColor = vec4(material_BaseColor.xyz, 1.0 - edgeFactor(v.v_baryCenter)); + } else { + // fade back face + gl_FragColor = vec4(material_BaseColor.xyz, (1.0 - edgeFactor(v.v_baryCenter)) * 0.3); + } + } } -} -` -); + } +}`; + +Shader.find("wireframeShader") || Shader.create(shaderSource); export class WireframeMaterial extends BaseMaterial { /** diff --git a/packages/gizmo/src/icon/IconMaterial.ts b/packages/gizmo/src/icon/IconMaterial.ts index 813c9263..1a30ace9 100644 --- a/packages/gizmo/src/icon/IconMaterial.ts +++ b/packages/gizmo/src/icon/IconMaterial.ts @@ -1,5 +1,119 @@ import { BaseMaterial, Color, CullMode, Engine, Shader, Texture2D } from "@galacean/engine"; +const shaderSource = `Shader "icon" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + vec2 u_size; + vec4 u_pixelViewport; + + struct Attributes { + vec3 POSITION; + vec2 TEXCOORD_0; + #ifdef RENDERER_HAS_BLENDSHAPE + #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE + vec3 POSITION_BS0; + vec3 POSITION_BS1; + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + #else + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 POSITION_BS2; + vec3 POSITION_BS3; + #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 NORMAL_BS2; + vec3 NORMAL_BS3; + #endif + #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + vec3 TANGENT_BS2; + vec3 TANGENT_BS3; + #endif + #else + vec3 POSITION_BS2; + vec3 POSITION_BS3; + vec3 POSITION_BS4; + vec3 POSITION_BS5; + vec3 POSITION_BS6; + vec3 POSITION_BS7; + #endif + #endif + #endif + #endif + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + }; + + struct Varyings { + vec2 v_uv; + }; + + Varyings vert(Attributes attr) { + Varyings v; + + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + vec4 translation = renderer_MVPMat[3]; + translation = translation / translation.w; + float xFactor = u_size.x / u_pixelViewport.z * 2.0; + float yFactor = u_size.y / u_pixelViewport.w * 2.0; + gl_Position = vec4(translation.x + xFactor * position.x, translation.y + yFactor * position.y, translation.z, 1); + v.v_uv = attr.TEXCOORD_0; + + return v; + } + + vec4 material_BaseColor; + #ifdef MATERIAL_HAS_BASETEXTURE + sampler2D material_BaseTexture; + #endif + + void frag(Varyings v) { + vec4 baseColor = material_BaseColor; + + #ifdef MATERIAL_HAS_BASETEXTURE + vec4 textureColor = texture2D(material_BaseTexture, v.v_uv); + baseColor.a *= textureColor.a; + #endif + + #ifdef MATERIAL_IS_ALPHA_CUTOFF + if( baseColor.a < material_AlphaCutoff ) { + discard; + } + #endif + + gl_FragColor = baseColor; + } + } + } +}`; + +Shader.find("icon") || Shader.create(shaderSource); + /** * Icon Material. don't effected by light and fog. */ @@ -50,56 +164,3 @@ export class IconMaterial extends BaseMaterial { return dest; } } - -Shader.create( - "icon", - ` -#include -#include -#include -#include - -uniform vec2 u_size; -uniform vec4 u_pixelViewport; - -void main() { - #include - #include - #include - - vec4 translation = renderer_MVPMat[3]; - translation = translation / translation.w; - float xFactor = u_size.x / u_pixelViewport.z * 2.0; - float yFactor = u_size.y / u_pixelViewport.w * 2.0; - gl_Position = vec4(translation.x + xFactor * position.x, translation.y + yFactor * position.y, translation.z, 1); - v_uv = TEXCOORD_0; -} -`, - - ` -#include -#include - -uniform vec4 material_BaseColor; -#ifdef MATERIAL_HAS_BASETEXTURE - uniform sampler2D material_BaseTexture; -#endif - -void main() { - vec4 baseColor = material_BaseColor; - - #ifdef MATERIAL_HAS_BASETEXTURE - vec4 textureColor = texture2D(material_BaseTexture, v_uv); - baseColor.a *= textureColor.a; - #endif - - #ifdef MATERIAL_IS_ALPHA_CUTOFF - if( baseColor.a < material_AlphaCutoff ) { - discard; - } - #endif - - gl_FragColor = baseColor; -} -` -); diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts deleted file mode 100644 index 26c59c0d..00000000 --- a/packages/lines/src/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module "*.wasm"; diff --git a/packages/lines/src/line/material/dashShader.ts b/packages/lines/src/line/material/dashShader.ts index 3308bcf0..41353953 100644 --- a/packages/lines/src/line/material/dashShader.ts +++ b/packages/lines/src/line/material/dashShader.ts @@ -1,80 +1,80 @@ import { Shader } from "@galacean/engine"; -//-- Shader 代码 -const vertexSource = ` -attribute vec2 a_pos; -attribute vec2 a_normal; -attribute vec2 a_data; -attribute float a_lengthsofar; +const shaderSource = `Shader "dash" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; -uniform mat4 renderer_MVPMat; -uniform float u_width; -uniform vec2 u_dash; + mat4 renderer_MVPMat; + float u_width; + vec2 u_dash; -varying vec2 v_origin; -varying vec2 v_position; -varying float v_direction; -varying float v_part; -varying vec2 v_tex; + struct Attributes { + vec2 a_pos; + vec2 a_normal; + vec2 a_data; + float a_lengthsofar; + }; -void main() { - v_direction = a_data.x; - v_part = a_data.y; - float layer_index = 1.0; + struct Varyings { + vec2 v_origin; + vec2 v_position; + float v_direction; + float v_part; + vec2 v_tex; + }; + Varyings vert(Attributes attr) { + Varyings v; + v.v_direction = attr.a_data.x; + v.v_part = attr.a_data.y; + float layer_index = 1.0; - v_origin = a_pos; + v.v_origin = attr.a_pos; - float texcoord_y = 0.0; + float texcoord_y = 0.0; - texcoord_y = a_lengthsofar / (u_dash.x + u_dash.y); - if (v_direction == 1.0) { - v_tex = vec2(1.0, texcoord_y); - } else { - v_tex = vec2(0.0, texcoord_y); - } - vec2 position = a_pos + a_normal * u_width; - v_position = position; - gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); -} - `; - -const fragmentSource = ` -precision highp float; - -uniform vec4 u_color; -uniform int u_join; -uniform int u_cap; -uniform float u_width; -uniform sampler2D u_texture; + texcoord_y = attr.a_lengthsofar / (u_dash.x + u_dash.y); + if (v.v_direction == 1.0) { + v.v_tex = vec2(1.0, texcoord_y); + } else { + v.v_tex = vec2(0.0, texcoord_y); + } + vec2 position = attr.a_pos + attr.a_normal * u_width; + v.v_position = position; + gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); + return v; + } -varying vec2 v_origin; -varying vec2 v_position; -varying float v_direction; -varying float v_part; -varying vec2 v_tex; + vec4 u_color; + int u_join; + int u_cap; + sampler2D u_texture; -float IS_CAP = 0.0; + float IS_CAP = 0.0; -void main() { - vec4 finalColor; - if (u_cap == 0 && v_part == IS_CAP) { - if (distance(v_position, v_origin) > u_width) { - discard; + void frag(Varyings v) { + vec4 finalColor; + if (u_cap == 0 && v.v_part == IS_CAP) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + if (u_join == 1 && v.v_part > 1.5) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + vec4 textureColor = texture2D(u_texture, v.v_tex); + if (textureColor.a <= 0.5) { + gl_FragColor = vec4(u_color.rgb, 0.0); + } else { + gl_FragColor = u_color; + } } } - if (u_join == 1 && v_part > 1.5) { - if (distance(v_position, v_origin) > u_width) { - discard; - } - } - vec4 textureColor = texture2D(u_texture, v_tex); - if (textureColor.a <= 0.5) { - gl_FragColor = vec4(u_color.rgb, 0.0); - } else { - gl_FragColor = u_color; - } -} -`; + } +}`; -Shader.create("dash", vertexSource, fragmentSource); +Shader.find("dash") || Shader.create(shaderSource); diff --git a/packages/lines/src/line/material/lineShader.ts b/packages/lines/src/line/material/lineShader.ts index 1c928c4e..caea2ce4 100644 --- a/packages/lines/src/line/material/lineShader.ts +++ b/packages/lines/src/line/material/lineShader.ts @@ -1,62 +1,63 @@ import { Shader } from "@galacean/engine"; -//-- Shader 代码 -const vertexSource = ` -attribute vec2 a_pos; -attribute vec2 a_normal; -attribute vec2 a_data; - -uniform mat4 renderer_MVPMat; -uniform float u_width; - -varying vec2 v_origin; -varying vec2 v_position; -varying float v_direction; -varying float v_part; - -void main() { - v_direction = a_data.x; - v_part = a_data.y; - float layer_index = 1.0; - - v_origin = a_pos; - vec2 position = a_pos + a_normal * u_width; - v_position = position; - gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); -} - `; - -const fragmentSource = ` -precision highp float; - -uniform vec4 u_color; -uniform int u_join; -uniform int u_cap; -uniform float u_width; - -varying vec2 v_origin; -varying vec2 v_position; -varying float v_direction; -varying float v_part; - -float IS_CAP = 0.0; - -void main() { - vec4 finalColor; - if (u_cap == 0 && v_part == IS_CAP) { - if (distance(v_position, v_origin) > u_width) { - discard; +const shaderSource = `Shader "line" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_width; + + struct Attributes { + vec2 a_pos; + vec2 a_normal; + vec2 a_data; + }; + + struct Varyings { + vec2 v_origin; + vec2 v_position; + float v_direction; + float v_part; + }; + + Varyings vert(Attributes attr) { + Varyings v; + v.v_direction = attr.a_data.x; + v.v_part = attr.a_data.y; + float layer_index = 1.0; + + v.v_origin = attr.a_pos; + vec2 position = attr.a_pos + attr.a_normal * u_width; + v.v_position = position; + gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); + return v; } - } - if (u_join == 1 && v_part > 1.0) { - if (distance(v_position, v_origin) > u_width) { - discard; + + vec4 u_color; + int u_join; + int u_cap; + + float IS_CAP = 0.0; + + void frag(Varyings v) { + vec4 finalColor; + if (u_cap == 0 && v.v_part == IS_CAP) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + if (u_join == 1 && v.v_part > 1.0) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + + gl_FragColor = u_color; } } + } +}`; - gl_FragColor = u_color; -} - - `; - -Shader.create("line", vertexSource, fragmentSource); +Shader.find("line") || Shader.create(shaderSource); diff --git a/packages/outline/src/OutlineManager.ts b/packages/outline/src/OutlineManager.ts index e0b0ed29..53dd24d7 100644 --- a/packages/outline/src/OutlineManager.ts +++ b/packages/outline/src/OutlineManager.ts @@ -24,10 +24,199 @@ import { dependentComponents } from "@galacean/engine"; -import outlineFs from "./outline.fs.glsl"; -import outlineVs from "./outline.vs.glsl"; -import replaceFs from "./replace.fs.glsl"; -import replaceVs from "./replace.vs.glsl"; +const outlinePostprocessShaderSource = `Shader "outline-postprocess-shader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + struct Attributes { + vec3 POSITION; + vec2 TEXCOORD_0; + }; + + struct Varyings { + vec2 v_uv; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = vec4(attr.POSITION.xzy, 1.0); + v.v_uv = attr.TEXCOORD_0; + return v; + } + + #include "Common/Common.glsl" + + vec3 material_OutlineColor; + sampler2D material_OutlineTexture; + vec2 material_TexSize; + + float luminance(vec4 color) { + return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; + } + + float sobel(vec2 uv) { + // adapter to webgl 1.0 + float Gx[9]; + Gx[0] = -1.0; + Gx[1] = 0.0; + Gx[2] = 1.0; + Gx[3] = -2.0; + Gx[4] = 0.0; + Gx[5] = 2.0; + Gx[6] = -1.0; + Gx[7] = 0.0; + Gx[8] = 1.0; + + float Gy[9]; + Gy[0] = -1.0; + Gy[1] = -2.0; + Gy[2] = -1.0; + Gy[3] = 0.0; + Gy[4] = 0.0; + Gy[5] = 0.0; + Gy[6] = 1.0; + Gy[7] = 2.0; + Gy[8] = 1.0; + + float texColor; + float edgeX = 0.0; + float edgeY = 0.0; + vec2 sampleUV[9]; + + sampleUV[0] = uv + material_TexSize.xy * vec2(-1, -1); + sampleUV[1] = uv + material_TexSize.xy * vec2(0, -1); + sampleUV[2] = uv + material_TexSize.xy * vec2(1, -1); + sampleUV[3] = uv + material_TexSize.xy * vec2(-1, 0); + sampleUV[4] = uv + material_TexSize.xy * vec2(0, 0); + sampleUV[5] = uv + material_TexSize.xy * vec2(1, 0); + sampleUV[6] = uv + material_TexSize.xy * vec2(-1, 1); + sampleUV[7] = uv + material_TexSize.xy * vec2(0, 1); + sampleUV[8] = uv + material_TexSize.xy * vec2(1, 1); + + for (int i = 0; i < 9; i++) { + texColor = luminance(texture2D(material_OutlineTexture, sampleUV[i])); + edgeX += texColor * Gx[i]; + edgeY += texColor * Gy[i]; + } + + return abs(edgeX) + abs(edgeY); + } + + void frag(Varyings v) { + float sobelFactor = step(1.0, sobel(v.v_uv)); + gl_FragColor = mix(vec4(0), vec4(material_OutlineColor, 1.0), sobelFactor); + } + } + } +}`; + +const outlineReplaceShaderSource = `Shader "outline-replace-shader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + struct Attributes { + vec3 POSITION; + #ifdef RENDERER_HAS_BLENDSHAPE + #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE + vec3 POSITION_BS0; + vec3 POSITION_BS1; + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + #else + #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) + vec3 POSITION_BS2; + vec3 POSITION_BS3; + #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL + vec3 NORMAL_BS0; + vec3 NORMAL_BS1; + vec3 NORMAL_BS2; + vec3 NORMAL_BS3; + #endif + #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT + vec3 TANGENT_BS0; + vec3 TANGENT_BS1; + vec3 TANGENT_BS2; + vec3 TANGENT_BS3; + #endif + #else + vec3 POSITION_BS2; + vec3 POSITION_BS3; + vec3 POSITION_BS4; + vec3 POSITION_BS5; + vec3 POSITION_BS6; + vec3 POSITION_BS7; + #endif + #endif + #endif + #endif + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + #ifdef RENDERER_HAS_NORMAL + vec3 NORMAL; + #endif + #ifdef RENDERER_HAS_TANGENT + vec4 TANGENT; + #endif + }; + + Varyings vert(Attributes attr) { + Varyings v; + + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(attr.NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(attr.TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position + #ifdef RENDERER_HAS_NORMAL + , normal + #ifdef RENDERER_HAS_TANGENT + , tangent + #endif + #endif + ); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = renderer_MVPMat * position; + + return v; + } + + vec4 camera_OutlineReplaceColor; + + void frag(Varyings v) { + gl_FragColor = camera_OutlineReplaceColor; + } + } + } +}`; + +Shader.find("outline-postprocess-shader") || Shader.create(outlinePostprocessShaderSource); +Shader.find("outline-replace-shader") || Shader.create(outlineReplaceShaderSource); /** * Show outline of entities. @@ -323,6 +512,3 @@ export class OutlineManager extends Script { } } } - -Shader.create("outline-postprocess-shader", outlineVs, outlineFs); -Shader.create("outline-replace-shader", replaceVs, replaceFs); diff --git a/packages/outline/src/global.d.ts b/packages/outline/src/global.d.ts deleted file mode 100644 index 35e0469e..00000000 --- a/packages/outline/src/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.glsl" { - const value: string; - export default value; -} diff --git a/packages/outline/src/outline.fs.glsl b/packages/outline/src/outline.fs.glsl deleted file mode 100644 index a1a424a1..00000000 --- a/packages/outline/src/outline.fs.glsl +++ /dev/null @@ -1,76 +0,0 @@ -#include -uniform vec3 material_OutlineColor; -uniform sampler2D material_OutlineTexture; -uniform vec2 material_TexSize; -varying vec2 v_uv; - -float luminance(vec4 color) { - return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; -} - -float sobel() { - // float Gx[9] = float[]( - // -1.0, 0.0, 1.0, - // -2.0, 0.0, 2.0, - // -1.0, 0.0, 1.0); - - // float Gy[9] = float[]( - // -1.0, -2.0, -1.0, - // 0.0, 0.0, 0.0, - // 1.0, 2.0, 1.0); - - // adapter to webgl 1.0 - float Gx[9]; - Gx[0] = -1.0; - Gx[1] = 0.0; - Gx[2] = 1.0; - Gx[3] = -2.0; - Gx[4] = 0.0; - Gx[5] = 2.0; - Gx[6] = -1.0; - Gx[7] = 0.0; - Gx[8] = 1.0; - - - float Gy[9]; - Gy[0] = -1.0; - Gy[1] = -2.0; - Gy[2] = -1.0; - Gy[3] = 0.0; - Gy[4] = 0.0; - Gy[5] = 0.0; - Gy[6] = 1.0; - Gy[7] = 2.0; - Gy[8] = 1.0; - - float texColor; - float edgeX = 0.0; - float edgeY = 0.0; - vec2 uv[9]; - - uv[0] = v_uv + material_TexSize.xy * vec2(-1, -1); - uv[1] = v_uv + material_TexSize.xy * vec2(0, -1); - uv[2] = v_uv + material_TexSize.xy * vec2(1, -1); - uv[3] = v_uv + material_TexSize.xy * vec2(-1, 0); - uv[4] = v_uv + material_TexSize.xy * vec2(0, 0); - uv[5] = v_uv + material_TexSize.xy * vec2(1, 0); - uv[6] = v_uv + material_TexSize.xy * vec2(-1, 1); - uv[7] = v_uv + material_TexSize.xy * vec2(0, 1); - uv[8] = v_uv + material_TexSize.xy * vec2(1, 1); - - for (int i = 0; i < 9; i++) { - texColor = luminance(texture2D(material_OutlineTexture, uv[i])); - edgeX += texColor * Gx[i]; - edgeY += texColor * Gy[i]; - } - - return abs(edgeX) + abs(edgeY); -} - - - -void main(){ - float sobelFactor = step(1.0, sobel()); - // float sobelFactor = sobel(); - gl_FragColor = mix( vec4(0), vec4(material_OutlineColor, 1.0), sobelFactor); -} \ No newline at end of file diff --git a/packages/outline/src/outline.vs.glsl b/packages/outline/src/outline.vs.glsl deleted file mode 100644 index c5af4f21..00000000 --- a/packages/outline/src/outline.vs.glsl +++ /dev/null @@ -1,10 +0,0 @@ -attribute vec3 POSITION; -attribute vec2 TEXCOORD_0; - -varying vec2 v_uv; - -void main(){ - gl_Position = vec4( POSITION.xzy , 1.0); - v_uv = TEXCOORD_0; -} - \ No newline at end of file diff --git a/packages/outline/src/replace.fs.glsl b/packages/outline/src/replace.fs.glsl deleted file mode 100644 index 82c9e1bb..00000000 --- a/packages/outline/src/replace.fs.glsl +++ /dev/null @@ -1,6 +0,0 @@ - -uniform vec4 camera_OutlineReplaceColor; - -void main() { - gl_FragColor = camera_OutlineReplaceColor; -} \ No newline at end of file diff --git a/packages/outline/src/replace.vs.glsl b/packages/outline/src/replace.vs.glsl deleted file mode 100644 index 171946eb..00000000 --- a/packages/outline/src/replace.vs.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -void main() { - #include - #include - #include - #include - #include -} \ No newline at end of file diff --git a/packages/skeleton-viewer/src/SkeletonViewer.ts b/packages/skeleton-viewer/src/SkeletonViewer.ts index e221c2c6..f0976ab0 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.ts +++ b/packages/skeleton-viewer/src/SkeletonViewer.ts @@ -15,6 +15,45 @@ import { Vector3 } from "@galacean/engine"; +const shaderSource = `Shader "skeleton-viewer" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + mat4 renderer_NormalMat; + + struct Attributes { + vec3 POSITION; + vec3 NORMAL; + }; + + struct Varyings { + vec3 v_normal; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + v.v_normal = normalize( mat3(renderer_NormalMat) * attr.NORMAL ); + return v; + } + + vec3 u_colorMin; + vec3 u_colorMax; + + void frag(Varyings v) { + float ndl = dot(v.v_normal, vec3(0, 1, 0)) * 0.5 + 0.5; + vec3 diffuse = mix(u_colorMin, u_colorMax, ndl); + gl_FragColor = vec4(diffuse, 1.0); + } + } + } +}`; + +Shader.find("skeleton-viewer") || Shader.create(shaderSource); + /** * Skeleton visualization. * @example @@ -168,7 +207,6 @@ export class SkeletonViewer extends Script { const bone = bones[i]; const anchorPoint = bone.transform.worldPosition; - // 球 const entity = bone.createChild(); const renderer = entity.addComponent(MeshRenderer); renderer.receiveShadows = false; @@ -181,7 +219,6 @@ export class SkeletonViewer extends Script { this._debugMesh.push(renderer); - // 连接体 for (let j = 0; j < bone.children.length; j++) { const child = bone.children[j]; const childPoint = child.transform.worldPosition; @@ -225,32 +262,4 @@ export class SkeletonViewer extends Script { } } -Shader.create( - "skeleton-viewer", - ` - attribute vec3 POSITION; - attribute vec3 NORMAL; - - uniform mat4 renderer_MVPMat; - uniform mat4 renderer_NormalMat; - - varying vec3 v_normal; - - void main(){ - gl_Position = renderer_MVPMat * vec4( POSITION , 1.0 );; - v_normal = normalize( mat3(renderer_NormalMat) * NORMAL ); - }`, - ` - uniform vec3 u_colorMin; - uniform vec3 u_colorMax; - varying vec3 v_normal; - - void main(){ - float ndl = dot(v_normal, vec3(0, 1, 0)) * 0.5 + 0.5; - vec3 diffuse = mix(u_colorMin, u_colorMax, ndl); - gl_FragColor = vec4(diffuse, 1.0); - } - ` -); - const materialMap = new Map(); From 3cfeccea012056ce691c8c3d7afd14ae47fee317 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 20 Apr 2026 15:34:32 +0800 Subject: [PATCH 02/27] fix: restore type declarations and fix build errors after ShaderLab migration - Restore global.d.ts for *.shader and *.wasm module declarations - Add ts-ignore for ShaderPass single-arg constructor (engine not yet published) - Update AssetType.Texture2D to AssetType.Texture to match engine API --- packages/custom-material/src/global.d.ts | 4 ++++ .../src/planar-shadow/PlanarShadowShaderFactory.ts | 1 + packages/gizmo/src/icon/Icon.ts | 2 +- packages/lines/src/global.d.ts | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 packages/custom-material/src/global.d.ts create mode 100644 packages/lines/src/global.d.ts diff --git a/packages/custom-material/src/global.d.ts b/packages/custom-material/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/custom-material/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index 1a86b855..3d684381 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -187,6 +187,7 @@ Pass "PlanarShadow" { } `; +// @ts-ignore - ShaderPass single-arg constructor supported in engine but not yet published const planarShadow = new ShaderPass(planarShadowPassSource); if (!Shader.find("planarShadowShader")) { diff --git a/packages/gizmo/src/icon/Icon.ts b/packages/gizmo/src/icon/Icon.ts index 4f457286..2a260f4b 100644 --- a/packages/gizmo/src/icon/Icon.ts +++ b/packages/gizmo/src/icon/Icon.ts @@ -63,7 +63,7 @@ export class Icon extends Script { if (value instanceof Texture2D) { this._material.baseTexture = value; } else { - this.engine.resourceManager.load({ url: value, type: AssetType.Texture2D }).then((texture: Texture2D) => { + this.engine.resourceManager.load({ url: value, type: AssetType.Texture }).then((texture: Texture2D) => { this._material.baseTexture = texture; }); } diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts new file mode 100644 index 00000000..26c59c0d --- /dev/null +++ b/packages/lines/src/global.d.ts @@ -0,0 +1 @@ +declare module "*.wasm"; From e6f912ee621eb32e1a8fe05ba5f08cb3387b72cf Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 20 Apr 2026 15:49:17 +0800 Subject: [PATCH 03/27] =?UTF-8?q?fix:=20Shader.find("pbr")=20=E2=86=92=20"?= =?UTF-8?q?PBR",=20add=20missing=20struct=20Varyings=20declarations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PlanarShadowShaderFactory: fix lowercase "pbr" to "PBR" - PlainColorMaterial, FramebufferPicker, BoxSelectionSSMaterial: add explicit struct Varyings declaration --- packages/controls/src/box-selection/BoxSelectionSSMaterial.ts | 4 ++++ .../custom-material/src/plain-color/PlainColorMaterial.ts | 4 ++++ .../src/planar-shadow/PlanarShadowShaderFactory.ts | 2 +- packages/framebuffer-picker/src/FramebufferPicker.ts | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index 177567b3..b387a3ce 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -13,6 +13,10 @@ const shaderSource = `Shader "box" { vec3 POSITION; }; + struct Varyings { + float _placeholder; + }; + Varyings vert(Attributes attr) { Varyings v; gl_Position = vec4(attr.POSITION, 1.0); diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index b1795bae..b8506ea1 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -55,6 +55,10 @@ const shaderSource = `Shader "plain-color" { #endif }; + struct Varyings { + float _placeholder; + }; + Varyings vert(Attributes attr) { Varyings v; diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index 3d684381..3376da0f 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -191,5 +191,5 @@ Pass "PlanarShadow" { const planarShadow = new ShaderPass(planarShadowPassSource); if (!Shader.find("planarShadowShader")) { - Shader.create("planarShadowShader", [Shader.find("pbr").subShaders[0].passes[0], planarShadow]); + Shader.create("planarShadowShader", [Shader.find("PBR").subShaders[0].passes[2], planarShadow]); } diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index 1fd616d6..0c8b1eca 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -80,6 +80,10 @@ const colorShaderSource = `Shader "framebuffer-picker-color" { #endif }; + struct Varyings { + float _placeholder; + }; + Varyings vert(Attributes attr) { Varyings v; From a21f0476f2bb48a10865fb068b862b80346e7f13 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 20 Apr 2026 19:08:29 +0800 Subject: [PATCH 04/27] refactor(shader): use Common/Attributes.glsl include - Replace inline struct Attributes with #include "Common/Attributes.glsl" - Add #ifdef guards for unconditional attribute usage - Replace PBR/AttributesPBR.glsl refs in ForwardPass shaders --- .../box-selection/BoxSelectionSSMaterial.ts | 4 +- .../advanced-shader/eye/EyeForwardPass.glsl | 2 +- .../advanced-shader/hair/HairForwardPass.glsl | 2 +- .../advanced-shader/sss/SSSForwardPass.glsl | 2 +- .../src/plain-color/PlainColorMaterial.ts | 44 +------------- .../src/water/WaterMaterial.ts | 16 ++--- .../src/water/WaterRippleMaterial.ts | 16 ++--- .../src/water/WaterfallMaterial.ts | 18 +++--- .../src/FramebufferPicker.ts | 50 +--------------- .../src/material/TBNMaterial.ts | 14 +---- .../src/material/WireframeMaterial.ts | 14 +---- packages/gizmo/src/icon/IconMaterial.ts | 49 ++------------- packages/outline/src/OutlineManager.ts | 59 ++----------------- .../skeleton-viewer/src/SkeletonViewer.ts | 9 ++- 14 files changed, 46 insertions(+), 253 deletions(-) diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index b387a3ce..5093d0d3 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -9,9 +9,7 @@ const shaderSource = `Shader "box" { #include "Common/Common.glsl" #include "Common/Transform.glsl" - struct Attributes { - vec3 POSITION; - }; + #include "Common/Attributes.glsl" struct Varyings { float _placeholder; diff --git a/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl b/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl index 641ad3f9..fe4e4d94 100644 --- a/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl @@ -4,7 +4,7 @@ #include "Common/Common.glsl" #include "Common/Fog.glsl" -#include "PBR/AttributesPBR.glsl" +#include "Common/Attributes.glsl" #include "PBR/VaryingsPBR.glsl" #include "PBR/LightDirectPBR.glsl" #include "PBR/LightIndirectPBR.glsl" diff --git a/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl b/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl index d594f7c2..f15f2d40 100644 --- a/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl @@ -4,7 +4,7 @@ #include "Common/Common.glsl" #include "Common/Fog.glsl" -#include "PBR/AttributesPBR.glsl" +#include "Common/Attributes.glsl" #include "PBR/VaryingsPBR.glsl" #include "./HairLightDirect.glsl" #include "PBR/LightIndirectPBR.glsl" diff --git a/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl b/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl index 2024ed66..5a46b437 100644 --- a/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl @@ -4,7 +4,7 @@ #include "Common/Common.glsl" #include "Common/Fog.glsl" -#include "PBR/AttributesPBR.glsl" +#include "Common/Attributes.glsl" #include "PBR/VaryingsPBR.glsl" #include "./SSSLightDirect.glsl" #include "PBR/LightIndirectPBR.glsl" diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index b8506ea1..dff398e8 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -11,49 +11,7 @@ const shaderSource = `Shader "plain-color" { #include "Skin/Skin.glsl" #include "Skin/BlendShape.glsl" - struct Attributes { - vec3 POSITION; - #ifdef RENDERER_HAS_BLENDSHAPE - #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE - vec3 POSITION_BS0; - vec3 POSITION_BS1; - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - #else - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 POSITION_BS2; - vec3 POSITION_BS3; - #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 NORMAL_BS2; - vec3 NORMAL_BS3; - #endif - #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - vec3 TANGENT_BS2; - vec3 TANGENT_BS3; - #endif - #else - vec3 POSITION_BS2; - vec3 POSITION_BS3; - vec3 POSITION_BS4; - vec3 POSITION_BS5; - vec3 POSITION_BS6; - vec3 POSITION_BS7; - #endif - #endif - #endif - #endif - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - }; + #include "Common/Attributes.glsl" struct Varyings { float _placeholder; diff --git a/packages/custom-material/src/water/WaterMaterial.ts b/packages/custom-material/src/water/WaterMaterial.ts index 4827c149..ccda73d1 100644 --- a/packages/custom-material/src/water/WaterMaterial.ts +++ b/packages/custom-material/src/water/WaterMaterial.ts @@ -11,11 +11,7 @@ const shaderSource = `Shader "water" { vec2 u_water_speed; vec2 u_distorsion_speed; - struct Attributes { - vec3 POSITION; - vec2 TEXCOORD_0; - vec4 COLOR_0; - }; + #include "Common/Attributes.glsl" struct Varyings { vec4 v_color; @@ -27,10 +23,14 @@ const shaderSource = `Shader "water" { Varyings v; gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * sin(u_time), u_water_speed.y * cos(u_time)); - v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #ifdef RENDERER_HAS_UV + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * sin(u_time), u_water_speed.y * cos(u_time)); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #endif - v.v_color = attr.COLOR_0; + #ifdef RENDERER_ENABLE_VERTEXCOLOR + v.v_color = attr.COLOR_0; + #endif return v; } diff --git a/packages/custom-material/src/water/WaterRippleMaterial.ts b/packages/custom-material/src/water/WaterRippleMaterial.ts index b4047e4d..20cc254d 100644 --- a/packages/custom-material/src/water/WaterRippleMaterial.ts +++ b/packages/custom-material/src/water/WaterRippleMaterial.ts @@ -11,11 +11,7 @@ const shaderSource = `Shader "water-ripple" { vec2 u_foam_speed; vec2 u_distorsion_speed; - struct Attributes { - vec3 POSITION; - vec2 TEXCOORD_0; - vec4 COLOR_0; - }; + #include "Common/Attributes.glsl" struct Varyings { vec2 waterTexCoords; @@ -26,9 +22,13 @@ const shaderSource = `Shader "water-ripple" { Varyings vert(Attributes attr) { Varyings v; gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_foam_speed.x * u_time, u_foam_speed.y * u_time); - v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - v.v_color = attr.COLOR_0; + #ifdef RENDERER_HAS_UV + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_foam_speed.x * u_time, u_foam_speed.y * u_time); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #endif + #ifdef RENDERER_ENABLE_VERTEXCOLOR + v.v_color = attr.COLOR_0; + #endif return v; } diff --git a/packages/custom-material/src/water/WaterfallMaterial.ts b/packages/custom-material/src/water/WaterfallMaterial.ts index 5db7229f..9cfd705a 100644 --- a/packages/custom-material/src/water/WaterfallMaterial.ts +++ b/packages/custom-material/src/water/WaterfallMaterial.ts @@ -12,11 +12,7 @@ const shaderSource = `Shader "water-fall" { vec2 u_waterfall_speed; vec2 u_distorsion_speed; - struct Attributes { - vec3 POSITION; - vec2 TEXCOORD_0; - vec4 COLOR_0; - }; + #include "Common/Attributes.glsl" struct Varyings { vec2 waterTexCoords; @@ -29,11 +25,15 @@ const shaderSource = `Shader "water-fall" { Varyings v; gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * u_time, u_water_speed.y * u_time); - v.waterfallTexCoords = attr.TEXCOORD_0 + vec2(u_waterfall_speed.x * u_time, u_waterfall_speed.y * u_time); - v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #ifdef RENDERER_HAS_UV + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * u_time, u_water_speed.y * u_time); + v.waterfallTexCoords = attr.TEXCOORD_0 + vec2(u_waterfall_speed.x * u_time, u_waterfall_speed.y * u_time); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #endif - v.v_color = attr.COLOR_0; + #ifdef RENDERER_ENABLE_VERTEXCOLOR + v.v_color = attr.COLOR_0; + #endif return v; } diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index 0c8b1eca..a70b4875 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -30,55 +30,7 @@ const colorShaderSource = `Shader "framebuffer-picker-color" { #include "Skin/Skin.glsl" #include "Skin/BlendShape.glsl" - struct Attributes { - vec3 POSITION; - #ifdef RENDERER_HAS_BLENDSHAPE - #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE - vec3 POSITION_BS0; - vec3 POSITION_BS1; - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - #else - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 POSITION_BS2; - vec3 POSITION_BS3; - #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 NORMAL_BS2; - vec3 NORMAL_BS3; - #endif - #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - vec3 TANGENT_BS2; - vec3 TANGENT_BS3; - #endif - #else - vec3 POSITION_BS2; - vec3 POSITION_BS3; - vec3 POSITION_BS4; - vec3 POSITION_BS5; - vec3 POSITION_BS6; - vec3 POSITION_BS7; - #endif - #endif - #endif - #endif - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - #ifdef RENDERER_HAS_NORMAL - vec3 NORMAL; - #endif - #ifdef RENDERER_HAS_TANGENT - vec4 TANGENT; - #endif - }; + #include "Common/Attributes.glsl" struct Varyings { float _placeholder; diff --git a/packages/geometry-sketch/src/material/TBNMaterial.ts b/packages/geometry-sketch/src/material/TBNMaterial.ts index 89fd3dcb..68c4724b 100644 --- a/packages/geometry-sketch/src/material/TBNMaterial.ts +++ b/packages/geometry-sketch/src/material/TBNMaterial.ts @@ -18,19 +18,7 @@ const shaderSource = `Shader "tbnShader" { ${geometryTextureDefine} - struct Attributes { - vec3 POSITION; - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - #ifdef RENDERER_HAS_NORMAL - vec3 NORMAL; - #endif - #ifdef RENDERER_HAS_TANGENT - vec4 TANGENT; - #endif - }; + #include "Common/Attributes.glsl" struct Varyings { float _placeholder; diff --git a/packages/geometry-sketch/src/material/WireframeMaterial.ts b/packages/geometry-sketch/src/material/WireframeMaterial.ts index 425845c3..70ceb5dc 100644 --- a/packages/geometry-sketch/src/material/WireframeMaterial.ts +++ b/packages/geometry-sketch/src/material/WireframeMaterial.ts @@ -18,19 +18,7 @@ const shaderSource = `Shader "wireframeShader" { ${geometryTextureDefine} - struct Attributes { - vec3 POSITION; - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - #ifdef RENDERER_HAS_NORMAL - vec3 NORMAL; - #endif - #ifdef RENDERER_HAS_TANGENT - vec4 TANGENT; - #endif - }; + #include "Common/Attributes.glsl" struct Varyings { vec3 v_baryCenter; diff --git a/packages/gizmo/src/icon/IconMaterial.ts b/packages/gizmo/src/icon/IconMaterial.ts index 1a30ace9..a1daaeb9 100644 --- a/packages/gizmo/src/icon/IconMaterial.ts +++ b/packages/gizmo/src/icon/IconMaterial.ts @@ -14,50 +14,7 @@ const shaderSource = `Shader "icon" { vec2 u_size; vec4 u_pixelViewport; - struct Attributes { - vec3 POSITION; - vec2 TEXCOORD_0; - #ifdef RENDERER_HAS_BLENDSHAPE - #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE - vec3 POSITION_BS0; - vec3 POSITION_BS1; - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - #else - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 POSITION_BS2; - vec3 POSITION_BS3; - #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 NORMAL_BS2; - vec3 NORMAL_BS3; - #endif - #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - vec3 TANGENT_BS2; - vec3 TANGENT_BS3; - #endif - #else - vec3 POSITION_BS2; - vec3 POSITION_BS3; - vec3 POSITION_BS4; - vec3 POSITION_BS5; - vec3 POSITION_BS6; - vec3 POSITION_BS7; - #endif - #endif - #endif - #endif - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - }; + #include "Common/Attributes.glsl" struct Varyings { vec2 v_uv; @@ -82,7 +39,9 @@ const shaderSource = `Shader "icon" { float xFactor = u_size.x / u_pixelViewport.z * 2.0; float yFactor = u_size.y / u_pixelViewport.w * 2.0; gl_Position = vec4(translation.x + xFactor * position.x, translation.y + yFactor * position.y, translation.z, 1); - v.v_uv = attr.TEXCOORD_0; + #ifdef RENDERER_HAS_UV + v.v_uv = attr.TEXCOORD_0; + #endif return v; } diff --git a/packages/outline/src/OutlineManager.ts b/packages/outline/src/OutlineManager.ts index 53dd24d7..0d47591c 100644 --- a/packages/outline/src/OutlineManager.ts +++ b/packages/outline/src/OutlineManager.ts @@ -30,10 +30,7 @@ const outlinePostprocessShaderSource = `Shader "outline-postprocess-shader" { VertexShader = vert; FragmentShader = frag; - struct Attributes { - vec3 POSITION; - vec2 TEXCOORD_0; - }; + #include "Common/Attributes.glsl" struct Varyings { vec2 v_uv; @@ -42,7 +39,9 @@ const outlinePostprocessShaderSource = `Shader "outline-postprocess-shader" { Varyings vert(Attributes attr) { Varyings v; gl_Position = vec4(attr.POSITION.xzy, 1.0); - v.v_uv = attr.TEXCOORD_0; + #ifdef RENDERER_HAS_UV + v.v_uv = attr.TEXCOORD_0; + #endif return v; } @@ -123,55 +122,7 @@ const outlineReplaceShaderSource = `Shader "outline-replace-shader" { #include "Skin/Skin.glsl" #include "Skin/BlendShape.glsl" - struct Attributes { - vec3 POSITION; - #ifdef RENDERER_HAS_BLENDSHAPE - #ifndef RENDERER_BLENDSHAPE_USE_TEXTURE - vec3 POSITION_BS0; - vec3 POSITION_BS1; - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - #else - #if defined(RENDERER_BLENDSHAPE_HAS_NORMAL) || defined(RENDERER_BLENDSHAPE_HAS_TANGENT) - vec3 POSITION_BS2; - vec3 POSITION_BS3; - #ifdef RENDERER_BLENDSHAPE_HAS_NORMAL - vec3 NORMAL_BS0; - vec3 NORMAL_BS1; - vec3 NORMAL_BS2; - vec3 NORMAL_BS3; - #endif - #ifdef RENDERER_BLENDSHAPE_HAS_TANGENT - vec3 TANGENT_BS0; - vec3 TANGENT_BS1; - vec3 TANGENT_BS2; - vec3 TANGENT_BS3; - #endif - #else - vec3 POSITION_BS2; - vec3 POSITION_BS3; - vec3 POSITION_BS4; - vec3 POSITION_BS5; - vec3 POSITION_BS6; - vec3 POSITION_BS7; - #endif - #endif - #endif - #endif - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - #ifdef RENDERER_HAS_NORMAL - vec3 NORMAL; - #endif - #ifdef RENDERER_HAS_TANGENT - vec4 TANGENT; - #endif - }; + #include "Common/Attributes.glsl" Varyings vert(Attributes attr) { Varyings v; diff --git a/packages/skeleton-viewer/src/SkeletonViewer.ts b/packages/skeleton-viewer/src/SkeletonViewer.ts index f0976ab0..36c06c90 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.ts +++ b/packages/skeleton-viewer/src/SkeletonViewer.ts @@ -24,10 +24,7 @@ const shaderSource = `Shader "skeleton-viewer" { mat4 renderer_MVPMat; mat4 renderer_NormalMat; - struct Attributes { - vec3 POSITION; - vec3 NORMAL; - }; + #include "Common/Attributes.glsl" struct Varyings { vec3 v_normal; @@ -36,7 +33,9 @@ const shaderSource = `Shader "skeleton-viewer" { Varyings vert(Attributes attr) { Varyings v; gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - v.v_normal = normalize( mat3(renderer_NormalMat) * attr.NORMAL ); + #ifdef RENDERER_HAS_NORMAL + v.v_normal = normalize( mat3(renderer_NormalMat) * attr.NORMAL ); + #endif return v; } From 18253f4c581fcd64494d701e15a71eee2ed7c82d Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 20 Apr 2026 19:55:15 +0800 Subject: [PATCH 05/27] refactor(shader): remove Varyings placeholder structs - Use void vert/frag signature for shaders without varyings - Affected: TBNMaterial, WireframeMaterial, FramebufferPicker, PlainColorMaterial, BoxSelectionSSMaterial --- .../src/box-selection/BoxSelectionSSMaterial.ts | 10 ++-------- .../src/plain-color/PlainColorMaterial.ts | 12 ++---------- packages/framebuffer-picker/src/FramebufferPicker.ts | 12 ++---------- packages/geometry-sketch/src/material/TBNMaterial.ts | 10 ++-------- 4 files changed, 8 insertions(+), 36 deletions(-) diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index 5093d0d3..66897059 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -11,14 +11,8 @@ const shaderSource = `Shader "box" { #include "Common/Attributes.glsl" - struct Varyings { - float _placeholder; - }; - - Varyings vert(Attributes attr) { - Varyings v; + void vert(Attributes attr) { gl_Position = vec4(attr.POSITION, 1.0); - return v; } vec2 u_min; @@ -27,7 +21,7 @@ const shaderSource = `Shader "box" { vec4 u_borderColor; float u_width; - void frag(Varyings v) { + void frag() { float vColor = step(u_min.x + u_width, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x - u_width) * step(u_min.y + u_width, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y - u_width); float vBorder = step(u_min.x, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x) * step(u_min.y, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y); gl_FragColor = u_boxColor * vColor + (1. - vColor) * vBorder * u_borderColor; diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index dff398e8..ad5937e4 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -13,13 +13,7 @@ const shaderSource = `Shader "plain-color" { #include "Common/Attributes.glsl" - struct Varyings { - float _placeholder; - }; - - Varyings vert(Attributes attr) { - Varyings v; - + void vert(Attributes attr) { vec4 position = vec4(attr.POSITION, 1.0); #ifdef RENDERER_HAS_BLENDSHAPE @@ -32,13 +26,11 @@ const shaderSource = `Shader "plain-color" { #endif gl_Position = renderer_MVPMat * position; - - return v; } vec4 material_BaseColor; - void frag(Varyings v) { + void frag() { vec4 baseColor = material_BaseColor; #ifdef MATERIAL_IS_ALPHA_CUTOFF diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index a70b4875..328dd4fa 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -32,13 +32,7 @@ const colorShaderSource = `Shader "framebuffer-picker-color" { #include "Common/Attributes.glsl" - struct Varyings { - float _placeholder; - }; - - Varyings vert(Attributes attr) { - Varyings v; - + void vert(Attributes attr) { vec4 position = vec4(attr.POSITION, 1.0); #ifdef RENDERER_HAS_NORMAL @@ -65,13 +59,11 @@ const colorShaderSource = `Shader "framebuffer-picker-color" { #endif gl_Position = renderer_MVPMat * position; - - return v; } vec3 u_pickColor; - void frag(Varyings v) { + void frag() { gl_FragColor = vec4(u_pickColor, 1.0); } } diff --git a/packages/geometry-sketch/src/material/TBNMaterial.ts b/packages/geometry-sketch/src/material/TBNMaterial.ts index 68c4724b..def99cbe 100644 --- a/packages/geometry-sketch/src/material/TBNMaterial.ts +++ b/packages/geometry-sketch/src/material/TBNMaterial.ts @@ -20,12 +20,7 @@ const shaderSource = `Shader "tbnShader" { #include "Common/Attributes.glsl" - struct Varyings { - float _placeholder; - }; - - Varyings vert(Attributes attr) { - Varyings v; + void vert(Attributes attr) { int pointIndex = gl_VertexID / 2; ${geometryTextureVert} @@ -69,12 +64,11 @@ const shaderSource = `Shader "tbnShader" { #endif gl_Position = camera_VPMat * gl_Position; - return v; } vec4 material_BaseColor; - void frag(Varyings v) { + void frag() { gl_FragColor = material_BaseColor; } } From 842e555d89c9ba09ef95c697c83096cfd61972a3 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 28 Apr 2026 15:17:08 +0800 Subject: [PATCH 06/27] build: migrate to @galacean/engine-shader-compiler bundler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the custom rollup-plugin-glslify + rollup-plugin-string pair with the unified `shaderCompiler({ precompile })` plugin from `@galacean/engine-shader-compiler/bundler`. Build now produces precompiled `.gsp` artifacts under `packages/custom-material/libs/` (Eye, Hair, SSS, Grid, PlanarShadow), mirroring the engine repo's shader build flow. ShaderLab syntax fixes uncovered by the strict precompile pass: - `struct Foo { ... }` requires a trailing semicolon - Render state blocks need `=` (`DepthState = { ... }`, `StencilState = { ... }`) - `RenderQueueType = RenderQueueType.Transparent` → `RenderQueueType = Transparent` - PlanarShadow vert function: add missing `return o;` and move `VertexShader=`/`FragmentShader=` declarations to top-of-pass Rename `Eye.gs`/`Hair.gs`/`SSS.gs` to `.shader` so the new bundler picks them up. Drop `rollup-plugin-glslify` and `rollup-plugin-string` from devDeps. --- package.json | 3 +-- .../libs/advanced-shader/eye/Eye.gsp | 1 + .../libs/advanced-shader/hair/Hair.gsp | 1 + .../libs/advanced-shader/sss/SSS.gsp | 1 + packages/custom-material/libs/grid/Grid.gsp | 1 + packages/custom-material/libs/index.ts | 14 ++++++++++++++ .../libs/planar-shadow/PlanarShadow.gsp | 1 + .../eye/{Eye.gs => Eye.shader} | 0 .../hair/{Hair.gs => Hair.shader} | 0 .../sss/{SSS.gs => SSS.shader} | 0 packages/custom-material/src/grid/Grid.shader | 4 ++-- .../src/planar-shadow/PlanarShadow.shader | 19 ++++++++++--------- rollup.config.mjs | 12 ++++++------ 13 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 packages/custom-material/libs/advanced-shader/eye/Eye.gsp create mode 100644 packages/custom-material/libs/advanced-shader/hair/Hair.gsp create mode 100644 packages/custom-material/libs/advanced-shader/sss/SSS.gsp create mode 100644 packages/custom-material/libs/grid/Grid.gsp create mode 100644 packages/custom-material/libs/index.ts create mode 100644 packages/custom-material/libs/planar-shadow/PlanarShadow.gsp rename packages/custom-material/src/advanced-shader/eye/{Eye.gs => Eye.shader} (100%) rename packages/custom-material/src/advanced-shader/hair/{Hair.gs => Hair.shader} (100%) rename packages/custom-material/src/advanced-shader/sss/{SSS.gs => SSS.shader} (100%) diff --git a/package.json b/package.json index 4f4eaba9..860f1664 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "release": "bumpp -r" }, "devDependencies": { + "@galacean/engine-shader-compiler": ">=2.0.0-0", "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", "@rollup/plugin-commonjs": "^25.0.0", @@ -53,10 +54,8 @@ "prettier": "^2.7.1", "rollup": "^3", "rollup-plugin-binary2base64": "1.0.3", - "rollup-plugin-glslify": "^1.3.1", "rollup-plugin-license": "^3.6.0", "rollup-plugin-modify": "^3.0.0", - "rollup-plugin-string": "^3.0.0", "rollup-plugin-swc3": "^0.8.0", "ts-node": "^10", "typescript": "^4.8.3" diff --git a/packages/custom-material/libs/advanced-shader/eye/Eye.gsp b/packages/custom-material/libs/advanced-shader/eye/Eye.gsp new file mode 100644 index 00000000..7c94f077 --- /dev/null +++ b/packages/custom-material/libs/advanced-shader/eye/Eye.gsp @@ -0,0 +1 @@ +{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",539],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",35],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",29],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,33],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",45],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,43],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",103],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",77],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",75],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},57],[0,"\n"],[5,73],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},69],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",63],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",67],[0,"\n"],[6],[0,"\n"],[5,71],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",81],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",85],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",89],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",93],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",97],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",101],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",133],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",111],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",115],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,119],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",127],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",125],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},131],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",287],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",143],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",149],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",155],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",161],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",167],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",225],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",181],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",179],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},191],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",195],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",199],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",203],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",207],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",211],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",215],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",219],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",223],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",267],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",233],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",241],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",239],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",249],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",247],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",257],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",255],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",261],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",265],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",273],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",277],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",281],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",285],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",323],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",297],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",303],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",309],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",315],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",321],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",385],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,331],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",339],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",337],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",347],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",345],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",359],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",357],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",355],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",371],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},369],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",367],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},379],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",377],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,383],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",493],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",395],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",399],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",403],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",419],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",409],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",413],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",417],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",427],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",425],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",439],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",433],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",437],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",451],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",445],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",449],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",467],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",457],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",465],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",463],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",471],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",475],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",479],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",483],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",487],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",491],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",497],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",501],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",505],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",509],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",513],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",517],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",521],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,525],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",533],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",531],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},537],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",744],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",39],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",27],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",33],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,37],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",59],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,57],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,49],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",2,52],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",3,55],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",65],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",95],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",73],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",77],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,81],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",89],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",87],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},93],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",331],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",105],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",111],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",117],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",123],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",129],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",221],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",143],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",141],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},153],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",157],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",161],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",165],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",169],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",173],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",177],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",181],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",185],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",189],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",193],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",197],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",201],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,203],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",207],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",211],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",215],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",219],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",269],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",229],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",233],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,235],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",243],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",241],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",251],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",249],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",259],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",257],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",263],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",267],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",283],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",277],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",281],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",287],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",291],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",295],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",309],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",301],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,303],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",307],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",319],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",315],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,317],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",329],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",325],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,327],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",407],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",341],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",347],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",353],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",359],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",391],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",367],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,369],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",373],[0," return vec3 ( 0 ) ; \n"],[5,385],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",377],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,379],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",383],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},389],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",395],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,397],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",401],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",405],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",413],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",664],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",429],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",425],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,427],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",433],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",437],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",453],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",443],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",447],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",451],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",461],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",459],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",473],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",467],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",471],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",485],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",479],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",483],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",501],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",491],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",499],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",497],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",505],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",509],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",513],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",517],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",521],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",525],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",529],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",533],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",537],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",541],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",545],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",549],[0," surfaceData.opacity = baseColor.a ; \n"],[5,551],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",555],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,557],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",561],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,566],[1,"HAS_DERIVATIVES",564],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,566],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",580],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},572],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,574],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",578],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",584],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",588],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",606],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",594],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,596],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",600],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",604],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",614],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",612],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",628],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",620],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,622],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",626],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",640],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",634],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",638],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",656],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",646],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",654],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",652],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",660],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,662],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",668],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",672],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",676],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",680],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",684],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",688],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,690],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",694],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,696],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",700],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",704],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,706],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",710],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,712],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",716],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,718],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},722],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",726],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,728],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},738],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,734],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,736],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, brdfData, totalDiffuseColor, totalSpecularColor) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,742],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/hair/Hair.gsp b/packages/custom-material/libs/advanced-shader/hair/Hair.gsp new file mode 100644 index 00000000..80d52b29 --- /dev/null +++ b/packages/custom-material/libs/advanced-shader/hair/Hair.gsp @@ -0,0 +1 @@ +{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",587],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",35],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",29],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,33],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",45],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,43],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",103],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",77],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",75],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},57],[0,"\n"],[5,73],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},69],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",63],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",67],[0,"\n"],[6],[0,"\n"],[5,71],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",81],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",85],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",89],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",93],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",97],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",101],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",133],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",111],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",115],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,119],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",127],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",125],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},131],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",193],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",149],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",147],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},159],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",163],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",167],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",171],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",179],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",187],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",191],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",197],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",351],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",207],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",213],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",219],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",225],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",231],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",289],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",245],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",243],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},255],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",259],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",263],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",267],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",271],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",275],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",279],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",283],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",287],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",331],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",297],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",305],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",303],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",313],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",311],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",321],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",319],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",325],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",329],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",337],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",341],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",345],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",349],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",387],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",361],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",367],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",373],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",379],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",385],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",453],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,395],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",403],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",401],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",407],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",415],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",413],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",427],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",425],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",423],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",439],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},437],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",435],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},447],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",445],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,451],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",561],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",463],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",467],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",471],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",487],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",477],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",481],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",485],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",495],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",493],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",507],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",501],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",505],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",519],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",513],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",517],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",535],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",525],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",533],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",531],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",539],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",543],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",547],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",551],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",555],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",559],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",565],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",569],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,573],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",581],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",579],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},585],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",788],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",39],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",27],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",33],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,37],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",59],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,57],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,49],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",2,52],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",3,55],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",65],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",95],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",73],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",77],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,81],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",89],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",87],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},93],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",189],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",111],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",109],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},121],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",125],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",129],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",133],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",137],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",141],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",145],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",149],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",153],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",157],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",161],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",165],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",169],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,171],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",179],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",187],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float material_HairFirstWidth;\nuniform float material_HairSecondWidth;\nuniform float material_HairFirstStrength;\nuniform float material_HairSecondStrength;\nuniform float material_HairFirstOffset;\nuniform float material_HairSecondOffset;\nuniform vec4 material_HairFirstColor;\nuniform vec4 material_HairSecondColor;\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",193],[0,"\nuniform sampler2D material_HairAnisotropyTexture;\n\n"],[6],[0,"\nvec3 shiftTangent ( vec3 tangent, vec3 normal, float shift ) { return ( normalize ( tangent + normal * shift ) ) ; }\nfloat anisotropySpecular ( SurfaceData surfaceData, vec3 light, float width, float strength, vec3 shiftedTangent ) { vec3 v = surfaceData.viewDir ;\nvec3 H = normalize ( light + v ) ;\nfloat dotTH = dot ( shiftedTangent , H ) ;\nfloat sinTH = sqrt ( 1.0 - dotTH * dotTH ) ;\nfloat dirAtten = smoothstep ( - 1.0 , 0.0 , dotTH ) ;\nreturn dirAtten * pow ( sinTH , width ) * strength ; }\nvoid specularLobehair ( SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { vec3 worldtangentDir = surfaceData.tangent ;\nvec3 worldbitangentDir = surfaceData.bitangent ;\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",197],[0," float shift = texture2D ( material_HairAnisotropyTexture , uv ).r - 0.5 ; \n"],[5,199],[0," float shift = 1.0 ; \n"],[6],[0,"\nvec3 shiftTangent1 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairFirstOffset) ;\nvec3 shiftTangent2 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairSecondOffset) ;\nvec3 firstcol = material_HairFirstColor.rgb ;\nvec3 firstSpecular = firstcol * anisotropySpecular(surfaceData, incidentDirection, material_HairFirstWidth * 15.0, material_HairFirstStrength, shiftTangent1) ;\nvec3 secondcol = material_HairSecondColor.rgb ;\nvec3 secondSpecular = secondcol * anisotropySpecular(surfaceData, incidentDirection, material_HairSecondWidth * 15.0, material_HairSecondStrength, shiftTangent2) ;\nvec3 hairSpecular = clamp ( firstSpecular + secondSpecular , 0.0 , 1.0 ) ;\nspecularColor += attenuationIrradiance * hairSpecular ; }\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",435],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",209],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",215],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",221],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",227],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",233],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",325],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",247],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",245],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},257],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",261],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",265],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",269],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",273],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",277],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",281],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",285],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",289],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",293],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",297],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",301],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",305],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,307],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",311],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",315],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",319],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",323],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",373],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",333],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",337],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,339],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",347],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",345],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",355],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",353],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",363],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",361],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",367],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",371],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",387],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",381],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",385],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",391],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",395],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",399],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",413],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",405],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,407],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",411],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",423],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",419],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,421],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",433],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",429],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,431],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",511],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",445],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",451],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",457],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",463],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",495],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",471],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,473],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",477],[0," return vec3 ( 0 ) ; \n"],[5,489],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",481],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,483],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",487],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},493],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",499],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,501],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",505],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",509],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",517],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",768],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",533],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",529],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,531],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",537],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",541],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",557],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",547],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",551],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",555],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",565],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",563],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",577],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",571],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",575],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",589],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",583],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",587],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",605],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",595],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",603],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",601],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",609],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",613],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",617],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",621],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",625],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",629],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",633],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",637],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",641],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",645],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",649],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",653],[0," surfaceData.opacity = baseColor.a ; \n"],[5,655],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",659],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,661],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",665],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,670],[1,"HAS_DERIVATIVES",668],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,670],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",684],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},676],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,678],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",682],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",688],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",692],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",710],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",698],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,700],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",704],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",708],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",718],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",716],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",732],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",724],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,726],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",730],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",744],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",738],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",742],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",760],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",750],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",758],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",756],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",764],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,766],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},772],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},782],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,778],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,780],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, brdfData, totalDiffuseColor, totalSpecularColor) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,786],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/sss/SSS.gsp b/packages/custom-material/libs/advanced-shader/sss/SSS.gsp new file mode 100644 index 00000000..60c9e902 --- /dev/null +++ b/packages/custom-material/libs/advanced-shader/sss/SSS.gsp @@ -0,0 +1 @@ +{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",593],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",35],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",29],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,33],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",45],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,43],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",103],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",77],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",75],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},57],[0,"\n"],[5,73],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},69],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",63],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",67],[0,"\n"],[6],[0,"\n"],[5,71],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",81],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",85],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",89],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",93],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",97],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",101],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",133],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",111],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",115],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,119],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",127],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",125],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},131],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",193],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",149],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",147],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},159],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",163],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",167],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",171],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",179],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",187],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",191],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",199],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",203],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",357],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",213],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",219],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",225],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",231],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",237],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",295],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",251],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",249],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},261],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",265],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",269],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",273],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",277],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",281],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",285],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",289],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",293],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",337],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",303],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",311],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",309],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",319],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",317],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",327],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",325],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",331],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",335],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",343],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",347],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",351],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",355],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",393],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",367],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",373],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",379],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",385],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",391],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",459],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,401],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",409],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",407],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",413],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",421],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",419],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",433],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",431],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",429],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",445],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},443],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",441],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},453],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",451],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,457],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",567],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",469],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",473],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",477],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",493],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",483],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",487],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",491],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",501],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",499],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",513],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",507],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",511],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",525],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",519],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",523],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",541],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",531],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",539],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",537],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",545],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",549],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",553],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",557],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",561],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",565],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",571],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",575],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,579],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",587],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",585],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},591],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",802],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",39],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",27],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",33],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,37],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",59],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,57],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,49],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",2,52],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",3,55],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",65],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",95],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",73],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",77],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,81],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",89],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",87],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},93],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",189],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",111],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",109],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},121],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",125],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",129],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",133],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",137],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",141],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",145],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",149],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",153],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",157],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",161],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",165],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",169],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,171],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",179],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",187],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",203],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",197],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",201],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nuniform vec4 material_SkinScatterAmount;\nuniform float material_CurvaturePower;\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",207],[0,"\nuniform sampler2D material_CurvatureTexture;\n\n"],[6],[0,"\nstruct FsphericalGaussian { vec3 Axis ; vec3 Sharpness ; vec3 Amplitude ; } ;\nvec3 dotCosineLobe ( FsphericalGaussian G, vec3 N ) { float muDotN = dot ( G.Axis , N ) ;\nconst vec3 c0 = vec3 ( 0.36 ) ;\nconst vec3 c1 = vec3 ( 0.25 / c0 ) ;\nvec3 eml = exp ( - G.Sharpness ) ;\nvec3 em2l = eml * eml ;\nvec3 rl = 1.0 / G.Sharpness ;\nvec3 scale = 1.0 + 2.0 * em2l - rl ;\nvec3 bias = ( eml - em2l ) * rl - em2l ;\nvec3 x = sqrt ( vec3 ( 1.0 ) - scale ) ;\nvec3 x0 = c0 * muDotN ;\nvec3 x1 = c1 * x ;\nvec3 n = x0 + x1 ;\nvec3 y ;\nif ( all ( lessThanEqual ( abs ( x0 ) , x1 ) ) ) { y = ( n * n ) / x ; } else { y = clamp ( vec3 ( muDotN ) , vec3 ( 0.0 ) , vec3 ( 1.0 ) ) ; }\nreturn scale * y + bias ; }\nFsphericalGaussian makeNormalizedSG ( vec3 lightdir, vec3 sharpness ) { FsphericalGaussian sg ;\nsg.Axis = lightdir ;\nsg.Sharpness = sharpness ;\nsg.Amplitude = sg.Sharpness / ( ( 2.0 * PI ) * ( 1.0 - exp ( - 2.0 * sg.Sharpness ) ) ) ;\nreturn sg ; }\nvec3 sgdiffuseLighting ( vec3 light, vec3 normal, vec3 scatterAmt ) { FsphericalGaussian Kernel = makeNormalizedSG(light, 1.0 / max ( scatterAmt.xyz , 0.0001 )) ;\nvec3 diffuse = dotCosineLobe(Kernel, normal) ;\nvec3 diffuselobe = max ( vec3 ( 0.0 ) , ( diffuse - 0.004 ) ) ;\ndiffuse = ( diffuselobe * ( 6.2 * diffuselobe + 0.5 ) ) / ( diffuselobe * ( 6.2 * diffuselobe + 1.7 ) + 0.06 ) ;\nreturn diffuse ; }\nvoid surfaceShadingSSS ( SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",211],[0," vec4 skinCurvatureTexture = texture2D ( material_CurvatureTexture , uv ) ; \n"],[5,213],[0," vec4 skinCurvatureTexture = vec4 ( 1 ) ; \n"],[6],[0,"\nfloat skintexture = skinCurvatureTexture.r * material_CurvaturePower ;\nvec3 scatterAmt = material_SkinScatterAmount.rgb * skintexture ;\nvec3 sg = sgdiffuseLighting(incidentDirection, surfaceData.normal, scatterAmt) ;\nvec3 irradiance = sg * lightColor * PI ;\nfloat attenuation = clearCoatLobe(surfaceData, brdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\ndiffuseLobe(surfaceData, brdfData, attenuationIrradiance, diffuseColor) ;\nif ( surfaceData.dotNV > EPSILON ) { specularLobe(surfaceData, brdfData, incidentDirection, attenuationIrradiance, specularColor) ; }\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",449],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",223],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",229],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",235],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",241],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",247],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",339],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",261],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",259],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},271],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",275],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",279],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",283],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",287],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",291],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",295],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",299],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",303],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",307],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",311],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",315],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",319],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,321],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",325],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",329],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",333],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",337],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",387],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",347],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",351],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,353],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",361],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",359],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",369],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",367],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",377],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",375],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",381],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",385],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",401],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",395],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",399],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",405],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",409],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",413],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",427],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",419],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,421],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",425],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",437],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",433],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,435],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",447],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",443],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,445],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",525],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",459],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",465],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",471],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",477],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",509],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",485],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,487],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",491],[0," return vec3 ( 0 ) ; \n"],[5,503],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",495],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,497],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",501],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},507],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",513],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,515],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",519],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",523],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",531],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",782],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",547],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",543],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,545],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",551],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",555],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",571],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",561],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",565],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",569],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",579],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",577],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",591],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",585],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",589],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",603],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",597],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",601],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",619],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",609],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",617],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",615],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",623],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",627],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",631],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",635],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",639],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",643],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",647],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",651],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",655],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",659],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",663],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",667],[0," surfaceData.opacity = baseColor.a ; \n"],[5,669],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",673],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,675],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",679],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,684],[1,"HAS_DERIVATIVES",682],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,684],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",698],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},690],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,692],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",696],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",702],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",706],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",724],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",712],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,714],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",718],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",722],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",732],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",730],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",746],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",738],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,740],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",744],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",758],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",752],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",756],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",774],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",764],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",772],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",770],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",778],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,780],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},786],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},796],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,792],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,794],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, brdfData, totalDiffuseColor, totalSpecularColor) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,800],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/grid/Grid.gsp b/packages/custom-material/libs/grid/Grid.gsp new file mode 100644 index 00000000..ea2dbb83 --- /dev/null +++ b/packages/custom-material/libs/grid/Grid.gsp @@ -0,0 +1 @@ +{"name":"Grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 camera_ViewInvMat;\nattribute vec3 POSITION;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",6],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,10],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nnearPoint = UnprojectPoint(POSITION.x, POSITION.y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(POSITION.x, POSITION.y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"varying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[1,"GRAPHICS_API_WEBGL2",6],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,10],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) { color.z = 1.0 ; }\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) { color.x = 1.0 ; }\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/libs/index.ts new file mode 100644 index 00000000..31f10e06 --- /dev/null +++ b/packages/custom-material/libs/index.ts @@ -0,0 +1,14 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import EyeSource from "./advanced-shader/eye/Eye.gsp"; +import GridSource from "./grid/Grid.gsp"; +import HairSource from "./advanced-shader/hair/Hair.gsp"; +import PlanarShadowSource from "./planar-shadow/PlanarShadow.gsp"; +import SSSSource from "./advanced-shader/sss/SSS.gsp"; + +export { + EyeSource, + GridSource, + HairSource, + PlanarShadowSource, + SSSSource +}; diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadow.gsp b/packages/custom-material/libs/planar-shadow/PlanarShadow.gsp new file mode 100644 index 00000000..9cd66162 --- /dev/null +++ b/packages/custom-material/libs/planar-shadow/PlanarShadow.gsp @@ -0,0 +1 @@ +{"name":"PlanarShadow","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/Forward","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"planarShadow","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"11":true,"13":true,"14":0,"17":2,"18":2,"19":6,"20":6,"21":0,"22":0,"23":0,"24":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform vec3 u_lightDir;\nuniform float u_planarHeight;\nuniform vec4 u_planarShadowColor;\nuniform float u_planarShadowFalloff;\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_VPMat;\n\n"],[1,"RENDERER_HAS_SKIN",11],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,9],[1,"RENDERER_BLENDSHAPE_COUNT",9],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\n\n"],[6],[0,"\nvec3 ShadowProjectPos ( vec4 vertPos ) { vec3 shadowPos ;\nvec3 worldPos = ( renderer_ModelMat * vertPos ).xyz ;\nshadowPos.y = min ( worldPos.y , u_planarHeight ) ;\nshadowPos.xz = worldPos.xz - u_lightDir.xz * max ( 0.0 , worldPos.y - u_planarHeight ) / u_lightDir.y ;\nreturn shadowPos ; }\nattribute vec4 POSITION;\nattribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\nvarying vec4 color;\n\nvoid main() { \nvec4 position = vec4 ( POSITION.xyz , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_SKIN",21],[0," \n"],[1,"RENDERER_USE_JOINT_TEXTURE",17],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,19],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec3 shadowPos = ShadowProjectPos(position) ;\ngl_Position = camera_VPMat * vec4 ( shadowPos , 1.0 ) ;\nvec3 center = vec3 ( renderer_ModelMat[3].x , u_planarHeight , renderer_ModelMat[3].z ) ;\nfloat falloff = 0.5 - clamp ( distance ( shadowPos , center ) * u_planarShadowFalloff , 0.0 , 1.0 ) ;\ncolor = u_planarShadowColor ;\ncolor.a *= falloff ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[1,"RENDERER_HAS_SKIN",11],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\n\n"],[5,9],[1,"RENDERER_BLENDSHAPE_COUNT",9],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 color;\n\nvoid main() { gl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/src/advanced-shader/eye/Eye.gs b/packages/custom-material/src/advanced-shader/eye/Eye.shader similarity index 100% rename from packages/custom-material/src/advanced-shader/eye/Eye.gs rename to packages/custom-material/src/advanced-shader/eye/Eye.shader diff --git a/packages/custom-material/src/advanced-shader/hair/Hair.gs b/packages/custom-material/src/advanced-shader/hair/Hair.shader similarity index 100% rename from packages/custom-material/src/advanced-shader/hair/Hair.gs rename to packages/custom-material/src/advanced-shader/hair/Hair.shader diff --git a/packages/custom-material/src/advanced-shader/sss/SSS.gs b/packages/custom-material/src/advanced-shader/sss/SSS.shader similarity index 100% rename from packages/custom-material/src/advanced-shader/sss/SSS.gs rename to packages/custom-material/src/advanced-shader/sss/SSS.shader diff --git a/packages/custom-material/src/grid/Grid.shader b/packages/custom-material/src/grid/Grid.shader index 424e10f3..6224f152 100644 --- a/packages/custom-material/src/grid/Grid.shader +++ b/packages/custom-material/src/grid/Grid.shader @@ -11,12 +11,12 @@ Shader "Grid" { struct a2v { vec3 POSITION; - } + }; struct v2f { vec3 nearPoint; vec3 farPoint; - } + }; vec3 UnprojectPoint(float x, float y, float z, mat4 viewInvMat, mat4 projInvMat) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4(x, y, z, 1.0); diff --git a/packages/custom-material/src/planar-shadow/PlanarShadow.shader b/packages/custom-material/src/planar-shadow/PlanarShadow.shader index a9db5a66..346e2292 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadow.shader +++ b/packages/custom-material/src/planar-shadow/PlanarShadow.shader @@ -5,8 +5,11 @@ Shader "PlanarShadow" { UsePass "pbr/Default/Forward" Pass "planarShadow" { + VertexShader = vert; + FragmentShader = frag; + // render states - DepthState { + DepthState = { WriteEnabled = true; } @@ -18,7 +21,7 @@ Shader "PlanarShadow" { DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; } - StencilState { + StencilState = { Enabled = true; ReferenceValue = 0; CompareFunctionFront = CompareFunction.Equal; @@ -33,7 +36,7 @@ Shader "PlanarShadow" { BlendState = blendState; - RenderQueueType = RenderQueueType.Transparent; + RenderQueueType = Transparent; vec3 u_lightDir; float u_planarHeight; @@ -82,13 +85,13 @@ Shader "PlanarShadow" { struct a2v { vec4 POSITION; - vec4 JOINTS_0; + vec4 JOINTS_0; vec4 WEIGHTS_0; - } + }; struct v2f { vec4 color; - } + }; v2f vert(a2v v) { v2f o; @@ -125,10 +128,8 @@ Shader "PlanarShadow" { // shadow color o.color = u_planarShadowColor; o.color.a *= falloff; + return o; } - - VertexShader = vert; - FragmentShader = frag; void frag(v2f i) { gl_FragColor = i.color; diff --git a/rollup.config.mjs b/rollup.config.mjs index 23b2d3f7..285ae780 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,5 +1,5 @@ import resolve from "@rollup/plugin-node-resolve"; -import glslify from "rollup-plugin-glslify"; +import { shaderCompiler } from "@galacean/engine-shader-compiler/bundler"; import license from "rollup-plugin-license"; import { binary2base64 } from "rollup-plugin-binary2base64"; import commonjs from "@rollup/plugin-commonjs"; @@ -9,7 +9,6 @@ import camelCase from "camelcase"; import fs from "fs"; import path from "path"; import replace from "@rollup/plugin-replace"; -import { string } from "rollup-plugin-string"; function walk(dir) { let files = fs.readdirSync(dir); @@ -44,11 +43,12 @@ const mainFields = ["module", "main"]; const plugins = [ resolve({ extensions, preferBuiltins: true, mainFields }), - glslify({ - include: [/\.glsl$/], - exclude: "**/packages/shaderlab/src/shaders/**" + shaderCompiler({ + precompile: { + input: path.join(process.cwd(), "packages/custom-material/src"), + output: path.join(process.cwd(), "packages/custom-material/libs") + } }), - string({ include: ["**/*.shader", "**/packages/shaderlab/src/**/*.(glsl|gs)"] }), swc( defineRollupSwcOption({ include: /\.[mc]?[jt]sx?$/, From b0f9d7d062bd00fffdeda41d9e391b5f68cf892e Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 28 Apr 2026 15:54:56 +0800 Subject: [PATCH 07/27] build: migrate all inline shaders to .shader files + per-pkg precompile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move every TS-inlined ShaderLab template literal across all toolkit packages into a sibling `.shader` file, then have the host `.ts` import the file as a string. Plugin now runs transform-only — each package owns its own `precompile` npm script that drives the `shader-compiler-precompile` CLI to emit `.gsp` artifacts under `/libs/`. Top-level `pnpm run precompile` fans out via `pnpm -r --filter='./packages/*' --if-present run precompile`. Coverage (16 inline shaders → 21 total `.gsp` outputs): - custom-material: water/{Water,WaterFall,WaterRipple}, bake-pbr/BakePBR, plain-color/PlainColor, grid/Grid (overwritten with canonical inline), planar-shadow/PlanarShadowOnly (new — extracted from PlanarShadowShaderFactory's partial pass source, wrapped in a full Shader/SubShader/Pass; factory now loads it via Shader.find and combines its single pass with PBR's ShadowCaster). - geometry-sketch: TBN, Wireframe (also extract two `.glsl` includes GeometryTextureDefine and GeometryTextureVert from the now-removed GeometryShader.ts string-interpolation helper). - gizmo: Icon - skeleton-viewer: SkeletonViewer - controls: BoxSelection (was inline "box") - outline: OutlinePostprocess + OutlineReplace - framebuffer-picker: FramebufferPickerColor - lines: Line, Dash Add `./sources` subpath export to custom-material so the editor can import raw `.shader` strings via `@galacean/engine-toolkit-custom-material/sources` (mirrors engine-shader's pattern). Other packages don't need this — only custom-material exposes shaders to editor authors. Each affected package gains: - `precompile` script in package.json - `src/global.d.ts` declaring `*.shader` module type - `libs/` precompiled `.gsp` outputs + auto-generated index.ts Drop `rollup-plugin-glslify` and `rollup-plugin-string` from devDeps (replaced by `@galacean/engine-shader-compiler/bundler`'s transform). --- package.json | 5 +- .../libs/box-selection/BoxSelection.gsp | 1 + packages/controls/libs/index.ts | 6 + packages/controls/package.json | 1 + .../src/box-selection/BoxSelection.shader | 29 ++++ .../box-selection/BoxSelectionSSMaterial.ts | 30 +--- packages/controls/src/global.d.ts | 4 + .../custom-material/libs/bake-pbr/BakePBR.gsp | 1 + packages/custom-material/libs/grid/Grid.gsp | 2 +- packages/custom-material/libs/index.ts | 14 +- .../libs/plain-color/PlainColor.gsp | 1 + .../libs/planar-shadow/PlanarShadowOnly.gsp | 1 + packages/custom-material/libs/water/Water.gsp | 1 + .../custom-material/libs/water/WaterFall.gsp | 1 + .../libs/water/WaterRipple.gsp | 1 + packages/custom-material/package.json | 13 ++ .../src/bake-pbr/BakePBR.shader | 108 +++++++++++++ .../src/bake-pbr/BakePBRMaterial.ts | 110 +------------- packages/custom-material/src/grid/Grid.shader | 130 ++++------------ .../custom-material/src/grid/GridMaterial.ts | 108 +------------ .../src/plain-color/PlainColor.shader | 44 ++++++ .../src/plain-color/PlainColorMaterial.ts | 46 +----- .../src/planar-shadow/PlanarShadowOnly.shader | 96 ++++++++++++ .../PlanarShadowShaderFactory.ts | 108 +------------ packages/custom-material/src/sources.ts | 29 ++++ .../custom-material/src/water/Water.shader | 58 +++++++ .../src/water/WaterFall.shader | 69 +++++++++ .../src/water/WaterMaterial.ts | 60 +------- .../src/water/WaterRipple.shader | 53 +++++++ .../src/water/WaterRippleMaterial.ts | 55 +------ .../src/water/WaterfallMaterial.ts | 71 +-------- .../libs/FramebufferPickerColor.gsp | 1 + packages/framebuffer-picker/libs/index.ts | 6 + packages/framebuffer-picker/package.json | 3 +- .../src/FramebufferPicker.ts | 51 +------ .../src/FramebufferPickerColor.shader | 50 ++++++ packages/framebuffer-picker/src/global.d.ts | 4 + packages/geometry-sketch/libs/index.ts | 8 + .../geometry-sketch/libs/material/TBN.gsp | 1 + .../libs/material/Wireframe.gsp | 1 + packages/geometry-sketch/package.json | 1 + packages/geometry-sketch/src/global.d.ts | 4 + .../src/material/GeometryShader.ts | 100 ------------ .../src/material/GeometryTextureDefine.glsl | 61 ++++++++ .../src/material/GeometryTextureVert.glsl | 34 +++++ .../geometry-sketch/src/material/TBN.shader | 73 +++++++++ .../src/material/TBNMaterial.ts | 75 +-------- .../src/material/Wireframe.shader | 74 +++++++++ .../src/material/WireframeMaterial.ts | 76 +--------- packages/gizmo/libs/icon/Icon.gsp | 1 + packages/gizmo/libs/index.ts | 6 + packages/gizmo/package.json | 1 + packages/gizmo/src/global.d.ts | 4 + packages/gizmo/src/icon/Icon.shader | 70 +++++++++ packages/gizmo/src/icon/IconMaterial.ts | 71 +-------- packages/lines/libs/index.ts | 8 + packages/lines/libs/line/material/Dash.gsp | 1 + packages/lines/libs/line/material/Line.gsp | 1 + packages/lines/package.json | 1 + packages/lines/src/global.d.ts | 5 + packages/lines/src/line/material/Dash.shader | 76 ++++++++++ packages/lines/src/line/material/Line.shader | 59 ++++++++ .../lines/src/line/material/dashShader.ts | 77 +--------- .../lines/src/line/material/lineShader.ts | 60 +------- packages/outline/libs/OutlinePostprocess.gsp | 1 + packages/outline/libs/OutlineReplace.gsp | 1 + packages/outline/libs/index.ts | 8 + packages/outline/package.json | 3 +- packages/outline/src/OutlineManager.ts | 143 +----------------- .../outline/src/OutlinePostprocess.shader | 86 +++++++++++ packages/outline/src/OutlineReplace.shader | 54 +++++++ packages/outline/src/global.d.ts | 4 + .../skeleton-viewer/libs/SkeletonViewer.gsp | 1 + packages/skeleton-viewer/libs/index.ts | 6 + packages/skeleton-viewer/package.json | 3 +- .../skeleton-viewer/src/SkeletonViewer.shader | 35 +++++ .../skeleton-viewer/src/SkeletonViewer.ts | 36 +---- packages/skeleton-viewer/src/global.d.ts | 4 + rollup.config.mjs | 25 ++- 79 files changed, 1365 insertions(+), 1365 deletions(-) create mode 100644 packages/controls/libs/box-selection/BoxSelection.gsp create mode 100644 packages/controls/libs/index.ts create mode 100644 packages/controls/src/box-selection/BoxSelection.shader create mode 100644 packages/controls/src/global.d.ts create mode 100644 packages/custom-material/libs/bake-pbr/BakePBR.gsp create mode 100644 packages/custom-material/libs/plain-color/PlainColor.gsp create mode 100644 packages/custom-material/libs/planar-shadow/PlanarShadowOnly.gsp create mode 100644 packages/custom-material/libs/water/Water.gsp create mode 100644 packages/custom-material/libs/water/WaterFall.gsp create mode 100644 packages/custom-material/libs/water/WaterRipple.gsp create mode 100644 packages/custom-material/src/bake-pbr/BakePBR.shader create mode 100644 packages/custom-material/src/plain-color/PlainColor.shader create mode 100644 packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader create mode 100644 packages/custom-material/src/sources.ts create mode 100644 packages/custom-material/src/water/Water.shader create mode 100644 packages/custom-material/src/water/WaterFall.shader create mode 100644 packages/custom-material/src/water/WaterRipple.shader create mode 100644 packages/framebuffer-picker/libs/FramebufferPickerColor.gsp create mode 100644 packages/framebuffer-picker/libs/index.ts create mode 100644 packages/framebuffer-picker/src/FramebufferPickerColor.shader create mode 100644 packages/framebuffer-picker/src/global.d.ts create mode 100644 packages/geometry-sketch/libs/index.ts create mode 100644 packages/geometry-sketch/libs/material/TBN.gsp create mode 100644 packages/geometry-sketch/libs/material/Wireframe.gsp create mode 100644 packages/geometry-sketch/src/global.d.ts delete mode 100644 packages/geometry-sketch/src/material/GeometryShader.ts create mode 100644 packages/geometry-sketch/src/material/GeometryTextureDefine.glsl create mode 100644 packages/geometry-sketch/src/material/GeometryTextureVert.glsl create mode 100644 packages/geometry-sketch/src/material/TBN.shader create mode 100644 packages/geometry-sketch/src/material/Wireframe.shader create mode 100644 packages/gizmo/libs/icon/Icon.gsp create mode 100644 packages/gizmo/libs/index.ts create mode 100644 packages/gizmo/src/global.d.ts create mode 100644 packages/gizmo/src/icon/Icon.shader create mode 100644 packages/lines/libs/index.ts create mode 100644 packages/lines/libs/line/material/Dash.gsp create mode 100644 packages/lines/libs/line/material/Line.gsp create mode 100644 packages/lines/src/line/material/Dash.shader create mode 100644 packages/lines/src/line/material/Line.shader create mode 100644 packages/outline/libs/OutlinePostprocess.gsp create mode 100644 packages/outline/libs/OutlineReplace.gsp create mode 100644 packages/outline/libs/index.ts create mode 100644 packages/outline/src/OutlinePostprocess.shader create mode 100644 packages/outline/src/OutlineReplace.shader create mode 100644 packages/outline/src/global.d.ts create mode 100644 packages/skeleton-viewer/libs/SkeletonViewer.gsp create mode 100644 packages/skeleton-viewer/libs/index.ts create mode 100644 packages/skeleton-viewer/src/SkeletonViewer.shader create mode 100644 packages/skeleton-viewer/src/global.d.ts diff --git a/package.json b/package.json index 860f1664..210fad03 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,9 @@ "lint": "eslint packages/*/src --ext .ts", "watch": "rollup -cw -m inline", "b:types": "pnpm -r --filter=./packages/* run b:types", - "build": "rollup -c", - "b:all": "pnpm run b:types && cross-env BUILD_TYPE=ALL rollup -c", + "precompile": "pnpm -r --filter=./packages/* --if-present run precompile", + "build": "npm run precompile && rollup -c", + "b:all": "npm run precompile && pnpm run b:types && cross-env BUILD_TYPE=ALL rollup -c", "clean": "pnpm -r exec rm -rf dist && pnpm -r exec rm -rf types", "release": "bumpp -r" }, diff --git a/packages/controls/libs/box-selection/BoxSelection.gsp b/packages/controls/libs/box-selection/BoxSelection.gsp new file mode 100644 index 00000000..4547af38 --- /dev/null +++ b/packages/controls/libs/box-selection/BoxSelection.gsp @@ -0,0 +1 @@ +{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/controls/libs/index.ts b/packages/controls/libs/index.ts new file mode 100644 index 00000000..40954984 --- /dev/null +++ b/packages/controls/libs/index.ts @@ -0,0 +1,6 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import BoxSelectionSource from "./box-selection/BoxSelection.gsp"; + +export { + BoxSelectionSource +}; diff --git a/packages/controls/package.json b/packages/controls/package.json index 5598b7f3..05f96491 100644 --- a/packages/controls/package.json +++ b/packages/controls/package.json @@ -14,6 +14,7 @@ "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/index.d.ts", diff --git a/packages/controls/src/box-selection/BoxSelection.shader b/packages/controls/src/box-selection/BoxSelection.shader new file mode 100644 index 00000000..833ae554 --- /dev/null +++ b/packages/controls/src/box-selection/BoxSelection.shader @@ -0,0 +1,29 @@ +Shader "box" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + + #include "Common/Attributes.glsl" + + void vert(Attributes attr) { + gl_Position = vec4(attr.POSITION, 1.0); + } + + vec2 u_min; + vec2 u_max; + vec4 u_boxColor; + vec4 u_borderColor; + float u_width; + + void frag() { + float vColor = step(u_min.x + u_width, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x - u_width) * step(u_min.y + u_width, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y - u_width); + float vBorder = step(u_min.x, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x) * step(u_min.y, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y); + gl_FragColor = u_boxColor * vColor + (1. - vColor) * vBorder * u_borderColor; + } + } + } +} diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index 66897059..78384e4e 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -1,34 +1,6 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Vector2, Vector4 } from "@galacean/engine"; -const shaderSource = `Shader "box" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - - #include "Common/Attributes.glsl" - - void vert(Attributes attr) { - gl_Position = vec4(attr.POSITION, 1.0); - } - - vec2 u_min; - vec2 u_max; - vec4 u_boxColor; - vec4 u_borderColor; - float u_width; - - void frag() { - float vColor = step(u_min.x + u_width, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x - u_width) * step(u_min.y + u_width, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y - u_width); - float vBorder = step(u_min.x, gl_FragCoord.x) * step(gl_FragCoord.x, u_max.x) * step(u_min.y, gl_FragCoord.y) * step(gl_FragCoord.y, u_max.y); - gl_FragColor = u_boxColor * vColor + (1. - vColor) * vBorder * u_borderColor; - } - } - } -}`; +import shaderSource from "./BoxSelection.shader"; Shader.find("box") || Shader.create(shaderSource); diff --git a/packages/controls/src/global.d.ts b/packages/controls/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/controls/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/custom-material/libs/bake-pbr/BakePBR.gsp b/packages/custom-material/libs/bake-pbr/BakePBR.gsp new file mode 100644 index 00000000..3a871895 --- /dev/null +++ b/packages/custom-material/libs/bake-pbr/BakePBR.gsp @@ -0,0 +1 @@ +{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",708],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",34],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,32],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",44],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,42],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",50],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",108],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",82],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",80],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},62],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,78],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",68],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",72],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,76],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",86],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",90],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",94],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",98],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",102],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",106],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",130],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",128],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",118],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,120],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",124],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,126],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",208],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",206],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",140],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,154],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},144],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,152],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,150],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",162],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",160],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",174],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},168],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},172],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,204],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},186],[0," \n"],[1,"RENDERER_HAS_NORMAL",180],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",184],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,202],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,200],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",288],[0,"\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},218],[0,"\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",246],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,224],[0," mediump int cascadeIndex = 0 ; \n"],[5,226],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",230],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,244],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,234],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,238],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,242],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",286],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",256],[0,"\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,270],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",262],[0,"\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,266],[0,"\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,274],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,284],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",282],[0,"\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",318],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",296],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",300],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,304],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",312],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",310],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},316],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",472],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",328],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",334],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",340],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",346],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",352],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",410],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",366],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",364],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},376],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",380],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",384],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",388],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",392],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",396],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",400],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",408],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",452],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",418],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",426],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",434],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",442],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",440],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",446],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",450],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",458],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",462],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",470],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",508],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",482],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",488],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",494],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",500],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",506],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",574],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,516],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",524],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",522],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",528],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",536],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",534],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",548],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",546],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",544],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",560],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},558],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",556],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},568],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",566],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,572],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",682],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",584],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",588],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",592],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",608],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",602],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",606],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",616],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",614],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",628],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",622],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",626],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",640],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",634],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",638],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",656],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",646],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",654],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",660],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",664],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",668],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",672],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",676],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",680],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",686],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",690],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,694],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",702],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",700],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},706],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",712],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",868],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",38],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",26],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",32],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,36],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",58],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,56],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,48],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",2,51],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",3,54],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",64],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",70],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",86],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",84],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",80],[0,"\n\n"],[5,82],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",114],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",112],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",96],[0,"\n\n"],[5,110],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0,"\n\n"],[5,108],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},104],[0,"\n\n"],[5,106],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",206],[0,"\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},124],[0,"\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",152],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,130],[0," mediump int cascadeIndex = 0 ; \n"],[5,132],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",136],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,150],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,140],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,144],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,148],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",204],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",162],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,176],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",168],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,172],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,180],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,190],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",188],[0,"\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,194],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,198],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",236],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",214],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",218],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,222],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",230],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",228],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},234],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",533],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",246],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",252],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",258],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",264],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",270],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",423],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",284],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},294],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",298],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",302],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",306],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",310],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",314],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",318],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",322],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",326],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",330],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",334],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",338],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,340],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",344],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",348],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",352],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",356],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",360],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,362],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",366],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",376],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",372],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,374],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",391],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,382],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,385],[3,"REFRACTION_MODE","==",1,385],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",389],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",401],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",397],[0," return 1.0 ; \n"],[5,399],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",405],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",409],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",413],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",417],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",421],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",471],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",431],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",435],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,437],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",445],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",443],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",453],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",451],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",461],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",459],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",465],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",469],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",485],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",479],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",483],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",489],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",493],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",497],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",511],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",503],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,505],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",509],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",521],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",517],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,519],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",531],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",527],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,529],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",609],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",543],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",549],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",555],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",561],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",593],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",569],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,571],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",575],[0," return vec3 ( 0 ) ; \n"],[5,587],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",579],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,581],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",585],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},591],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",597],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,599],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",603],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",607],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",615],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",866],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",631],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",627],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,629],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",635],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",639],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",655],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",645],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",649],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",653],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",663],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",661],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",675],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",669],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",673],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",687],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",681],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",685],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",703],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",693],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",701],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",699],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",707],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",711],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",715],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",719],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",723],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",727],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",731],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",735],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",739],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",743],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",747],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",751],[0," surfaceData.opacity = baseColor.a ; \n"],[5,753],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",757],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,759],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",763],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,768],[1,"HAS_DERIVATIVES",766],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,768],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",782],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},774],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,776],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",780],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",786],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",790],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",808],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",796],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,798],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",802],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",806],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",816],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",814],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",830],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",822],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,824],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",828],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",842],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",836],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",840],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",858],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",848],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",856],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",854],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",862],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,864],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",872],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},876],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},886],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,882],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,884],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",894],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",892],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",898],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,902],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/grid/Grid.gsp b/packages/custom-material/libs/grid/Grid.gsp index ea2dbb83..983169eb 100644 --- a/packages/custom-material/libs/grid/Grid.gsp +++ b/packages/custom-material/libs/grid/Grid.gsp @@ -1 +1 @@ -{"name":"Grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 camera_ViewInvMat;\nattribute vec3 POSITION;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",6],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,10],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nnearPoint = UnprojectPoint(POSITION.x, POSITION.y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(POSITION.x, POSITION.y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"varying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[1,"GRAPHICS_API_WEBGL2",6],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,10],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) { color.z = 1.0 ; }\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) { color.x = 1.0 ; }\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ; }"]]}]}]} \ No newline at end of file +{"name":"grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewInvMat;\nattribute vec4 POSITION_FLIP;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nbool flipY = camera_ProjectionParams.x < 0.0 ;\nfloat x = flipY ? POSITION_FLIP.z : POSITION_FLIP.x ;\nfloat y = flipY ? POSITION_FLIP.w : POSITION_FLIP.y ;\nnearPoint = UnprojectPoint(x, y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( x , y , 0.0 , 1.0 ) ;\n }\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ProjMat;\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n"],[6],[0,"\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) color.z = 1.0 ;\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) color.x = 1.0 ;\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ;\ngl_FragColor = sRGBToLinear(gl_FragColor) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/libs/index.ts index 31f10e06..f4bc0b6e 100644 --- a/packages/custom-material/libs/index.ts +++ b/packages/custom-material/libs/index.ts @@ -1,14 +1,26 @@ // Auto-generated by shader-precompile --emit-index — do not edit +import BakePBRSource from "./bake-pbr/BakePBR.gsp"; import EyeSource from "./advanced-shader/eye/Eye.gsp"; import GridSource from "./grid/Grid.gsp"; import HairSource from "./advanced-shader/hair/Hair.gsp"; +import PlainColorSource from "./plain-color/PlainColor.gsp"; +import PlanarShadowOnlySource from "./planar-shadow/PlanarShadowOnly.gsp"; import PlanarShadowSource from "./planar-shadow/PlanarShadow.gsp"; import SSSSource from "./advanced-shader/sss/SSS.gsp"; +import WaterFallSource from "./water/WaterFall.gsp"; +import WaterRippleSource from "./water/WaterRipple.gsp"; +import WaterSource from "./water/Water.gsp"; export { + BakePBRSource, EyeSource, GridSource, HairSource, + PlainColorSource, + PlanarShadowOnlySource, PlanarShadowSource, - SSSSource + SSSSource, + WaterFallSource, + WaterRippleSource, + WaterSource }; diff --git a/packages/custom-material/libs/plain-color/PlainColor.gsp b/packages/custom-material/libs/plain-color/PlainColor.gsp new file mode 100644 index 00000000..ccb949de --- /dev/null +++ b/packages/custom-material/libs/plain-color/PlainColor.gsp @@ -0,0 +1 @@ +{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.gsp b/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.gsp new file mode 100644 index 00000000..3e107d72 --- /dev/null +++ b/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.gsp @@ -0,0 +1 @@ +{"name":"PlanarShadowOnly","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"PlanarShadow","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform vec3 u_lightDir;\nuniform float u_planarHeight;\nuniform vec4 u_planarShadowColor;\nuniform float u_planarShadowFalloff;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_VPMat;\nattribute vec4 POSITION;\n\n"],[1,"RENDERER_HAS_SKIN",4],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\nvarying vec4 color;\n\n\n"],[1,"RENDERER_HAS_SKIN",14],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",10],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,12],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\n\n"],[6],[0,"\nvec3 ShadowProjectPos ( vec4 vertPos ) { vec3 shadowPos ;\nvec3 worldPos = ( renderer_ModelMat * vertPos ).xyz ;\nshadowPos.y = min ( worldPos.y , u_planarHeight ) ;\nshadowPos.xz = worldPos.xz - u_lightDir.xz * max ( 0.0 , worldPos.y - u_planarHeight ) / u_lightDir.y ;\nreturn shadowPos ; }\nvoid main() { \nvec4 position = vec4 ( POSITION.xyz , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_SKIN",24],[0," \n"],[1,"RENDERER_USE_JOINT_TEXTURE",20],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,22],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec3 shadowPos = ShadowProjectPos(position) ;\ngl_Position = camera_VPMat * vec4 ( shadowPos , 1.0 ) ;\nvec3 center = vec3 ( renderer_ModelMat[3].x , u_planarHeight , renderer_ModelMat[3].z ) ;\nfloat falloff = 0.5 - clamp ( distance ( shadowPos , center ) * u_planarShadowFalloff , 0.0 , 1.0 ) ;\ncolor = u_planarShadowColor ;\ncolor.a *= falloff ;\n }"]],"fragmentShaderInstructions":[[0,"varying vec4 color;\n\n\n"],[1,"RENDERER_HAS_SKIN",10],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\n\n"],[5,8],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/water/Water.gsp b/packages/custom-material/libs/water/Water.gsp new file mode 100644 index 00000000..fc889410 --- /dev/null +++ b/packages/custom-material/libs/water/Water.gsp @@ -0,0 +1 @@ +{"name":"water","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * sin ( u_time ) , u_water_speed.y * cos ( u_time ) ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_edgeTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 edgeTex = texture2D ( u_edgeTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat edge = pow ( ( v_color.r + edgeTex.r ) * v_color.r , 2.0 ) ;\nedge = saturate(1.0 - smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edge )) ;\nvec4 finalCol = mix ( waterTex , u_edgeColor , edge ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/water/WaterFall.gsp b/packages/custom-material/libs/water/WaterFall.gsp new file mode 100644 index 00000000..02b315b7 --- /dev/null +++ b/packages/custom-material/libs/water/WaterFall.gsp @@ -0,0 +1 @@ +{"name":"water-fall","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_waterfall_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * u_time , u_water_speed.y * u_time ) ;\nwaterfallTexCoords = TEXCOORD_0 + vec2 ( u_waterfall_speed.x * u_time , u_waterfall_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_waterfallTex;\nuniform sampler2D u_edgeNoiseTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 waterfallTex = texture2D ( u_waterfallTex , waterfallTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 streamEdge = texture2D ( u_edgeNoiseTex , waterTexCoords ) ;\nvec4 fallEdge = texture2D ( u_edgeNoiseTex , waterfallTexCoords ) ;\nfloat edgeShape = mix ( fallEdge.r , streamEdge.r , v_color.r ) ;\nedgeShape = saturate(edgeShape * v_color.g) ;\nedgeShape = saturate(smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edgeShape )) ;\nvec4 waterAll = mix ( waterfallTex , waterTex , v_color.r ) ;\nvec4 finalCol = mix ( waterAll , u_edgeColor , edgeShape ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/water/WaterRipple.gsp b/packages/custom-material/libs/water/WaterRipple.gsp new file mode 100644 index 00000000..eab6ebd2 --- /dev/null +++ b/packages/custom-material/libs/water/WaterRipple.gsp @@ -0,0 +1 @@ +{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/package.json b/packages/custom-material/package.json index 6aca9c2f..922a0881 100644 --- a/packages/custom-material/package.json +++ b/packages/custom-material/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "publishConfig": { @@ -19,6 +20,18 @@ "types": "types/index.d.ts", "main": "dist/commonjs/browser.js", "module": "dist/es/index.js", + "exports": { + ".": { + "module": "./dist/es/index.js", + "default": "./dist/commonjs/browser.js", + "types": "./types/index.d.ts" + }, + "./sources": { + "module": "./dist/es/sources.module.js", + "default": "./dist/commonjs/sources.main.js", + "types": "./types/sources.d.ts" + } + }, "files": [ "dist/**/*", "types/**/*" diff --git a/packages/custom-material/src/bake-pbr/BakePBR.shader b/packages/custom-material/src/bake-pbr/BakePBR.shader new file mode 100644 index 00000000..2860b495 --- /dev/null +++ b/packages/custom-material/src/bake-pbr/BakePBR.shader @@ -0,0 +1,108 @@ +Shader "bake-pbr" { + SubShader "Default" { + UsePass "Utility/ShadowMap/Default/ShadowCaster" + UsePass "Utility/DepthOnly/Default/DepthOnly" + + Pass "Forward Pass" { + Tags { pipelineStage = "Forward" } + + RenderQueueType renderQueueType; + BlendFactor sourceColorBlendFactor; + BlendFactor destinationColorBlendFactor; + BlendFactor sourceAlphaBlendFactor; + BlendFactor destinationAlphaBlendFactor; + CullMode rasterStateCullMode; + Bool blendEnabled; + Bool depthWriteEnabled; + + DepthState = { + WriteEnabled = depthWriteEnabled; + } + + BlendState = { + Enabled = blendEnabled; + SourceColorBlendFactor = sourceColorBlendFactor; + DestinationColorBlendFactor = destinationColorBlendFactor; + SourceAlphaBlendFactor = sourceAlphaBlendFactor; + DestinationAlphaBlendFactor = destinationAlphaBlendFactor; + } + + RasterState = { + CullMode = rasterStateCullMode; + } + + RenderQueueType = renderQueueType; + + VertexShader = BakePBRVertex; + FragmentShader = BakePBRFragment; + + #include "PBR/ForwardPassPBR.glsl" + + #ifdef LIGHTMAP_TEXTURE + sampler2D u_lightMapTexture; + float u_lightMapIntensity; + #endif + + Varyings BakePBRVertex(Attributes attributes) { + return PBRVertex(attributes); + } + + void BakePBRFragment(Varyings varyings) { + BSDFData bsdfData; + + vec2 aoUV = varyings.uv; + #if defined(MATERIAL_HAS_OCCLUSION_TEXTURE) && defined(RENDERER_HAS_UV1) + if(material_OcclusionTextureCoord == 1.0){ + aoUV = varyings.uv1; + } + #endif + + SurfaceData surfaceData = getSurfaceData(varyings, aoUV, gl_FrontFacing); + initBSDFData(surfaceData, bsdfData); + + vec3 totalDiffuseColor = vec3(0, 0, 0); + vec3 totalSpecularColor = vec3(0, 0, 0); + + // Shadow + float shadowAttenuation = 1.0; + #if defined(SCENE_DIRECT_LIGHT_COUNT) && defined(NEED_CALCULATE_SHADOWS) + #if SCENE_SHADOW_CASCADED_COUNT == 1 + vec3 shadowCoord = varyings.shadowCoord; + #else + vec3 shadowCoord = getShadowCoord(varyings.positionWS); + #endif + shadowAttenuation *= sampleShadowMap(varyings.positionWS, shadowCoord); + #endif + + // Direct lighting + evaluateDirectRadiance(varyings, surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor); + + // IBL (engine standard) + evaluateIBL(varyings, surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor); + + // Lightmap: replace/supplement IBL diffuse with baked lightmap + #ifdef LIGHTMAP_TEXTURE + vec2 lightMapUV = varyings.uv; + #ifdef RENDERER_HAS_UV1 + lightMapUV = varyings.uv1; + #endif + totalDiffuseColor += texture2D(u_lightMapTexture, lightMapUV).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor); + #endif + + #ifdef MATERIAL_ENABLE_TRANSMISSION + vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData); + totalDiffuseColor = mix(totalDiffuseColor, refractionTransmitted, surfaceData.transmission); + #endif + + vec4 color = vec4((totalDiffuseColor + totalSpecularColor).rgb, surfaceData.opacity); + color.rgb += surfaceData.emissiveColor; + + #if SCENE_FOG_MODE != 0 + color = fog(color, varyings.positionVS); + #endif + + gl_FragColor = color; + } + } + } +} \ No newline at end of file diff --git a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts index b77c7850..832eda6f 100644 --- a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts +++ b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts @@ -1,113 +1,5 @@ import { Engine, PBRMaterial, Shader, ShaderProperty, Texture2D } from "@galacean/engine"; - -const shaderSource = `Shader "bake-pbr" { - SubShader "Default" { - UsePass "Utility/ShadowMap/Default/ShadowCaster" - UsePass "Utility/DepthOnly/Default/DepthOnly" - - Pass "Forward Pass" { - Tags { pipelineStage = "Forward" } - - RenderQueueType renderQueueType; - BlendFactor sourceColorBlendFactor; - BlendFactor destinationColorBlendFactor; - BlendFactor sourceAlphaBlendFactor; - BlendFactor destinationAlphaBlendFactor; - CullMode rasterStateCullMode; - Bool blendEnabled; - Bool depthWriteEnabled; - - DepthState = { - WriteEnabled = depthWriteEnabled; - } - - BlendState = { - Enabled = blendEnabled; - SourceColorBlendFactor = sourceColorBlendFactor; - DestinationColorBlendFactor = destinationColorBlendFactor; - SourceAlphaBlendFactor = sourceAlphaBlendFactor; - DestinationAlphaBlendFactor = destinationAlphaBlendFactor; - } - - RasterState = { - CullMode = rasterStateCullMode; - } - - RenderQueueType = renderQueueType; - - VertexShader = BakePBRVertex; - FragmentShader = BakePBRFragment; - - #include "PBR/ForwardPassPBR.glsl" - - #ifdef LIGHTMAP_TEXTURE - sampler2D u_lightMapTexture; - float u_lightMapIntensity; - #endif - - Varyings BakePBRVertex(Attributes attributes) { - return PBRVertex(attributes); - } - - void BakePBRFragment(Varyings varyings) { - BSDFData bsdfData; - - vec2 aoUV = varyings.uv; - #if defined(MATERIAL_HAS_OCCLUSION_TEXTURE) && defined(RENDERER_HAS_UV1) - if(material_OcclusionTextureCoord == 1.0){ - aoUV = varyings.uv1; - } - #endif - - SurfaceData surfaceData = getSurfaceData(varyings, aoUV, gl_FrontFacing); - initBSDFData(surfaceData, bsdfData); - - vec3 totalDiffuseColor = vec3(0, 0, 0); - vec3 totalSpecularColor = vec3(0, 0, 0); - - // Shadow - float shadowAttenuation = 1.0; - #if defined(SCENE_DIRECT_LIGHT_COUNT) && defined(NEED_CALCULATE_SHADOWS) - #if SCENE_SHADOW_CASCADED_COUNT == 1 - vec3 shadowCoord = varyings.shadowCoord; - #else - vec3 shadowCoord = getShadowCoord(varyings.positionWS); - #endif - shadowAttenuation *= sampleShadowMap(varyings.positionWS, shadowCoord); - #endif - - // Direct lighting - evaluateDirectRadiance(varyings, surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor); - - // IBL (engine standard) - evaluateIBL(varyings, surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor); - - // Lightmap: replace/supplement IBL diffuse with baked lightmap - #ifdef LIGHTMAP_TEXTURE - vec2 lightMapUV = varyings.uv; - #ifdef RENDERER_HAS_UV1 - lightMapUV = varyings.uv1; - #endif - totalDiffuseColor += texture2D(u_lightMapTexture, lightMapUV).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor); - #endif - - #ifdef MATERIAL_ENABLE_TRANSMISSION - vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData); - totalDiffuseColor = mix(totalDiffuseColor, refractionTransmitted, surfaceData.transmission); - #endif - - vec4 color = vec4((totalDiffuseColor + totalSpecularColor).rgb, surfaceData.opacity); - color.rgb += surfaceData.emissiveColor; - - #if SCENE_FOG_MODE != 0 - color = fog(color, varyings.positionVS); - #endif - - gl_FragColor = color; - } - } - } -}`; +import shaderSource from "./BakePBR.shader"; Shader.find("bake-pbr") || Shader.create(shaderSource); diff --git a/packages/custom-material/src/grid/Grid.shader b/packages/custom-material/src/grid/Grid.shader index 6224f152..f6c6717c 100644 --- a/packages/custom-material/src/grid/Grid.shader +++ b/packages/custom-material/src/grid/Grid.shader @@ -1,116 +1,48 @@ -Shader "Grid" { - +Shader "grid" { SubShader "Default" { - Pass "Forward" { - - mat4 camera_ViewInvMat; - VertexShader = vert; FragmentShader = frag; - struct a2v { - vec3 POSITION; + #include "Common/Common.glsl" + + mat4 camera_ViewInvMat; + mat4 camera_ProjMat; + + struct Attributes { + vec4 POSITION_FLIP; }; - struct v2f { + struct Varyings { vec3 nearPoint; vec3 farPoint; }; vec3 UnprojectPoint(float x, float y, float z, mat4 viewInvMat, mat4 projInvMat) { - vec4 unprojectedPoint = viewInvMat * projInvMat * vec4(x, y, z, 1.0); + vec4 unprojectedPoint = viewInvMat * projInvMat * vec4(x, y, z, 1.0); return unprojectedPoint.xyz / unprojectedPoint.w; } - #ifdef GRAPHICS_API_WEBGL2 - #define INVERSE_MAT(mat) inverse(mat) - #else - mat2 inverseMat(mat2 m) { - return mat2(m[1][1],-m[0][1], - -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]); - } - mat3 inverseMat(mat3 m) { - float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2]; - float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2]; - float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2]; - - float b01 = a22 * a11 - a12 * a21; - float b11 = -a22 * a10 + a12 * a20; - float b21 = a21 * a10 - a11 * a20; - - float det = a00 * b01 + a01 * b11 + a02 * b21; - - return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11), - b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10), - b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det; - } - mat4 inverseMat(mat4 m) { - float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3], - a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3], - a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3], - a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3], - - b00 = a00 * a11 - a01 * a10, - b01 = a00 * a12 - a02 * a10, - b02 = a00 * a13 - a03 * a10, - b03 = a01 * a12 - a02 * a11, - b04 = a01 * a13 - a03 * a11, - b05 = a02 * a13 - a03 * a12, - b06 = a20 * a31 - a21 * a30, - b07 = a20 * a32 - a22 * a30, - b08 = a20 * a33 - a23 * a30, - b09 = a21 * a32 - a22 * a31, - b10 = a21 * a33 - a23 * a31, - b11 = a22 * a33 - a23 * a32, - - det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - return mat4( - a11 * b11 - a12 * b10 + a13 * b09, - a02 * b10 - a01 * b11 - a03 * b09, - a31 * b05 - a32 * b04 + a33 * b03, - a22 * b04 - a21 * b05 - a23 * b03, - a12 * b08 - a10 * b11 - a13 * b07, - a00 * b11 - a02 * b08 + a03 * b07, - a32 * b02 - a30 * b05 - a33 * b01, - a20 * b05 - a22 * b02 + a23 * b01, - a10 * b10 - a11 * b08 + a13 * b06, - a01 * b08 - a00 * b10 - a03 * b06, - a30 * b04 - a31 * b02 + a33 * b00, - a21 * b02 - a20 * b04 - a23 * b00, - a11 * b07 - a10 * b09 - a12 * b06, - a00 * b09 - a01 * b07 + a02 * b06, - a31 * b01 - a30 * b03 - a32 * b00, - a20 * b03 - a21 * b01 + a22 * b00) / det; - } - - #define INVERSE_MAT(mat) inverseMat(mat) - #endif - - - v2f vert(a2v v) { - v2f o; - + Varyings vert(Attributes attr) { + Varyings v; float tol = 0.0001; mat4 viewInvMat = camera_ViewInvMat; if (abs(viewInvMat[3][1]) < tol) { - viewInvMat[3][1] = tol; + viewInvMat[3][1] = tol; } mat4 projInvMat = INVERSE_MAT(camera_ProjMat); - o.nearPoint = UnprojectPoint(v.POSITION.x, v.POSITION.y, -1.0, viewInvMat, projInvMat);// unprojecting on the near plane - o.farPoint = UnprojectPoint(v.POSITION.x, v.POSITION.y, 1.0, viewInvMat, projInvMat);// unprojecting on the far plane - gl_Position = vec4(v.POSITION, 1.0);// using directly the clipped coordinates + bool flipY = camera_ProjectionParams.x < 0.0; + float x = flipY? attr.POSITION_FLIP.z : attr.POSITION_FLIP.x; + float y = flipY? attr.POSITION_FLIP.w : attr.POSITION_FLIP.y; + + v.nearPoint = UnprojectPoint(x, y, -1.0, viewInvMat, projInvMat); + v.farPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat); + gl_Position = vec4(x, y, 0.0, 1.0); + return v; } - mat4 renderer_LocalMat; - mat4 renderer_ModelMat; - mat4 camera_ViewMat; - mat4 camera_ProjMat; - mat4 renderer_MVMat; - mat4 renderer_MVPMat; - mat4 renderer_NormalMat; + #include "Common/Transform.glsl" float u_far; float u_near; @@ -130,14 +62,12 @@ Shader "Grid" { float minimumx = min(derivative.x, 1.0); vec4 color = vec4(u_gridIntensity, u_gridIntensity, u_gridIntensity, fade * (1.0 - min(line, 1.0))); // z-axis - if (fragPos3D.x > -u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx) { + if (fragPos3D.x > -u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx) color.z = 1.0; - } // x-axis or y-axis float xy = mix(fragPos3D.z, fragPos3D.y, u_flipProgress); - if (xy > -u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz) { + if (xy > -u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz) color.x = 1.0; - } return color; } @@ -151,14 +81,14 @@ Shader "Grid" { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); float clip_space_depth = clip_space_pos.z / clip_space_pos.w; float linearDepth = (2.0 * u_near * u_far) / (u_far + u_near - clip_space_depth * (u_far - u_near)); - return linearDepth / u_far;// normalize + return linearDepth / u_far; } - void frag(v2f i) { - float ty = -i.nearPoint.y / (i.farPoint.y - i.nearPoint.y); - float tz = -i.nearPoint.z / (i.farPoint.z - i.nearPoint.z); + void frag(Varyings v) { + float ty = -v.nearPoint.y / (v.farPoint.y - v.nearPoint.y); + float tz = -v.nearPoint.z / (v.farPoint.z - v.nearPoint.z); float t = mix(ty, tz, u_flipProgress); - vec3 fragPos3D = i.nearPoint + t * (i.farPoint - i.nearPoint); + vec3 fragPos3D = v.nearPoint + t * (v.farPoint - v.nearPoint); gl_FragDepth = computeDepth(fragPos3D); @@ -168,6 +98,8 @@ Shader "Grid" { // adding multiple resolution for the grid gl_FragColor = (grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade)); gl_FragColor.a *= fading; + + gl_FragColor = sRGBToLinear(gl_FragColor); } } } diff --git a/packages/custom-material/src/grid/GridMaterial.ts b/packages/custom-material/src/grid/GridMaterial.ts index 93b09709..e339e6de 100644 --- a/packages/custom-material/src/grid/GridMaterial.ts +++ b/packages/custom-material/src/grid/GridMaterial.ts @@ -1,111 +1,5 @@ import { BaseMaterial, Engine, MathUtil, Shader, ShaderProperty } from "@galacean/engine"; - -const shaderSource = `Shader "grid" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - - mat4 camera_ViewInvMat; - mat4 camera_ProjMat; - - struct Attributes { - vec4 POSITION_FLIP; - }; - - struct Varyings { - vec3 nearPoint; - vec3 farPoint; - }; - - vec3 UnprojectPoint(float x, float y, float z, mat4 viewInvMat, mat4 projInvMat) { - vec4 unprojectedPoint = viewInvMat * projInvMat * vec4(x, y, z, 1.0); - return unprojectedPoint.xyz / unprojectedPoint.w; - } - - Varyings vert(Attributes attr) { - Varyings v; - float tol = 0.0001; - mat4 viewInvMat = camera_ViewInvMat; - if (abs(viewInvMat[3][1]) < tol) { - viewInvMat[3][1] = tol; - } - mat4 projInvMat = INVERSE_MAT(camera_ProjMat); - - bool flipY = camera_ProjectionParams.x < 0.0; - float x = flipY? attr.POSITION_FLIP.z : attr.POSITION_FLIP.x; - float y = flipY? attr.POSITION_FLIP.w : attr.POSITION_FLIP.y; - - v.nearPoint = UnprojectPoint(x, y, -1.0, viewInvMat, projInvMat); - v.farPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat); - gl_Position = vec4(x, y, 0.0, 1.0); - return v; - } - - #include "Common/Transform.glsl" - - float u_far; - float u_near; - float u_primaryScale; - float u_secondaryScale; - float u_gridIntensity; - float u_axisIntensity; - float u_flipProgress; - float u_fade; - - vec4 grid(vec3 fragPos3D, float scale, float fade) { - vec2 coord = mix(fragPos3D.xz, fragPos3D.xy, u_flipProgress) * scale; - vec2 derivative = fwidth(coord); - vec2 grid = abs(fract(coord - 0.5) - 0.5) / derivative; - float line = min(grid.x, grid.y); - float minimumz = min(derivative.y, 1.0); - float minimumx = min(derivative.x, 1.0); - vec4 color = vec4(u_gridIntensity, u_gridIntensity, u_gridIntensity, fade * (1.0 - min(line, 1.0))); - // z-axis - if (fragPos3D.x > -u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx) - color.z = 1.0; - // x-axis or y-axis - float xy = mix(fragPos3D.z, fragPos3D.y, u_flipProgress); - if (xy > -u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz) - color.x = 1.0; - return color; - } - - float computeDepth(vec3 pos) { - vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); - // map to 0-1 - return (clip_space_pos.z / clip_space_pos.w) * 0.5 + 0.5; - } - - float computeLinearDepth(vec3 pos) { - vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4(pos.xyz, 1.0); - float clip_space_depth = clip_space_pos.z / clip_space_pos.w; - float linearDepth = (2.0 * u_near * u_far) / (u_far + u_near - clip_space_depth * (u_far - u_near)); - return linearDepth / u_far; - } - - void frag(Varyings v) { - float ty = -v.nearPoint.y / (v.farPoint.y - v.nearPoint.y); - float tz = -v.nearPoint.z / (v.farPoint.z - v.nearPoint.z); - float t = mix(ty, tz, u_flipProgress); - vec3 fragPos3D = v.nearPoint + t * (v.farPoint - v.nearPoint); - - gl_FragDepth = computeDepth(fragPos3D); - - float linearDepth = computeLinearDepth(fragPos3D); - float fading = max(0.0, (0.5 - linearDepth)); - - // adding multiple resolution for the grid - gl_FragColor = (grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade)); - gl_FragColor.a *= fading; - - gl_FragColor = sRGBToLinear(gl_FragColor); - } - } - } -}`; +import shaderSource from "./Grid.shader"; Shader.find("grid") || Shader.create(shaderSource); diff --git a/packages/custom-material/src/plain-color/PlainColor.shader b/packages/custom-material/src/plain-color/PlainColor.shader new file mode 100644 index 00000000..a1c37f05 --- /dev/null +++ b/packages/custom-material/src/plain-color/PlainColor.shader @@ -0,0 +1,44 @@ +Shader "plain-color" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + #include "Common/Attributes.glsl" + + void vert(Attributes attr) { + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = renderer_MVPMat * position; + } + + vec4 material_BaseColor; + + void frag() { + vec4 baseColor = material_BaseColor; + + #ifdef MATERIAL_IS_ALPHA_CUTOFF + if( baseColor.a < material_AlphaCutoff ) { + discard; + } + #endif + + gl_FragColor = baseColor; + } + } + } +} \ No newline at end of file diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index ad5937e4..6d37c279 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -1,49 +1,5 @@ import { BaseMaterial, Color, CullMode, Engine, Shader } from "@galacean/engine"; - -const shaderSource = `Shader "plain-color" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" - - #include "Common/Attributes.glsl" - - void vert(Attributes attr) { - vec4 position = vec4(attr.POSITION, 1.0); - - #ifdef RENDERER_HAS_BLENDSHAPE - calculateBlendShape(attr, position); - #endif - - #ifdef RENDERER_HAS_SKIN - mat4 skinMatrix = getSkinMatrix(attr); - position = skinMatrix * position; - #endif - - gl_Position = renderer_MVPMat * position; - } - - vec4 material_BaseColor; - - void frag() { - vec4 baseColor = material_BaseColor; - - #ifdef MATERIAL_IS_ALPHA_CUTOFF - if( baseColor.a < material_AlphaCutoff ) { - discard; - } - #endif - - gl_FragColor = baseColor; - } - } - } -}`; +import shaderSource from "./PlainColor.shader"; Shader.find("plain-color") || Shader.create(shaderSource); diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader b/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader new file mode 100644 index 00000000..6a858830 --- /dev/null +++ b/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader @@ -0,0 +1,96 @@ +Shader "PlanarShadowOnly" { + SubShader "Default" { + Pass "PlanarShadow" { + VertexShader = vert; + FragmentShader = frag; + + vec3 u_lightDir; + float u_planarHeight; + vec4 u_planarShadowColor; + float u_planarShadowFalloff; + + mat4 renderer_ModelMat; + mat4 camera_VPMat; + + struct Attributes { + vec4 POSITION; + #ifdef RENDERER_HAS_SKIN + vec4 JOINTS_0; + vec4 WEIGHTS_0; + #endif + }; + + struct Varyings { + vec4 color; + }; + + #ifdef RENDERER_HAS_SKIN + #ifdef RENDERER_USE_JOINT_TEXTURE + sampler2D renderer_JointSampler; + float renderer_JointCount; + mat4 getJointMatrix(sampler2D smp, float index) { + float base = index / renderer_JointCount; + float hf = 0.5 / renderer_JointCount; + float v = base + hf; + + vec4 m0 = texture2D(smp, vec2(0.125, v )); + vec4 m1 = texture2D(smp, vec2(0.375, v )); + vec4 m2 = texture2D(smp, vec2(0.625, v )); + vec4 m3 = texture2D(smp, vec2(0.875, v )); + + return mat4(m0, m1, m2, m3); + } + #else + mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ]; + #endif + #endif + + vec3 ShadowProjectPos(vec4 vertPos) { + vec3 shadowPos; + + vec3 worldPos = (renderer_ModelMat * vertPos).xyz; + + shadowPos.y = min(worldPos.y, u_planarHeight); + shadowPos.xz = worldPos.xz - u_lightDir.xz * max(0.0, worldPos.y - u_planarHeight) / u_lightDir.y; + + return shadowPos; + } + + Varyings vert(Attributes attr) { + Varyings v; + vec4 position = vec4(attr.POSITION.xyz, 1.0); + #ifdef RENDERER_HAS_SKIN + #ifdef RENDERER_USE_JOINT_TEXTURE + mat4 skinMatrix = + attr.WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.x) + + attr.WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.y) + + attr.WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.z) + + attr.WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.w); + #else + mat4 skinMatrix = + attr.WEIGHTS_0.x * renderer_JointMatrix[ int( attr.JOINTS_0.x ) ] + + attr.WEIGHTS_0.y * renderer_JointMatrix[ int( attr.JOINTS_0.y ) ] + + attr.WEIGHTS_0.z * renderer_JointMatrix[ int( attr.JOINTS_0.z ) ] + + attr.WEIGHTS_0.w * renderer_JointMatrix[ int( attr.JOINTS_0.w ) ]; + #endif + position = skinMatrix * position; + #endif + + vec3 shadowPos = ShadowProjectPos(position); + + gl_Position = camera_VPMat * vec4(shadowPos, 1.0); + + vec3 center = vec3(renderer_ModelMat[3].x, u_planarHeight, renderer_ModelMat[3].z); + float falloff = 0.5 - clamp(distance(shadowPos, center) * u_planarShadowFalloff, 0.0, 1.0); + + v.color = u_planarShadowColor; + v.color.a *= falloff; + return v; + } + + void frag(Varyings v) { + gl_FragColor = v.color; + } + } + } +} diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index 3376da0f..c0362015 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -5,12 +5,13 @@ import { Material, RenderQueueType, Shader, - ShaderPass, ShaderProperty, StencilOperation, Vector3 } from "@galacean/engine"; +import planarShadowOnlySource from "./PlanarShadowOnly.shader"; + export class PlanarShadowShaderFactory { private static _lightDirProp = ShaderProperty.getByName("u_lightDir"); private static _planarHeightProp = ShaderProperty.getByName("u_planarHeight"); @@ -92,104 +93,11 @@ export class PlanarShadowShaderFactory { } } -const planarShadowPassSource = ` -Pass "PlanarShadow" { - VertexShader = vert; - FragmentShader = frag; - - vec3 u_lightDir; - float u_planarHeight; - vec4 u_planarShadowColor; - float u_planarShadowFalloff; - - mat4 renderer_ModelMat; - mat4 camera_VPMat; - - struct Attributes { - vec4 POSITION; - #ifdef RENDERER_HAS_SKIN - vec4 JOINTS_0; - vec4 WEIGHTS_0; - #endif - }; - - struct Varyings { - vec4 color; - }; - - #ifdef RENDERER_HAS_SKIN - #ifdef RENDERER_USE_JOINT_TEXTURE - sampler2D renderer_JointSampler; - float renderer_JointCount; - mat4 getJointMatrix(sampler2D smp, float index) { - float base = index / renderer_JointCount; - float hf = 0.5 / renderer_JointCount; - float v = base + hf; - - vec4 m0 = texture2D(smp, vec2(0.125, v )); - vec4 m1 = texture2D(smp, vec2(0.375, v )); - vec4 m2 = texture2D(smp, vec2(0.625, v )); - vec4 m3 = texture2D(smp, vec2(0.875, v )); - - return mat4(m0, m1, m2, m3); - } - #else - mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ]; - #endif - #endif - - vec3 ShadowProjectPos(vec4 vertPos) { - vec3 shadowPos; - - vec3 worldPos = (renderer_ModelMat * vertPos).xyz; - - shadowPos.y = min(worldPos.y, u_planarHeight); - shadowPos.xz = worldPos.xz - u_lightDir.xz * max(0.0, worldPos.y - u_planarHeight) / u_lightDir.y; - - return shadowPos; - } - - Varyings vert(Attributes attr) { - Varyings v; - vec4 position = vec4(attr.POSITION.xyz, 1.0); - #ifdef RENDERER_HAS_SKIN - #ifdef RENDERER_USE_JOINT_TEXTURE - mat4 skinMatrix = - attr.WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.x) + - attr.WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.y) + - attr.WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.z) + - attr.WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, attr.JOINTS_0.w); - #else - mat4 skinMatrix = - attr.WEIGHTS_0.x * renderer_JointMatrix[ int( attr.JOINTS_0.x ) ] + - attr.WEIGHTS_0.y * renderer_JointMatrix[ int( attr.JOINTS_0.y ) ] + - attr.WEIGHTS_0.z * renderer_JointMatrix[ int( attr.JOINTS_0.z ) ] + - attr.WEIGHTS_0.w * renderer_JointMatrix[ int( attr.JOINTS_0.w ) ]; - #endif - position = skinMatrix * position; - #endif - - vec3 shadowPos = ShadowProjectPos(position); - - gl_Position = camera_VPMat * vec4(shadowPos, 1.0); - - vec3 center = vec3(renderer_ModelMat[3].x, u_planarHeight, renderer_ModelMat[3].z); - float falloff = 0.5 - clamp(distance(shadowPos, center) * u_planarShadowFalloff, 0.0, 1.0); - - v.color = u_planarShadowColor; - v.color.a *= falloff; - return v; - } - - void frag(Varyings v) { - gl_FragColor = v.color; - } -} -`; - -// @ts-ignore - ShaderPass single-arg constructor supported in engine but not yet published -const planarShadow = new ShaderPass(planarShadowPassSource); - if (!Shader.find("planarShadowShader")) { - Shader.create("planarShadowShader", [Shader.find("PBR").subShaders[0].passes[2], planarShadow]); + // The .shader file precompiles to a standalone Shader; we steal its single + // pass and combine it with PBR's shadow caster pass for the actual material + // shader. + Shader.create(planarShadowOnlySource); + const planarShadowPass = Shader.find("PlanarShadowOnly").subShaders[0].passes[0]; + Shader.create("planarShadowShader", [Shader.find("PBR").subShaders[0].passes[2], planarShadowPass]); } diff --git a/packages/custom-material/src/sources.ts b/packages/custom-material/src/sources.ts new file mode 100644 index 00000000..9073b703 --- /dev/null +++ b/packages/custom-material/src/sources.ts @@ -0,0 +1,29 @@ +/** + * Raw `.shader` source strings for editor use. + * Import from `@galacean/engine-toolkit-custom-material/sources`. + */ +import BakePBRSource from "./bake-pbr/BakePBR.shader"; +import EyeSource from "./advanced-shader/eye/Eye.shader"; +import GridSource from "./grid/Grid.shader"; +import HairSource from "./advanced-shader/hair/Hair.shader"; +import PlainColorSource from "./plain-color/PlainColor.shader"; +import PlanarShadowSource from "./planar-shadow/PlanarShadow.shader"; +import PlanarShadowOnlySource from "./planar-shadow/PlanarShadowOnly.shader"; +import SSSSource from "./advanced-shader/sss/SSS.shader"; +import WaterSource from "./water/Water.shader"; +import WaterFallSource from "./water/WaterFall.shader"; +import WaterRippleSource from "./water/WaterRipple.shader"; + +export { + BakePBRSource, + EyeSource, + GridSource, + HairSource, + PlainColorSource, + PlanarShadowSource, + PlanarShadowOnlySource, + SSSSource, + WaterSource, + WaterFallSource, + WaterRippleSource +}; diff --git a/packages/custom-material/src/water/Water.shader b/packages/custom-material/src/water/Water.shader new file mode 100644 index 00000000..28b441a5 --- /dev/null +++ b/packages/custom-material/src/water/Water.shader @@ -0,0 +1,58 @@ +Shader "water" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_time; + vec2 u_water_speed; + vec2 u_distorsion_speed; + + #include "Common/Attributes.glsl" + + struct Varyings { + vec4 v_color; + vec2 waterTexCoords; + vec2 normalTexCoords; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_UV + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * sin(u_time), u_water_speed.y * cos(u_time)); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #endif + + #ifdef RENDERER_ENABLE_VERTEXCOLOR + v.v_color = attr.COLOR_0; + #endif + return v; + } + + #include "Common/Common.glsl" + + sampler2D material_NormalTexture; + sampler2D u_waterTex; + sampler2D u_edgeTex; + + vec4 u_edgeColor; + vec2 u_edgeParam; + float u_distorsion_amount; + + void frag(Varyings v) { + vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; + vec4 waterTex = texture2D(u_waterTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + vec4 edgeTex = texture2D(u_edgeTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + + float edge = pow((v.v_color.r + edgeTex.r) * v.v_color.r, 2.0); + edge = saturate(1.0 - smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edge)); + vec4 finalCol = mix(waterTex, u_edgeColor, edge); + + gl_FragColor = finalCol; + } + } + } +} \ No newline at end of file diff --git a/packages/custom-material/src/water/WaterFall.shader b/packages/custom-material/src/water/WaterFall.shader new file mode 100644 index 00000000..721fa450 --- /dev/null +++ b/packages/custom-material/src/water/WaterFall.shader @@ -0,0 +1,69 @@ +Shader "water-fall" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_time; + vec2 u_water_speed; + vec2 u_waterfall_speed; + vec2 u_distorsion_speed; + + #include "Common/Attributes.glsl" + + struct Varyings { + vec2 waterTexCoords; + vec2 waterfallTexCoords; + vec2 normalTexCoords; + vec4 v_color; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_UV + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * u_time, u_water_speed.y * u_time); + v.waterfallTexCoords = attr.TEXCOORD_0 + vec2(u_waterfall_speed.x * u_time, u_waterfall_speed.y * u_time); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #endif + + #ifdef RENDERER_ENABLE_VERTEXCOLOR + v.v_color = attr.COLOR_0; + #endif + return v; + } + + #include "Common/Common.glsl" + + sampler2D material_NormalTexture; + sampler2D u_waterTex; + sampler2D u_waterfallTex; + sampler2D u_edgeNoiseTex; + + vec4 u_edgeColor; + vec2 u_edgeParam; + float u_distorsion_amount; + + void frag(Varyings v) { + vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; + + vec4 waterTex = texture2D(u_waterTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + vec4 waterfallTex = texture2D(u_waterfallTex, v.waterfallTexCoords + (normalTex.rg * u_distorsion_amount)); + + vec4 streamEdge = texture2D(u_edgeNoiseTex, v.waterTexCoords); + vec4 fallEdge = texture2D(u_edgeNoiseTex, v.waterfallTexCoords); + + float edgeShape = mix(fallEdge.r, streamEdge.r, v.v_color.r); + edgeShape = saturate(edgeShape * v.v_color.g); + edgeShape = saturate(smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edgeShape)); + + vec4 waterAll = mix(waterfallTex, waterTex, v.v_color.r); + vec4 finalCol = mix(waterAll, u_edgeColor, edgeShape); + + gl_FragColor = finalCol; + } + } + } +} \ No newline at end of file diff --git a/packages/custom-material/src/water/WaterMaterial.ts b/packages/custom-material/src/water/WaterMaterial.ts index ccda73d1..5885f4f7 100644 --- a/packages/custom-material/src/water/WaterMaterial.ts +++ b/packages/custom-material/src/water/WaterMaterial.ts @@ -1,63 +1,5 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; - -const shaderSource = `Shader "water" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - mat4 renderer_MVPMat; - float u_time; - vec2 u_water_speed; - vec2 u_distorsion_speed; - - #include "Common/Attributes.glsl" - - struct Varyings { - vec4 v_color; - vec2 waterTexCoords; - vec2 normalTexCoords; - }; - - Varyings vert(Attributes attr) { - Varyings v; - gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - - #ifdef RENDERER_HAS_UV - v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * sin(u_time), u_water_speed.y * cos(u_time)); - v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - #endif - - #ifdef RENDERER_ENABLE_VERTEXCOLOR - v.v_color = attr.COLOR_0; - #endif - return v; - } - - #include "Common/Common.glsl" - - sampler2D material_NormalTexture; - sampler2D u_waterTex; - sampler2D u_edgeTex; - - vec4 u_edgeColor; - vec2 u_edgeParam; - float u_distorsion_amount; - - void frag(Varyings v) { - vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; - vec4 waterTex = texture2D(u_waterTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); - vec4 edgeTex = texture2D(u_edgeTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); - - float edge = pow((v.v_color.r + edgeTex.r) * v.v_color.r, 2.0); - edge = saturate(1.0 - smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edge)); - vec4 finalCol = mix(waterTex, u_edgeColor, edge); - - gl_FragColor = finalCol; - } - } - } -}`; +import shaderSource from "./Water.shader"; Shader.find("water") || Shader.create(shaderSource); diff --git a/packages/custom-material/src/water/WaterRipple.shader b/packages/custom-material/src/water/WaterRipple.shader new file mode 100644 index 00000000..c8d54f93 --- /dev/null +++ b/packages/custom-material/src/water/WaterRipple.shader @@ -0,0 +1,53 @@ +Shader "water-ripple" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_time; + vec2 u_foam_speed; + vec2 u_distorsion_speed; + + #include "Common/Attributes.glsl" + + struct Varyings { + vec2 waterTexCoords; + vec2 normalTexCoords; + vec4 v_color; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + #ifdef RENDERER_HAS_UV + v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_foam_speed.x * u_time, u_foam_speed.y * u_time); + v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); + #endif + #ifdef RENDERER_ENABLE_VERTEXCOLOR + v.v_color = attr.COLOR_0; + #endif + return v; + } + + #include "Common/Common.glsl" + + sampler2D material_NormalTexture; + sampler2D u_foamTex; + vec3 u_foamColor; + vec2 u_foam_param; + float u_distorsion_amount; + + void frag(Varyings v) { + vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; + vec4 waterTex = texture2D(u_foamTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); + float alphaComp = v.v_color.r * waterTex.r * u_foam_param.x; + float alpha = pow(alphaComp, 2.0); + alpha = smoothstep(0.5 - u_foam_param.y, 0.5 + u_foam_param.y, alpha); + alpha = saturate(alpha); + + gl_FragColor = vec4(u_foamColor.rgb, alpha); + } + } + } +} \ No newline at end of file diff --git a/packages/custom-material/src/water/WaterRippleMaterial.ts b/packages/custom-material/src/water/WaterRippleMaterial.ts index 20cc254d..1422b245 100644 --- a/packages/custom-material/src/water/WaterRippleMaterial.ts +++ b/packages/custom-material/src/water/WaterRippleMaterial.ts @@ -1,58 +1,5 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector3 } from "@galacean/engine"; - -const shaderSource = `Shader "water-ripple" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - mat4 renderer_MVPMat; - float u_time; - vec2 u_foam_speed; - vec2 u_distorsion_speed; - - #include "Common/Attributes.glsl" - - struct Varyings { - vec2 waterTexCoords; - vec2 normalTexCoords; - vec4 v_color; - }; - - Varyings vert(Attributes attr) { - Varyings v; - gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - #ifdef RENDERER_HAS_UV - v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_foam_speed.x * u_time, u_foam_speed.y * u_time); - v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - #endif - #ifdef RENDERER_ENABLE_VERTEXCOLOR - v.v_color = attr.COLOR_0; - #endif - return v; - } - - #include "Common/Common.glsl" - - sampler2D material_NormalTexture; - sampler2D u_foamTex; - vec3 u_foamColor; - vec2 u_foam_param; - float u_distorsion_amount; - - void frag(Varyings v) { - vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; - vec4 waterTex = texture2D(u_foamTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); - float alphaComp = v.v_color.r * waterTex.r * u_foam_param.x; - float alpha = pow(alphaComp, 2.0); - alpha = smoothstep(0.5 - u_foam_param.y, 0.5 + u_foam_param.y, alpha); - alpha = saturate(alpha); - - gl_FragColor = vec4(u_foamColor.rgb, alpha); - } - } - } -}`; +import shaderSource from "./WaterRipple.shader"; Shader.find("water-ripple") || Shader.create(shaderSource); diff --git a/packages/custom-material/src/water/WaterfallMaterial.ts b/packages/custom-material/src/water/WaterfallMaterial.ts index 9cfd705a..a5f0326d 100644 --- a/packages/custom-material/src/water/WaterfallMaterial.ts +++ b/packages/custom-material/src/water/WaterfallMaterial.ts @@ -1,74 +1,5 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; - -const shaderSource = `Shader "water-fall" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - mat4 renderer_MVPMat; - float u_time; - vec2 u_water_speed; - vec2 u_waterfall_speed; - vec2 u_distorsion_speed; - - #include "Common/Attributes.glsl" - - struct Varyings { - vec2 waterTexCoords; - vec2 waterfallTexCoords; - vec2 normalTexCoords; - vec4 v_color; - }; - - Varyings vert(Attributes attr) { - Varyings v; - gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - - #ifdef RENDERER_HAS_UV - v.waterTexCoords = attr.TEXCOORD_0 + vec2(u_water_speed.x * u_time, u_water_speed.y * u_time); - v.waterfallTexCoords = attr.TEXCOORD_0 + vec2(u_waterfall_speed.x * u_time, u_waterfall_speed.y * u_time); - v.normalTexCoords = attr.TEXCOORD_0 + vec2(u_distorsion_speed.x * cos(u_time), u_distorsion_speed.y * sin(u_time)); - #endif - - #ifdef RENDERER_ENABLE_VERTEXCOLOR - v.v_color = attr.COLOR_0; - #endif - return v; - } - - #include "Common/Common.glsl" - - sampler2D material_NormalTexture; - sampler2D u_waterTex; - sampler2D u_waterfallTex; - sampler2D u_edgeNoiseTex; - - vec4 u_edgeColor; - vec2 u_edgeParam; - float u_distorsion_amount; - - void frag(Varyings v) { - vec4 normalTex = texture2D(material_NormalTexture, v.normalTexCoords) * 2.0 - 1.0; - - vec4 waterTex = texture2D(u_waterTex, v.waterTexCoords + (normalTex.rg * u_distorsion_amount)); - vec4 waterfallTex = texture2D(u_waterfallTex, v.waterfallTexCoords + (normalTex.rg * u_distorsion_amount)); - - vec4 streamEdge = texture2D(u_edgeNoiseTex, v.waterTexCoords); - vec4 fallEdge = texture2D(u_edgeNoiseTex, v.waterfallTexCoords); - - float edgeShape = mix(fallEdge.r, streamEdge.r, v.v_color.r); - edgeShape = saturate(edgeShape * v.v_color.g); - edgeShape = saturate(smoothstep(u_edgeParam.x - u_edgeParam.y, u_edgeParam.x + u_edgeParam.y, edgeShape)); - - vec4 waterAll = mix(waterfallTex, waterTex, v.v_color.r); - vec4 finalCol = mix(waterAll, u_edgeColor, edgeShape); - - gl_FragColor = finalCol; - } - } - } -}`; +import shaderSource from "./WaterFall.shader"; Shader.find("water-fall") || Shader.create(shaderSource); diff --git a/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp b/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp new file mode 100644 index 00000000..bac053ef --- /dev/null +++ b/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp @@ -0,0 +1 @@ +{"name":"framebuffer-picker-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec3 u_pickColor;\nvoid main() { gl_FragColor = vec4 ( u_pickColor , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/libs/index.ts new file mode 100644 index 00000000..6bd1d978 --- /dev/null +++ b/packages/framebuffer-picker/libs/index.ts @@ -0,0 +1,6 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import FramebufferPickerColorSource from "./FramebufferPickerColor.gsp"; + +export { + FramebufferPickerColorSource +}; diff --git a/packages/framebuffer-picker/package.json b/packages/framebuffer-picker/package.json index f199a72a..b8ad7334 100755 --- a/packages/framebuffer-picker/package.json +++ b/packages/framebuffer-picker/package.json @@ -15,7 +15,8 @@ }, "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { - "b:types": "tsc" + "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index" }, "types": "types/index.d.ts", "files": [ diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index 328dd4fa..7ff15943 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -19,56 +19,7 @@ import { Vector3 } from "@galacean/engine"; -const colorShaderSource = `Shader "framebuffer-picker-color" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" - - #include "Common/Attributes.glsl" - - void vert(Attributes attr) { - vec4 position = vec4(attr.POSITION, 1.0); - - #ifdef RENDERER_HAS_NORMAL - vec3 normal = vec3(attr.NORMAL); - #ifdef RENDERER_HAS_TANGENT - vec4 tangent = vec4(attr.TANGENT); - #endif - #endif - - #ifdef RENDERER_HAS_BLENDSHAPE - calculateBlendShape(attr, position - #ifdef RENDERER_HAS_NORMAL - , normal - #ifdef RENDERER_HAS_TANGENT - , tangent - #endif - #endif - ); - #endif - - #ifdef RENDERER_HAS_SKIN - mat4 skinMatrix = getSkinMatrix(attr); - position = skinMatrix * position; - #endif - - gl_Position = renderer_MVPMat * position; - } - - vec3 u_pickColor; - - void frag() { - gl_FragColor = vec4(u_pickColor, 1.0); - } - } - } -}`; +import colorShaderSource from "./FramebufferPickerColor.shader"; const pickShader = Shader.find("framebuffer-picker-color") || Shader.create(colorShaderSource); pickShader.subShaders.forEach((subShader: SubShader) => { diff --git a/packages/framebuffer-picker/src/FramebufferPickerColor.shader b/packages/framebuffer-picker/src/FramebufferPickerColor.shader new file mode 100644 index 00000000..a8d86398 --- /dev/null +++ b/packages/framebuffer-picker/src/FramebufferPickerColor.shader @@ -0,0 +1,50 @@ +Shader "framebuffer-picker-color" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + #include "Common/Attributes.glsl" + + void vert(Attributes attr) { + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(attr.NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(attr.TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position + #ifdef RENDERER_HAS_NORMAL + , normal + #ifdef RENDERER_HAS_TANGENT + , tangent + #endif + #endif + ); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = renderer_MVPMat * position; + } + + vec3 u_pickColor; + + void frag() { + gl_FragColor = vec4(u_pickColor, 1.0); + } + } + } +} diff --git a/packages/framebuffer-picker/src/global.d.ts b/packages/framebuffer-picker/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/framebuffer-picker/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/libs/index.ts new file mode 100644 index 00000000..5942bd02 --- /dev/null +++ b/packages/geometry-sketch/libs/index.ts @@ -0,0 +1,8 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import TBNSource from "./material/TBN.gsp"; +import WireframeSource from "./material/Wireframe.gsp"; + +export { + TBNSource, + WireframeSource +}; diff --git a/packages/geometry-sketch/libs/material/TBN.gsp b/packages/geometry-sketch/libs/material/TBN.gsp new file mode 100644 index 00000000..ad9af603 --- /dev/null +++ b/packages/geometry-sketch/libs/material/TBN.gsp @@ -0,0 +1 @@ +{"name":"tbnShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float u_lineScale;\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform mat4 u_worldNormal;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { int pointIndex = gl_VertexID / 2 ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},156],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\ngl_Position.xyz += normalize ( normalW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},160],[0," if ( gl_VertexID % 2 == 1 ) { vec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\ngl_Position.xyz += normalize ( tangentW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"SHOW_BITANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},164],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\nvec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\nvec3 bitangentW = cross ( normalW , tangentW ) * tangent.w ;\ngl_Position.xyz += normalize ( bitangentW ) * u_lineScale ; } \n"],[6],[0,"\ngl_Position = camera_VPMat * gl_Position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { gl_FragColor = material_BaseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/geometry-sketch/libs/material/Wireframe.gsp b/packages/geometry-sketch/libs/material/Wireframe.gsp new file mode 100644 index 00000000..45b1a8d3 --- /dev/null +++ b/packages/geometry-sketch/libs/material/Wireframe.gsp @@ -0,0 +1 @@ +{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file diff --git a/packages/geometry-sketch/package.json b/packages/geometry-sketch/package.json index 284727f1..1b9eeb2f 100644 --- a/packages/geometry-sketch/package.json +++ b/packages/geometry-sketch/package.json @@ -14,6 +14,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/index.d.ts", diff --git a/packages/geometry-sketch/src/global.d.ts b/packages/geometry-sketch/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/geometry-sketch/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/geometry-sketch/src/material/GeometryShader.ts b/packages/geometry-sketch/src/material/GeometryShader.ts deleted file mode 100644 index 3ec2a178..00000000 --- a/packages/geometry-sketch/src/material/GeometryShader.ts +++ /dev/null @@ -1,100 +0,0 @@ -export const geometryTextureDefine = ` - sampler2D u_verticesSampler; - float u_verticesTextureWidth; - float u_verticesTextureHeight; - - sampler2D u_indicesSampler; - float u_indicesTextureWidth; - float u_indicesTextureHeight; - - vec4 getVertexElement(float row, float col) { - return texture2D(u_verticesSampler, vec2((col + 0.5) / u_verticesTextureWidth, (row + 0.5) / u_verticesTextureHeight)); - } - - vec3 getIndicesElement(float row, float col) { - return texture2D(u_indicesSampler, vec2((col + 0.5) / u_indicesTextureWidth, (row + 0.5) / u_indicesTextureHeight )).xyz; - } - - vec2 getVec2(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float x = rows[row_index][value_index]; - - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float y = rows[row_index][value_index]; - - return vec2(x, y); - } - - vec3 getVec3(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float x = rows[row_index][value_index]; - - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float y = rows[row_index][value_index]; - - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float z = rows[row_index][value_index]; - return vec3(x, y, z); - } - - vec4 getVec4(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float x = rows[row_index][value_index]; - - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float y = rows[row_index][value_index]; - - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float z = rows[row_index][value_index]; - - row_index += (value_index+1)/4; - value_index = (value_index+1)%4; - float w = rows[row_index][value_index]; - return vec4(x, y, z, w); - } -`; - -export const geometryTextureVert = ` - int row = pointIndex * ELEMENT_COUNT / int(u_verticesTextureWidth); - int col = pointIndex * ELEMENT_COUNT % int(u_verticesTextureWidth); - - vec4 rows[ELEMENT_COUNT]; - for( int i = 0; i < ELEMENT_COUNT; i++ ) { - rows[i] = getVertexElement(float(row), float(col + i)); - } - - vec3 POSITION = vec3(rows[0].x, rows[0].y, rows[0].z); - int row_index = 0; - int value_index = 2; -#ifdef RENDERER_HAS_NORMAL - vec3 NORMAL = getVec3(rows, row_index, value_index); -#endif - -#ifdef RENDERER_HAS_VERTEXCOLOR - vec4 COLOR_0 = getVec4(rows, row_index, value_index); -#endif - -#ifdef RENDERER_HAS_WEIGHT - vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index); -#endif - -#ifdef RENDERER_HAS_JOINT - vec4 JOINTS_0 = getVec4(rows, row_index, value_index); -#endif - -#ifdef RENDERER_HAS_TANGENT - vec4 TANGENT = getVec4(rows, row_index, value_index); -#endif - -#ifdef RENDERER_HAS_UV - vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index); -#endif -`; diff --git a/packages/geometry-sketch/src/material/GeometryTextureDefine.glsl b/packages/geometry-sketch/src/material/GeometryTextureDefine.glsl new file mode 100644 index 00000000..7fdcbb9c --- /dev/null +++ b/packages/geometry-sketch/src/material/GeometryTextureDefine.glsl @@ -0,0 +1,61 @@ +sampler2D u_verticesSampler; +float u_verticesTextureWidth; +float u_verticesTextureHeight; + +sampler2D u_indicesSampler; +float u_indicesTextureWidth; +float u_indicesTextureHeight; + +vec4 getVertexElement(float row, float col) { + return texture2D(u_verticesSampler, vec2((col + 0.5) / u_verticesTextureWidth, (row + 0.5) / u_verticesTextureHeight)); +} + +vec3 getIndicesElement(float row, float col) { + return texture2D(u_indicesSampler, vec2((col + 0.5) / u_indicesTextureWidth, (row + 0.5) / u_indicesTextureHeight )).xyz; +} + +vec2 getVec2(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float x = rows[row_index][value_index]; + + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float y = rows[row_index][value_index]; + + return vec2(x, y); +} + +vec3 getVec3(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float x = rows[row_index][value_index]; + + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float y = rows[row_index][value_index]; + + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float z = rows[row_index][value_index]; + return vec3(x, y, z); +} + +vec4 getVec4(inout vec4[ELEMENT_COUNT] rows, inout int row_index, inout int value_index) { + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float x = rows[row_index][value_index]; + + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float y = rows[row_index][value_index]; + + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float z = rows[row_index][value_index]; + + row_index += (value_index+1)/4; + value_index = (value_index+1)%4; + float w = rows[row_index][value_index]; + return vec4(x, y, z, w); +} diff --git a/packages/geometry-sketch/src/material/GeometryTextureVert.glsl b/packages/geometry-sketch/src/material/GeometryTextureVert.glsl new file mode 100644 index 00000000..0e811ca7 --- /dev/null +++ b/packages/geometry-sketch/src/material/GeometryTextureVert.glsl @@ -0,0 +1,34 @@ +int row = pointIndex * ELEMENT_COUNT / int(u_verticesTextureWidth); +int col = pointIndex * ELEMENT_COUNT % int(u_verticesTextureWidth); + +vec4 rows[ELEMENT_COUNT]; +for( int i = 0; i < ELEMENT_COUNT; i++ ) { + rows[i] = getVertexElement(float(row), float(col + i)); +} + +vec3 POSITION = vec3(rows[0].x, rows[0].y, rows[0].z); +int row_index = 0; +int value_index = 2; +#ifdef RENDERER_HAS_NORMAL +vec3 NORMAL = getVec3(rows, row_index, value_index); +#endif + +#ifdef RENDERER_HAS_VERTEXCOLOR +vec4 COLOR_0 = getVec4(rows, row_index, value_index); +#endif + +#ifdef RENDERER_HAS_WEIGHT +vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index); +#endif + +#ifdef RENDERER_HAS_JOINT +vec4 JOINTS_0 = getVec4(rows, row_index, value_index); +#endif + +#ifdef RENDERER_HAS_TANGENT +vec4 TANGENT = getVec4(rows, row_index, value_index); +#endif + +#ifdef RENDERER_HAS_UV +vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index); +#endif diff --git a/packages/geometry-sketch/src/material/TBN.shader b/packages/geometry-sketch/src/material/TBN.shader new file mode 100644 index 00000000..1604d693 --- /dev/null +++ b/packages/geometry-sketch/src/material/TBN.shader @@ -0,0 +1,73 @@ +Shader "tbnShader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + + float u_lineScale; + mat4 camera_VPMat; + mat4 u_worldMatrix; + mat4 u_worldNormal; + + #include "./GeometryTextureDefine.glsl" + + #include "Common/Attributes.glsl" + + void vert(Attributes attr) { + int pointIndex = gl_VertexID / 2; + #include "./GeometryTextureVert.glsl" + + vec4 position = vec4(POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = u_worldMatrix * position; + + #if defined(SHOW_NORMAL) && defined(RENDERER_HAS_NORMAL) + if (gl_VertexID % 2 == 1) { + vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); + gl_Position.xyz += normalize(normalW) * u_lineScale; + } + #endif + + #if defined(SHOW_TANGENT) && defined(RENDERER_HAS_TANGENT) + if (gl_VertexID % 2 == 1) { + vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); + gl_Position.xyz += normalize(tangentW) * u_lineScale; + } + #endif + + #if defined(SHOW_BITANGENT) && defined(RENDERER_HAS_TANGENT) && defined(RENDERER_HAS_NORMAL) + if (gl_VertexID % 2 == 1) { + vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); + vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); + vec3 bitangentW = cross( normalW, tangentW ) * tangent.w; + gl_Position.xyz += normalize(bitangentW) * u_lineScale; + } + #endif + + gl_Position = camera_VPMat * gl_Position; + } + + vec4 material_BaseColor; + + void frag() { + gl_FragColor = material_BaseColor; + } + } + } +} diff --git a/packages/geometry-sketch/src/material/TBNMaterial.ts b/packages/geometry-sketch/src/material/TBNMaterial.ts index def99cbe..dca430d7 100644 --- a/packages/geometry-sketch/src/material/TBNMaterial.ts +++ b/packages/geometry-sketch/src/material/TBNMaterial.ts @@ -1,79 +1,6 @@ import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; -import { geometryTextureDefine, geometryTextureVert } from "./GeometryShader"; -const shaderSource = `Shader "tbnShader" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - - float u_lineScale; - mat4 camera_VPMat; - mat4 u_worldMatrix; - mat4 u_worldNormal; - - ${geometryTextureDefine} - - #include "Common/Attributes.glsl" - - void vert(Attributes attr) { - int pointIndex = gl_VertexID / 2; - ${geometryTextureVert} - - vec4 position = vec4(POSITION, 1.0); - - #ifdef RENDERER_HAS_NORMAL - vec3 normal = vec3(NORMAL); - #ifdef RENDERER_HAS_TANGENT - vec4 tangent = vec4(TANGENT); - #endif - #endif - - #ifdef RENDERER_HAS_SKIN - mat4 skinMatrix = getSkinMatrix(attr); - position = skinMatrix * position; - #endif - - gl_Position = u_worldMatrix * position; - - #if defined(SHOW_NORMAL) && defined(RENDERER_HAS_NORMAL) - if (gl_VertexID % 2 == 1) { - vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); - gl_Position.xyz += normalize(normalW) * u_lineScale; - } - #endif - - #if defined(SHOW_TANGENT) && defined(RENDERER_HAS_TANGENT) - if (gl_VertexID % 2 == 1) { - vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); - gl_Position.xyz += normalize(tangentW) * u_lineScale; - } - #endif - - #if defined(SHOW_BITANGENT) && defined(RENDERER_HAS_TANGENT) && defined(RENDERER_HAS_NORMAL) - if (gl_VertexID % 2 == 1) { - vec3 normalW = normalize( mat3(u_worldNormal) * normal.xyz ); - vec3 tangentW = normalize( mat3(u_worldNormal) * tangent.xyz ); - vec3 bitangentW = cross( normalW, tangentW ) * tangent.w; - gl_Position.xyz += normalize(bitangentW) * u_lineScale; - } - #endif - - gl_Position = camera_VPMat * gl_Position; - } - - vec4 material_BaseColor; - - void frag() { - gl_FragColor = material_BaseColor; - } - } - } -}`; +import shaderSource from "./TBN.shader"; Shader.find("tbnShader") || Shader.create(shaderSource); diff --git a/packages/geometry-sketch/src/material/Wireframe.shader b/packages/geometry-sketch/src/material/Wireframe.shader new file mode 100644 index 00000000..a254392f --- /dev/null +++ b/packages/geometry-sketch/src/material/Wireframe.shader @@ -0,0 +1,74 @@ +Shader "wireframeShader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + + float u_lineScale; + mat4 camera_VPMat; + mat4 u_worldMatrix; + mat4 u_worldNormal; + + #include "./GeometryTextureDefine.glsl" + + #include "Common/Attributes.glsl" + + struct Varyings { + vec3 v_baryCenter; + }; + + Varyings vert(Attributes attr) { + Varyings v; + int indicesIndex = gl_VertexID / 3; + int indicesRow = indicesIndex / int(u_indicesTextureWidth); + int indicesCol = indicesIndex % int(u_indicesTextureWidth); + vec3 triangleIndices = getIndicesElement(float(indicesRow), float(indicesCol)); + int subIndex = gl_VertexID % 3; + v.v_baryCenter = vec3(0.0); + v.v_baryCenter[subIndex] = 1.0; + + int pointIndex = int(triangleIndices[subIndex]); + #include "./GeometryTextureVert.glsl" + + vec4 position = vec4(POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = u_worldMatrix * position; + gl_Position = camera_VPMat * gl_Position; + return v; + } + + vec4 material_BaseColor; + + float edgeFactor(vec3 baryCenter) { + vec3 d = fwidth(baryCenter); + vec3 a3 = smoothstep(vec3(0.0), d * 1.5, baryCenter); + return min(min(a3.x, a3.y), a3.z); + } + + void frag(Varyings v) { + if (gl_FrontFacing) { + gl_FragColor = vec4(material_BaseColor.xyz, 1.0 - edgeFactor(v.v_baryCenter)); + } else { + // fade back face + gl_FragColor = vec4(material_BaseColor.xyz, (1.0 - edgeFactor(v.v_baryCenter)) * 0.3); + } + } + } + } +} diff --git a/packages/geometry-sketch/src/material/WireframeMaterial.ts b/packages/geometry-sketch/src/material/WireframeMaterial.ts index 70ceb5dc..e7cb439a 100644 --- a/packages/geometry-sketch/src/material/WireframeMaterial.ts +++ b/packages/geometry-sketch/src/material/WireframeMaterial.ts @@ -1,80 +1,6 @@ import { BaseMaterial, Color, Engine, RenderFace, Shader } from "@galacean/engine"; -import { geometryTextureDefine, geometryTextureVert } from "./GeometryShader"; -const shaderSource = `Shader "wireframeShader" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - - float u_lineScale; - mat4 camera_VPMat; - mat4 u_worldMatrix; - mat4 u_worldNormal; - - ${geometryTextureDefine} - - #include "Common/Attributes.glsl" - - struct Varyings { - vec3 v_baryCenter; - }; - - Varyings vert(Attributes attr) { - Varyings v; - int indicesIndex = gl_VertexID / 3; - int indicesRow = indicesIndex / int(u_indicesTextureWidth); - int indicesCol = indicesIndex % int(u_indicesTextureWidth); - vec3 triangleIndices = getIndicesElement(float(indicesRow), float(indicesCol)); - int subIndex = gl_VertexID % 3; - v.v_baryCenter = vec3(0.0); - v.v_baryCenter[subIndex] = 1.0; - - int pointIndex = int(triangleIndices[subIndex]); - ${geometryTextureVert} - - vec4 position = vec4(POSITION, 1.0); - - #ifdef RENDERER_HAS_NORMAL - vec3 normal = vec3(NORMAL); - #ifdef RENDERER_HAS_TANGENT - vec4 tangent = vec4(TANGENT); - #endif - #endif - - #ifdef RENDERER_HAS_SKIN - mat4 skinMatrix = getSkinMatrix(attr); - position = skinMatrix * position; - #endif - - gl_Position = u_worldMatrix * position; - gl_Position = camera_VPMat * gl_Position; - return v; - } - - vec4 material_BaseColor; - - float edgeFactor(vec3 baryCenter) { - vec3 d = fwidth(baryCenter); - vec3 a3 = smoothstep(vec3(0.0), d * 1.5, baryCenter); - return min(min(a3.x, a3.y), a3.z); - } - - void frag(Varyings v) { - if (gl_FrontFacing) { - gl_FragColor = vec4(material_BaseColor.xyz, 1.0 - edgeFactor(v.v_baryCenter)); - } else { - // fade back face - gl_FragColor = vec4(material_BaseColor.xyz, (1.0 - edgeFactor(v.v_baryCenter)) * 0.3); - } - } - } - } -}`; +import shaderSource from "./Wireframe.shader"; Shader.find("wireframeShader") || Shader.create(shaderSource); diff --git a/packages/gizmo/libs/icon/Icon.gsp b/packages/gizmo/libs/icon/Icon.gsp new file mode 100644 index 00000000..5716c58a --- /dev/null +++ b/packages/gizmo/libs/icon/Icon.gsp @@ -0,0 +1 @@ +{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/libs/index.ts new file mode 100644 index 00000000..2f40a7b0 --- /dev/null +++ b/packages/gizmo/libs/index.ts @@ -0,0 +1,6 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import IconSource from "./icon/Icon.gsp"; + +export { + IconSource +}; diff --git a/packages/gizmo/package.json b/packages/gizmo/package.json index 4821d518..e650b5e6 100644 --- a/packages/gizmo/package.json +++ b/packages/gizmo/package.json @@ -14,6 +14,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/index.d.ts", diff --git a/packages/gizmo/src/global.d.ts b/packages/gizmo/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/gizmo/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/gizmo/src/icon/Icon.shader b/packages/gizmo/src/icon/Icon.shader new file mode 100644 index 00000000..646c4e63 --- /dev/null +++ b/packages/gizmo/src/icon/Icon.shader @@ -0,0 +1,70 @@ +Shader "icon" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + vec2 u_size; + vec4 u_pixelViewport; + + #include "Common/Attributes.glsl" + + struct Varyings { + vec2 v_uv; + }; + + Varyings vert(Attributes attr) { + Varyings v; + + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + vec4 translation = renderer_MVPMat[3]; + translation = translation / translation.w; + float xFactor = u_size.x / u_pixelViewport.z * 2.0; + float yFactor = u_size.y / u_pixelViewport.w * 2.0; + gl_Position = vec4(translation.x + xFactor * position.x, translation.y + yFactor * position.y, translation.z, 1); + #ifdef RENDERER_HAS_UV + v.v_uv = attr.TEXCOORD_0; + #endif + + return v; + } + + vec4 material_BaseColor; + #ifdef MATERIAL_HAS_BASETEXTURE + sampler2D material_BaseTexture; + #endif + + void frag(Varyings v) { + vec4 baseColor = material_BaseColor; + + #ifdef MATERIAL_HAS_BASETEXTURE + vec4 textureColor = texture2D(material_BaseTexture, v.v_uv); + baseColor.a *= textureColor.a; + #endif + + #ifdef MATERIAL_IS_ALPHA_CUTOFF + if( baseColor.a < material_AlphaCutoff ) { + discard; + } + #endif + + gl_FragColor = baseColor; + } + } + } +} diff --git a/packages/gizmo/src/icon/IconMaterial.ts b/packages/gizmo/src/icon/IconMaterial.ts index a1daaeb9..cdd98382 100644 --- a/packages/gizmo/src/icon/IconMaterial.ts +++ b/packages/gizmo/src/icon/IconMaterial.ts @@ -1,75 +1,6 @@ import { BaseMaterial, Color, CullMode, Engine, Shader, Texture2D } from "@galacean/engine"; -const shaderSource = `Shader "icon" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" - - vec2 u_size; - vec4 u_pixelViewport; - - #include "Common/Attributes.glsl" - - struct Varyings { - vec2 v_uv; - }; - - Varyings vert(Attributes attr) { - Varyings v; - - vec4 position = vec4(attr.POSITION, 1.0); - - #ifdef RENDERER_HAS_BLENDSHAPE - calculateBlendShape(attr, position); - #endif - - #ifdef RENDERER_HAS_SKIN - mat4 skinMatrix = getSkinMatrix(attr); - position = skinMatrix * position; - #endif - - vec4 translation = renderer_MVPMat[3]; - translation = translation / translation.w; - float xFactor = u_size.x / u_pixelViewport.z * 2.0; - float yFactor = u_size.y / u_pixelViewport.w * 2.0; - gl_Position = vec4(translation.x + xFactor * position.x, translation.y + yFactor * position.y, translation.z, 1); - #ifdef RENDERER_HAS_UV - v.v_uv = attr.TEXCOORD_0; - #endif - - return v; - } - - vec4 material_BaseColor; - #ifdef MATERIAL_HAS_BASETEXTURE - sampler2D material_BaseTexture; - #endif - - void frag(Varyings v) { - vec4 baseColor = material_BaseColor; - - #ifdef MATERIAL_HAS_BASETEXTURE - vec4 textureColor = texture2D(material_BaseTexture, v.v_uv); - baseColor.a *= textureColor.a; - #endif - - #ifdef MATERIAL_IS_ALPHA_CUTOFF - if( baseColor.a < material_AlphaCutoff ) { - discard; - } - #endif - - gl_FragColor = baseColor; - } - } - } -}`; +import shaderSource from "./Icon.shader"; Shader.find("icon") || Shader.create(shaderSource); diff --git a/packages/lines/libs/index.ts b/packages/lines/libs/index.ts new file mode 100644 index 00000000..7c42eb69 --- /dev/null +++ b/packages/lines/libs/index.ts @@ -0,0 +1,8 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import DashSource from "./line/material/Dash.gsp"; +import LineSource from "./line/material/Line.gsp"; + +export { + DashSource, + LineSource +}; diff --git a/packages/lines/libs/line/material/Dash.gsp b/packages/lines/libs/line/material/Dash.gsp new file mode 100644 index 00000000..292c1fd6 --- /dev/null +++ b/packages/lines/libs/line/material/Dash.gsp @@ -0,0 +1 @@ +{"name":"dash","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_width;\nuniform vec2 u_dash;\nattribute vec2 a_pos;\nattribute vec2 a_normal;\nattribute vec2 a_data;\nattribute float a_lengthsofar;\n\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_direction;\nvarying float v_part;\nvarying vec2 v_tex;\n\nvoid main() { \nv_direction = a_data.x ;\nv_part = a_data.y ;\nfloat layer_index = 1.0 ;\nv_origin = a_pos ;\nfloat texcoord_y = 0.0 ;\ntexcoord_y = a_lengthsofar / ( u_dash.x + u_dash.y ) ;\nif ( v_direction == 1.0 ) { v_tex = vec2 ( 1.0 , texcoord_y ) ; } else { v_tex = vec2 ( 0.0 , texcoord_y ) ; }\nvec2 position = a_pos + a_normal * u_width ;\nv_position = position ;\ngl_Position = renderer_MVPMat * vec4 ( position , 0.0 , 1 ) ;\n }"]],"fragmentShaderInstructions":[[0,"uniform float u_width;\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_part;\nvarying vec2 v_tex;\n\nuniform vec4 u_color;\nuniform int u_join;\nuniform int u_cap;\nuniform sampler2D u_texture;\nfloat IS_CAP = 0.0;\nvoid main() { vec4 finalColor ;\nif ( u_cap == 0 && v_part == IS_CAP ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nif ( u_join == 1 && v_part > 1.5 ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nvec4 textureColor = texture2D ( u_texture , v_tex ) ;\nif ( textureColor.a <= 0.5 ) { gl_FragColor = vec4 ( u_color.rgb , 0.0 ) ; } else { gl_FragColor = u_color ; } }"]]}]}]} \ No newline at end of file diff --git a/packages/lines/libs/line/material/Line.gsp b/packages/lines/libs/line/material/Line.gsp new file mode 100644 index 00000000..084991dd --- /dev/null +++ b/packages/lines/libs/line/material/Line.gsp @@ -0,0 +1 @@ +{"name":"line","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_width;\nattribute vec2 a_pos;\nattribute vec2 a_normal;\nattribute vec2 a_data;\n\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_direction;\nvarying float v_part;\n\nvoid main() { \nv_direction = a_data.x ;\nv_part = a_data.y ;\nfloat layer_index = 1.0 ;\nv_origin = a_pos ;\nvec2 position = a_pos + a_normal * u_width ;\nv_position = position ;\ngl_Position = renderer_MVPMat * vec4 ( position , 0.0 , 1 ) ;\n }"]],"fragmentShaderInstructions":[[0,"uniform float u_width;\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_part;\n\nuniform vec4 u_color;\nuniform int u_join;\nuniform int u_cap;\nfloat IS_CAP = 0.0;\nvoid main() { vec4 finalColor ;\nif ( u_cap == 0 && v_part == IS_CAP ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nif ( u_join == 1 && v_part > 1.0 ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\ngl_FragColor = u_color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/lines/package.json b/packages/lines/package.json index 14810d2f..2236b2e0 100644 --- a/packages/lines/package.json +++ b/packages/lines/package.json @@ -14,6 +14,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/index.d.ts", diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts index 26c59c0d..4814c4df 100644 --- a/packages/lines/src/global.d.ts +++ b/packages/lines/src/global.d.ts @@ -1 +1,6 @@ declare module "*.wasm"; + +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/lines/src/line/material/Dash.shader b/packages/lines/src/line/material/Dash.shader new file mode 100644 index 00000000..4d9a71cf --- /dev/null +++ b/packages/lines/src/line/material/Dash.shader @@ -0,0 +1,76 @@ +Shader "dash" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_width; + vec2 u_dash; + + struct Attributes { + vec2 a_pos; + vec2 a_normal; + vec2 a_data; + float a_lengthsofar; + }; + + struct Varyings { + vec2 v_origin; + vec2 v_position; + float v_direction; + float v_part; + vec2 v_tex; + }; + + Varyings vert(Attributes attr) { + Varyings v; + v.v_direction = attr.a_data.x; + v.v_part = attr.a_data.y; + float layer_index = 1.0; + + v.v_origin = attr.a_pos; + + float texcoord_y = 0.0; + + texcoord_y = attr.a_lengthsofar / (u_dash.x + u_dash.y); + if (v.v_direction == 1.0) { + v.v_tex = vec2(1.0, texcoord_y); + } else { + v.v_tex = vec2(0.0, texcoord_y); + } + vec2 position = attr.a_pos + attr.a_normal * u_width; + v.v_position = position; + gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); + return v; + } + + vec4 u_color; + int u_join; + int u_cap; + sampler2D u_texture; + + float IS_CAP = 0.0; + + void frag(Varyings v) { + vec4 finalColor; + if (u_cap == 0 && v.v_part == IS_CAP) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + if (u_join == 1 && v.v_part > 1.5) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + vec4 textureColor = texture2D(u_texture, v.v_tex); + if (textureColor.a <= 0.5) { + gl_FragColor = vec4(u_color.rgb, 0.0); + } else { + gl_FragColor = u_color; + } + } + } + } +} diff --git a/packages/lines/src/line/material/Line.shader b/packages/lines/src/line/material/Line.shader new file mode 100644 index 00000000..702b725b --- /dev/null +++ b/packages/lines/src/line/material/Line.shader @@ -0,0 +1,59 @@ +Shader "line" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + float u_width; + + struct Attributes { + vec2 a_pos; + vec2 a_normal; + vec2 a_data; + }; + + struct Varyings { + vec2 v_origin; + vec2 v_position; + float v_direction; + float v_part; + }; + + Varyings vert(Attributes attr) { + Varyings v; + v.v_direction = attr.a_data.x; + v.v_part = attr.a_data.y; + float layer_index = 1.0; + + v.v_origin = attr.a_pos; + vec2 position = attr.a_pos + attr.a_normal * u_width; + v.v_position = position; + gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); + return v; + } + + vec4 u_color; + int u_join; + int u_cap; + + float IS_CAP = 0.0; + + void frag(Varyings v) { + vec4 finalColor; + if (u_cap == 0 && v.v_part == IS_CAP) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + if (u_join == 1 && v.v_part > 1.0) { + if (distance(v.v_position, v.v_origin) > u_width) { + discard; + } + } + + gl_FragColor = u_color; + } + } + } +} diff --git a/packages/lines/src/line/material/dashShader.ts b/packages/lines/src/line/material/dashShader.ts index 41353953..766d0500 100644 --- a/packages/lines/src/line/material/dashShader.ts +++ b/packages/lines/src/line/material/dashShader.ts @@ -1,80 +1,5 @@ import { Shader } from "@galacean/engine"; -const shaderSource = `Shader "dash" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - mat4 renderer_MVPMat; - float u_width; - vec2 u_dash; - - struct Attributes { - vec2 a_pos; - vec2 a_normal; - vec2 a_data; - float a_lengthsofar; - }; - - struct Varyings { - vec2 v_origin; - vec2 v_position; - float v_direction; - float v_part; - vec2 v_tex; - }; - - Varyings vert(Attributes attr) { - Varyings v; - v.v_direction = attr.a_data.x; - v.v_part = attr.a_data.y; - float layer_index = 1.0; - - v.v_origin = attr.a_pos; - - float texcoord_y = 0.0; - - texcoord_y = attr.a_lengthsofar / (u_dash.x + u_dash.y); - if (v.v_direction == 1.0) { - v.v_tex = vec2(1.0, texcoord_y); - } else { - v.v_tex = vec2(0.0, texcoord_y); - } - vec2 position = attr.a_pos + attr.a_normal * u_width; - v.v_position = position; - gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); - return v; - } - - vec4 u_color; - int u_join; - int u_cap; - sampler2D u_texture; - - float IS_CAP = 0.0; - - void frag(Varyings v) { - vec4 finalColor; - if (u_cap == 0 && v.v_part == IS_CAP) { - if (distance(v.v_position, v.v_origin) > u_width) { - discard; - } - } - if (u_join == 1 && v.v_part > 1.5) { - if (distance(v.v_position, v.v_origin) > u_width) { - discard; - } - } - vec4 textureColor = texture2D(u_texture, v.v_tex); - if (textureColor.a <= 0.5) { - gl_FragColor = vec4(u_color.rgb, 0.0); - } else { - gl_FragColor = u_color; - } - } - } - } -}`; +import shaderSource from "./Dash.shader"; Shader.find("dash") || Shader.create(shaderSource); diff --git a/packages/lines/src/line/material/lineShader.ts b/packages/lines/src/line/material/lineShader.ts index caea2ce4..9da47672 100644 --- a/packages/lines/src/line/material/lineShader.ts +++ b/packages/lines/src/line/material/lineShader.ts @@ -1,63 +1,5 @@ import { Shader } from "@galacean/engine"; -const shaderSource = `Shader "line" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - mat4 renderer_MVPMat; - float u_width; - - struct Attributes { - vec2 a_pos; - vec2 a_normal; - vec2 a_data; - }; - - struct Varyings { - vec2 v_origin; - vec2 v_position; - float v_direction; - float v_part; - }; - - Varyings vert(Attributes attr) { - Varyings v; - v.v_direction = attr.a_data.x; - v.v_part = attr.a_data.y; - float layer_index = 1.0; - - v.v_origin = attr.a_pos; - vec2 position = attr.a_pos + attr.a_normal * u_width; - v.v_position = position; - gl_Position = renderer_MVPMat * vec4(position, 0.0, 1); - return v; - } - - vec4 u_color; - int u_join; - int u_cap; - - float IS_CAP = 0.0; - - void frag(Varyings v) { - vec4 finalColor; - if (u_cap == 0 && v.v_part == IS_CAP) { - if (distance(v.v_position, v.v_origin) > u_width) { - discard; - } - } - if (u_join == 1 && v.v_part > 1.0) { - if (distance(v.v_position, v.v_origin) > u_width) { - discard; - } - } - - gl_FragColor = u_color; - } - } - } -}`; +import shaderSource from "./Line.shader"; Shader.find("line") || Shader.create(shaderSource); diff --git a/packages/outline/libs/OutlinePostprocess.gsp b/packages/outline/libs/OutlinePostprocess.gsp new file mode 100644 index 00000000..1207ee71 --- /dev/null +++ b/packages/outline/libs/OutlinePostprocess.gsp @@ -0,0 +1 @@ +{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/libs/OutlineReplace.gsp b/packages/outline/libs/OutlineReplace.gsp new file mode 100644 index 00000000..bfd54801 --- /dev/null +++ b/packages/outline/libs/OutlineReplace.gsp @@ -0,0 +1 @@ +{"name":"outline-replace-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { Varyings v ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ;\nreturn v ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 camera_OutlineReplaceColor;\nvoid main() { gl_FragColor = camera_OutlineReplaceColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/libs/index.ts b/packages/outline/libs/index.ts new file mode 100644 index 00000000..7ed1df97 --- /dev/null +++ b/packages/outline/libs/index.ts @@ -0,0 +1,8 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import OutlinePostprocessSource from "./OutlinePostprocess.gsp"; +import OutlineReplaceSource from "./OutlineReplace.gsp"; + +export { + OutlinePostprocessSource, + OutlineReplaceSource +}; diff --git a/packages/outline/package.json b/packages/outline/package.json index 9084e7a3..a8efaa85 100755 --- a/packages/outline/package.json +++ b/packages/outline/package.json @@ -15,7 +15,8 @@ }, "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { - "b:types": "tsc" + "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index" }, "types": "types/index.d.ts", "files": [ diff --git a/packages/outline/src/OutlineManager.ts b/packages/outline/src/OutlineManager.ts index 0d47591c..76109a4a 100644 --- a/packages/outline/src/OutlineManager.ts +++ b/packages/outline/src/OutlineManager.ts @@ -24,147 +24,8 @@ import { dependentComponents } from "@galacean/engine"; -const outlinePostprocessShaderSource = `Shader "outline-postprocess-shader" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Attributes.glsl" - - struct Varyings { - vec2 v_uv; - }; - - Varyings vert(Attributes attr) { - Varyings v; - gl_Position = vec4(attr.POSITION.xzy, 1.0); - #ifdef RENDERER_HAS_UV - v.v_uv = attr.TEXCOORD_0; - #endif - return v; - } - - #include "Common/Common.glsl" - - vec3 material_OutlineColor; - sampler2D material_OutlineTexture; - vec2 material_TexSize; - - float luminance(vec4 color) { - return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; - } - - float sobel(vec2 uv) { - // adapter to webgl 1.0 - float Gx[9]; - Gx[0] = -1.0; - Gx[1] = 0.0; - Gx[2] = 1.0; - Gx[3] = -2.0; - Gx[4] = 0.0; - Gx[5] = 2.0; - Gx[6] = -1.0; - Gx[7] = 0.0; - Gx[8] = 1.0; - - float Gy[9]; - Gy[0] = -1.0; - Gy[1] = -2.0; - Gy[2] = -1.0; - Gy[3] = 0.0; - Gy[4] = 0.0; - Gy[5] = 0.0; - Gy[6] = 1.0; - Gy[7] = 2.0; - Gy[8] = 1.0; - - float texColor; - float edgeX = 0.0; - float edgeY = 0.0; - vec2 sampleUV[9]; - - sampleUV[0] = uv + material_TexSize.xy * vec2(-1, -1); - sampleUV[1] = uv + material_TexSize.xy * vec2(0, -1); - sampleUV[2] = uv + material_TexSize.xy * vec2(1, -1); - sampleUV[3] = uv + material_TexSize.xy * vec2(-1, 0); - sampleUV[4] = uv + material_TexSize.xy * vec2(0, 0); - sampleUV[5] = uv + material_TexSize.xy * vec2(1, 0); - sampleUV[6] = uv + material_TexSize.xy * vec2(-1, 1); - sampleUV[7] = uv + material_TexSize.xy * vec2(0, 1); - sampleUV[8] = uv + material_TexSize.xy * vec2(1, 1); - - for (int i = 0; i < 9; i++) { - texColor = luminance(texture2D(material_OutlineTexture, sampleUV[i])); - edgeX += texColor * Gx[i]; - edgeY += texColor * Gy[i]; - } - - return abs(edgeX) + abs(edgeY); - } - - void frag(Varyings v) { - float sobelFactor = step(1.0, sobel(v.v_uv)); - gl_FragColor = mix(vec4(0), vec4(material_OutlineColor, 1.0), sobelFactor); - } - } - } -}`; - -const outlineReplaceShaderSource = `Shader "outline-replace-shader" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" - - #include "Common/Attributes.glsl" - - Varyings vert(Attributes attr) { - Varyings v; - - vec4 position = vec4(attr.POSITION, 1.0); - - #ifdef RENDERER_HAS_NORMAL - vec3 normal = vec3(attr.NORMAL); - #ifdef RENDERER_HAS_TANGENT - vec4 tangent = vec4(attr.TANGENT); - #endif - #endif - - #ifdef RENDERER_HAS_BLENDSHAPE - calculateBlendShape(attr, position - #ifdef RENDERER_HAS_NORMAL - , normal - #ifdef RENDERER_HAS_TANGENT - , tangent - #endif - #endif - ); - #endif - - #ifdef RENDERER_HAS_SKIN - mat4 skinMatrix = getSkinMatrix(attr); - position = skinMatrix * position; - #endif - - gl_Position = renderer_MVPMat * position; - - return v; - } - - vec4 camera_OutlineReplaceColor; - - void frag(Varyings v) { - gl_FragColor = camera_OutlineReplaceColor; - } - } - } -}`; +import outlinePostprocessShaderSource from "./OutlinePostprocess.shader"; +import outlineReplaceShaderSource from "./OutlineReplace.shader"; Shader.find("outline-postprocess-shader") || Shader.create(outlinePostprocessShaderSource); Shader.find("outline-replace-shader") || Shader.create(outlineReplaceShaderSource); diff --git a/packages/outline/src/OutlinePostprocess.shader b/packages/outline/src/OutlinePostprocess.shader new file mode 100644 index 00000000..0db2c2a3 --- /dev/null +++ b/packages/outline/src/OutlinePostprocess.shader @@ -0,0 +1,86 @@ +Shader "outline-postprocess-shader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Attributes.glsl" + + struct Varyings { + vec2 v_uv; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = vec4(attr.POSITION.xzy, 1.0); + #ifdef RENDERER_HAS_UV + v.v_uv = attr.TEXCOORD_0; + #endif + return v; + } + + #include "Common/Common.glsl" + + vec3 material_OutlineColor; + sampler2D material_OutlineTexture; + vec2 material_TexSize; + + float luminance(vec4 color) { + return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; + } + + float sobel(vec2 uv) { + // adapter to webgl 1.0 + float Gx[9]; + Gx[0] = -1.0; + Gx[1] = 0.0; + Gx[2] = 1.0; + Gx[3] = -2.0; + Gx[4] = 0.0; + Gx[5] = 2.0; + Gx[6] = -1.0; + Gx[7] = 0.0; + Gx[8] = 1.0; + + float Gy[9]; + Gy[0] = -1.0; + Gy[1] = -2.0; + Gy[2] = -1.0; + Gy[3] = 0.0; + Gy[4] = 0.0; + Gy[5] = 0.0; + Gy[6] = 1.0; + Gy[7] = 2.0; + Gy[8] = 1.0; + + float texColor; + float edgeX = 0.0; + float edgeY = 0.0; + vec2 sampleUV[9]; + + sampleUV[0] = uv + material_TexSize.xy * vec2(-1, -1); + sampleUV[1] = uv + material_TexSize.xy * vec2(0, -1); + sampleUV[2] = uv + material_TexSize.xy * vec2(1, -1); + sampleUV[3] = uv + material_TexSize.xy * vec2(-1, 0); + sampleUV[4] = uv + material_TexSize.xy * vec2(0, 0); + sampleUV[5] = uv + material_TexSize.xy * vec2(1, 0); + sampleUV[6] = uv + material_TexSize.xy * vec2(-1, 1); + sampleUV[7] = uv + material_TexSize.xy * vec2(0, 1); + sampleUV[8] = uv + material_TexSize.xy * vec2(1, 1); + + for (int i = 0; i < 9; i++) { + texColor = luminance(texture2D(material_OutlineTexture, sampleUV[i])); + edgeX += texColor * Gx[i]; + edgeY += texColor * Gy[i]; + } + + return abs(edgeX) + abs(edgeY); + } + + void frag(Varyings v) { + float sobelFactor = step(1.0, sobel(v.v_uv)); + gl_FragColor = mix(vec4(0), vec4(material_OutlineColor, 1.0), sobelFactor); + } + } + } +} diff --git a/packages/outline/src/OutlineReplace.shader b/packages/outline/src/OutlineReplace.shader new file mode 100644 index 00000000..6f169422 --- /dev/null +++ b/packages/outline/src/OutlineReplace.shader @@ -0,0 +1,54 @@ +Shader "outline-replace-shader" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + #include "Common/Common.glsl" + #include "Common/Transform.glsl" + #include "Skin/Skin.glsl" + #include "Skin/BlendShape.glsl" + + #include "Common/Attributes.glsl" + + Varyings vert(Attributes attr) { + Varyings v; + + vec4 position = vec4(attr.POSITION, 1.0); + + #ifdef RENDERER_HAS_NORMAL + vec3 normal = vec3(attr.NORMAL); + #ifdef RENDERER_HAS_TANGENT + vec4 tangent = vec4(attr.TANGENT); + #endif + #endif + + #ifdef RENDERER_HAS_BLENDSHAPE + calculateBlendShape(attr, position + #ifdef RENDERER_HAS_NORMAL + , normal + #ifdef RENDERER_HAS_TANGENT + , tangent + #endif + #endif + ); + #endif + + #ifdef RENDERER_HAS_SKIN + mat4 skinMatrix = getSkinMatrix(attr); + position = skinMatrix * position; + #endif + + gl_Position = renderer_MVPMat * position; + + return v; + } + + vec4 camera_OutlineReplaceColor; + + void frag(Varyings v) { + gl_FragColor = camera_OutlineReplaceColor; + } + } + } +} diff --git a/packages/outline/src/global.d.ts b/packages/outline/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/outline/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/packages/skeleton-viewer/libs/SkeletonViewer.gsp b/packages/skeleton-viewer/libs/SkeletonViewer.gsp new file mode 100644 index 00000000..245afdae --- /dev/null +++ b/packages/skeleton-viewer/libs/SkeletonViewer.gsp @@ -0,0 +1 @@ +{"name":"skeleton-viewer","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",62],[0," v_normal = normalize ( mat3 ( renderer_NormalMat ) * NORMAL ) ; \n"],[6],[0,"\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nuniform vec3 u_colorMin;\nuniform vec3 u_colorMax;\nvoid main() { float ndl = dot ( v_normal , vec3 ( 0 , 1 , 0 ) ) * 0.5 + 0.5 ;\nvec3 diffuse = mix ( u_colorMin , u_colorMax , ndl ) ;\ngl_FragColor = vec4 ( diffuse , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/libs/index.ts new file mode 100644 index 00000000..71dea8a1 --- /dev/null +++ b/packages/skeleton-viewer/libs/index.ts @@ -0,0 +1,6 @@ +// Auto-generated by shader-precompile --emit-index — do not edit +import SkeletonViewerSource from "./SkeletonViewer.gsp"; + +export { + SkeletonViewerSource +}; diff --git a/packages/skeleton-viewer/package.json b/packages/skeleton-viewer/package.json index 2d73e258..2d65606d 100755 --- a/packages/skeleton-viewer/package.json +++ b/packages/skeleton-viewer/package.json @@ -3,7 +3,8 @@ "version": "2.0.0-alpha.0", "license": "MIT", "scripts": { - "b:types": "tsc" + "b:types": "tsc", + "precompile": "shader-compiler-precompile src libs --clean --emit-index" }, "publishConfig": { "access": "public", diff --git a/packages/skeleton-viewer/src/SkeletonViewer.shader b/packages/skeleton-viewer/src/SkeletonViewer.shader new file mode 100644 index 00000000..4d2544a6 --- /dev/null +++ b/packages/skeleton-viewer/src/SkeletonViewer.shader @@ -0,0 +1,35 @@ +Shader "skeleton-viewer" { + SubShader "Default" { + Pass "Forward" { + VertexShader = vert; + FragmentShader = frag; + + mat4 renderer_MVPMat; + mat4 renderer_NormalMat; + + #include "Common/Attributes.glsl" + + struct Varyings { + vec3 v_normal; + }; + + Varyings vert(Attributes attr) { + Varyings v; + gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); + #ifdef RENDERER_HAS_NORMAL + v.v_normal = normalize( mat3(renderer_NormalMat) * attr.NORMAL ); + #endif + return v; + } + + vec3 u_colorMin; + vec3 u_colorMax; + + void frag(Varyings v) { + float ndl = dot(v.v_normal, vec3(0, 1, 0)) * 0.5 + 0.5; + vec3 diffuse = mix(u_colorMin, u_colorMax, ndl); + gl_FragColor = vec4(diffuse, 1.0); + } + } + } +} diff --git a/packages/skeleton-viewer/src/SkeletonViewer.ts b/packages/skeleton-viewer/src/SkeletonViewer.ts index 36c06c90..a653f173 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.ts +++ b/packages/skeleton-viewer/src/SkeletonViewer.ts @@ -15,41 +15,7 @@ import { Vector3 } from "@galacean/engine"; -const shaderSource = `Shader "skeleton-viewer" { - SubShader "Default" { - Pass "Forward" { - VertexShader = vert; - FragmentShader = frag; - - mat4 renderer_MVPMat; - mat4 renderer_NormalMat; - - #include "Common/Attributes.glsl" - - struct Varyings { - vec3 v_normal; - }; - - Varyings vert(Attributes attr) { - Varyings v; - gl_Position = renderer_MVPMat * vec4(attr.POSITION, 1.0); - #ifdef RENDERER_HAS_NORMAL - v.v_normal = normalize( mat3(renderer_NormalMat) * attr.NORMAL ); - #endif - return v; - } - - vec3 u_colorMin; - vec3 u_colorMax; - - void frag(Varyings v) { - float ndl = dot(v.v_normal, vec3(0, 1, 0)) * 0.5 + 0.5; - vec3 diffuse = mix(u_colorMin, u_colorMax, ndl); - gl_FragColor = vec4(diffuse, 1.0); - } - } - } -}`; +import shaderSource from "./SkeletonViewer.shader"; Shader.find("skeleton-viewer") || Shader.create(shaderSource); diff --git a/packages/skeleton-viewer/src/global.d.ts b/packages/skeleton-viewer/src/global.d.ts new file mode 100644 index 00000000..8d32d621 --- /dev/null +++ b/packages/skeleton-viewer/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.shader" { + const value: string; + export default value; +} diff --git a/rollup.config.mjs b/rollup.config.mjs index 285ae780..a6590759 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -43,12 +43,10 @@ const mainFields = ["module", "main"]; const plugins = [ resolve({ extensions, preferBuiltins: true, mainFields }), - shaderCompiler({ - precompile: { - input: path.join(process.cwd(), "packages/custom-material/src"), - output: path.join(process.cwd(), "packages/custom-material/libs") - } - }), + // Transform-only — `.shader`/`.glsl`/`.gsp` files become string/JSON modules. + // Each package owns its own `precompile` npm script that drives the CLI to + // emit `.gsp` artifacts under `/libs/`; rollup never runs precompile. + shaderCompiler(), swc( defineRollupSwcOption({ include: /\.[mc]?[jt]sx?$/, @@ -163,6 +161,21 @@ function makeRollupConfig(pkg) { plugins: [...plugins, ...miniProgramPlugin] }); + // Optional `./sources` subpath entry — emits raw `.shader` strings for editor. + // Opt-in by checking `exports["./sources"]` in the package's package.json. + if (pkg.pkgJson.exports?.["./sources"]) { + const sourcesInput = path.join(pkg.location, "src", "sources.ts"); + configs.push({ + input: sourcesInput, + output: [ + { file: path.join(pkg.location, "dist", "es", "sources.module.js"), format: "es", sourcemap: true }, + { file: path.join(pkg.location, "dist", "commonjs", "sources.main.js"), format: "commonjs", sourcemap: true } + ], + external: externals, + plugins + }); + } + return configs; } From 2aecdcef397139252ba6ef92e44767ac15f4ba55 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 28 Apr 2026 18:56:28 +0800 Subject: [PATCH 08/27] fix(types): declare *.gsp module + include libs/ in tsconfig Auto-generated `/libs/index.ts` re-exports `.gsp` JSON imports that the toolkit packages don't currently declare a TypeScript module shape for, so the IDE shows red squiggles on every import line. And `tsconfig.json`'s `include: ["src/**/*"]` excludes `libs/`, so even a `declare module "*.gsp"` in `src/global.d.ts` isn't picked up by the language server when editing the libs file directly. Two fixes per affected package: - Append `declare module "*.gsp" { const value: object; export default value; }` to `src/global.d.ts` (alongside the existing `*.shader` declaration). - Extend `tsconfig.json`'s `include` to `["src/**/*", "libs/**/*"]` so the module-type declarations in `src/global.d.ts` apply when the language server type-checks `libs/index.ts`. Eight packages updated: custom-material, geometry-sketch, gizmo, skeleton-viewer, controls, outline, framebuffer-picker, lines. --- packages/controls/src/global.d.ts | 5 +++++ packages/controls/tsconfig.json | 3 ++- packages/custom-material/src/global.d.ts | 5 +++++ packages/custom-material/tsconfig.json | 3 ++- packages/framebuffer-picker/src/global.d.ts | 5 +++++ packages/framebuffer-picker/tsconfig.json | 5 +++-- packages/geometry-sketch/src/global.d.ts | 5 +++++ packages/geometry-sketch/tsconfig.json | 3 ++- packages/gizmo/src/global.d.ts | 5 +++++ packages/gizmo/tsconfig.json | 5 ++++- packages/lines/src/global.d.ts | 5 +++++ packages/lines/tsconfig.json | 3 ++- packages/outline/src/global.d.ts | 5 +++++ packages/outline/tsconfig.json | 5 +++-- packages/skeleton-viewer/src/global.d.ts | 5 +++++ packages/skeleton-viewer/tsconfig.json | 5 +++-- 16 files changed, 61 insertions(+), 11 deletions(-) diff --git a/packages/controls/src/global.d.ts b/packages/controls/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/controls/src/global.d.ts +++ b/packages/controls/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/controls/tsconfig.json b/packages/controls/tsconfig.json index 4cfb7f0b..617c700c 100644 --- a/packages/controls/tsconfig.json +++ b/packages/controls/tsconfig.json @@ -13,6 +13,7 @@ "sourceMap": true }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] } diff --git a/packages/custom-material/src/global.d.ts b/packages/custom-material/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/custom-material/src/global.d.ts +++ b/packages/custom-material/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/custom-material/tsconfig.json b/packages/custom-material/tsconfig.json index ff527f32..9496e398 100644 --- a/packages/custom-material/tsconfig.json +++ b/packages/custom-material/tsconfig.json @@ -14,6 +14,7 @@ "sourceMap": true }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] } diff --git a/packages/framebuffer-picker/src/global.d.ts b/packages/framebuffer-picker/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/framebuffer-picker/src/global.d.ts +++ b/packages/framebuffer-picker/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/framebuffer-picker/tsconfig.json b/packages/framebuffer-picker/tsconfig.json index 91b3a7c0..5556eae9 100644 --- a/packages/framebuffer-picker/tsconfig.json +++ b/packages/framebuffer-picker/tsconfig.json @@ -15,6 +15,7 @@ "incremental": false }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] -} \ No newline at end of file +} diff --git a/packages/geometry-sketch/src/global.d.ts b/packages/geometry-sketch/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/geometry-sketch/src/global.d.ts +++ b/packages/geometry-sketch/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/geometry-sketch/tsconfig.json b/packages/geometry-sketch/tsconfig.json index 4cfb7f0b..617c700c 100644 --- a/packages/geometry-sketch/tsconfig.json +++ b/packages/geometry-sketch/tsconfig.json @@ -13,6 +13,7 @@ "sourceMap": true }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] } diff --git a/packages/gizmo/src/global.d.ts b/packages/gizmo/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/gizmo/src/global.d.ts +++ b/packages/gizmo/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/gizmo/tsconfig.json b/packages/gizmo/tsconfig.json index 10fb7d76..617c700c 100644 --- a/packages/gizmo/tsconfig.json +++ b/packages/gizmo/tsconfig.json @@ -12,5 +12,8 @@ "noImplicitOverride": true, "sourceMap": true }, - "include": ["src/**/*"] + "include": [ + "src/**/*", + "libs/**/*" + ] } diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts index 4814c4df..7416df1b 100644 --- a/packages/lines/src/global.d.ts +++ b/packages/lines/src/global.d.ts @@ -4,3 +4,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/lines/tsconfig.json b/packages/lines/tsconfig.json index 4cfb7f0b..617c700c 100644 --- a/packages/lines/tsconfig.json +++ b/packages/lines/tsconfig.json @@ -13,6 +13,7 @@ "sourceMap": true }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] } diff --git a/packages/outline/src/global.d.ts b/packages/outline/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/outline/src/global.d.ts +++ b/packages/outline/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/outline/tsconfig.json b/packages/outline/tsconfig.json index 91b3a7c0..5556eae9 100644 --- a/packages/outline/tsconfig.json +++ b/packages/outline/tsconfig.json @@ -15,6 +15,7 @@ "incremental": false }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] -} \ No newline at end of file +} diff --git a/packages/skeleton-viewer/src/global.d.ts b/packages/skeleton-viewer/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/skeleton-viewer/src/global.d.ts +++ b/packages/skeleton-viewer/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/skeleton-viewer/tsconfig.json b/packages/skeleton-viewer/tsconfig.json index cab4d4f3..f9c2a9c5 100644 --- a/packages/skeleton-viewer/tsconfig.json +++ b/packages/skeleton-viewer/tsconfig.json @@ -14,6 +14,7 @@ "incremental": false }, "include": [ - "src/**/*" + "src/**/*", + "libs/**/*" ] -} \ No newline at end of file +} From ed7aa4603272015943612ff1261843f3c3a26360 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 28 Apr 2026 19:15:22 +0800 Subject: [PATCH 09/27] build: regenerate libs/index.ts with prettier-friendly format The bundler now emits single-line `export { A };` for single-export packages (matches prettier's `printWidth: 120` wrap rule). Update the checked-in indices for the seven single-export toolkit packages so they no longer drift from the bundler's output on each precompile run. --- packages/controls/libs/box-selection/BoxSelection.gsp | 2 +- packages/controls/libs/index.ts | 4 +--- packages/custom-material/libs/advanced-shader/eye/Eye.gsp | 2 +- packages/custom-material/libs/advanced-shader/hair/Hair.gsp | 2 +- packages/custom-material/libs/advanced-shader/sss/SSS.gsp | 2 +- packages/custom-material/libs/bake-pbr/BakePBR.gsp | 2 +- packages/custom-material/libs/grid/Grid.gsp | 2 +- packages/custom-material/libs/plain-color/PlainColor.gsp | 2 +- packages/custom-material/libs/water/Water.gsp | 2 +- packages/custom-material/libs/water/WaterFall.gsp | 2 +- packages/custom-material/libs/water/WaterRipple.gsp | 2 +- packages/framebuffer-picker/libs/FramebufferPickerColor.gsp | 2 +- packages/framebuffer-picker/libs/index.ts | 4 +--- packages/geometry-sketch/libs/index.ts | 5 +---- packages/geometry-sketch/libs/material/TBN.gsp | 2 +- packages/geometry-sketch/libs/material/Wireframe.gsp | 2 +- packages/gizmo/libs/icon/Icon.gsp | 2 +- packages/gizmo/libs/index.ts | 4 +--- packages/lines/libs/index.ts | 5 +---- packages/outline/libs/OutlinePostprocess.gsp | 2 +- packages/outline/libs/OutlineReplace.gsp | 2 +- packages/outline/libs/index.ts | 5 +---- packages/skeleton-viewer/libs/SkeletonViewer.gsp | 2 +- packages/skeleton-viewer/libs/index.ts | 4 +--- 24 files changed, 24 insertions(+), 41 deletions(-) diff --git a/packages/controls/libs/box-selection/BoxSelection.gsp b/packages/controls/libs/box-selection/BoxSelection.gsp index 4547af38..a3fafb1f 100644 --- a/packages/controls/libs/box-selection/BoxSelection.gsp +++ b/packages/controls/libs/box-selection/BoxSelection.gsp @@ -1 +1 @@ -{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file +{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/controls/libs/index.ts b/packages/controls/libs/index.ts index 40954984..4eb01a35 100644 --- a/packages/controls/libs/index.ts +++ b/packages/controls/libs/index.ts @@ -1,6 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit import BoxSelectionSource from "./box-selection/BoxSelection.gsp"; -export { - BoxSelectionSource -}; +export { BoxSelectionSource }; diff --git a/packages/custom-material/libs/advanced-shader/eye/Eye.gsp b/packages/custom-material/libs/advanced-shader/eye/Eye.gsp index 7c94f077..95a85c6a 100644 --- a/packages/custom-material/libs/advanced-shader/eye/Eye.gsp +++ b/packages/custom-material/libs/advanced-shader/eye/Eye.gsp @@ -1 +1 @@ -{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",539],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",35],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",29],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,33],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",45],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,43],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",103],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",77],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",75],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},57],[0,"\n"],[5,73],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},69],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",63],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",67],[0,"\n"],[6],[0,"\n"],[5,71],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",81],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",85],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",89],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",93],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",97],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",101],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",133],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",111],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",115],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,119],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",127],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",125],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},131],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",287],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",143],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",149],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",155],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",161],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",167],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",225],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",181],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",179],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},191],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",195],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",199],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",203],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",207],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",211],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",215],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",219],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",223],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",267],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",233],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",241],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",239],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",249],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",247],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",257],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",255],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",261],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",265],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",273],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",277],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",281],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",285],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",323],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",297],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",303],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",309],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",315],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",321],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",385],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,331],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",339],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",337],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",347],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",345],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",359],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",357],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",355],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",371],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},369],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",367],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},379],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",377],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,383],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",493],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",395],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",399],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",403],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",419],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",409],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",413],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",417],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",427],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",425],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",439],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",433],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",437],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",451],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",445],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",449],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",467],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",457],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",465],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",463],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",471],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",475],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",479],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",483],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",487],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",491],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",497],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",501],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",505],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",509],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",513],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",517],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",521],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,525],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",533],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",531],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},537],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",744],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",39],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",27],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",33],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,37],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",59],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,57],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,49],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",2,52],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",3,55],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",65],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",95],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",73],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",77],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,81],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",89],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",87],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},93],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",331],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",105],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",111],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",117],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",123],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",129],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",221],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",143],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",141],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},153],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",157],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",161],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",165],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",169],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",173],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",177],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",181],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",185],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",189],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",193],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",197],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",201],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,203],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",207],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",211],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",215],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",219],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",269],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",229],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",233],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,235],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",243],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",241],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",251],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",249],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",259],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",257],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",263],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",267],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",283],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",277],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",281],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",287],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",291],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",295],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",309],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",301],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,303],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",307],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",319],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",315],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,317],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",329],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",325],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,327],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",407],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",341],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",347],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",353],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",359],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",391],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",367],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,369],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",373],[0," return vec3 ( 0 ) ; \n"],[5,385],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",377],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,379],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",383],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},389],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",395],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,397],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",401],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",405],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",413],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",664],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",429],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",425],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,427],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",433],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",437],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",453],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",443],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",447],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",451],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",461],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",459],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",473],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",467],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",471],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",485],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",479],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",483],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",501],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",491],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",499],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",497],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",505],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",509],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",513],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",517],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",521],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",525],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",529],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",533],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",537],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",541],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",545],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",549],[0," surfaceData.opacity = baseColor.a ; \n"],[5,551],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",555],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,557],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",561],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,566],[1,"HAS_DERIVATIVES",564],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,566],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",580],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},572],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,574],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",578],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",584],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",588],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",606],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",594],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,596],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",600],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",604],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",614],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",612],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",628],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",620],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,622],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",626],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",640],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",634],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",638],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",656],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",646],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",654],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",652],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",660],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,662],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",668],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",672],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",676],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",680],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",684],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",688],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,690],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",694],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,696],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",700],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",704],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,706],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",710],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,712],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",716],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,718],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},722],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",726],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,728],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},738],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,734],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,736],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, brdfData, totalDiffuseColor, totalSpecularColor) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,742],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file +{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",540],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",288],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",144],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",150],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",156],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",162],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",168],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",226],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",182],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",180],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},192],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",196],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",200],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",204],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",208],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",212],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",216],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",220],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",224],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",268],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",242],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",240],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",250],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",248],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",258],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",256],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",266],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",274],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",286],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",324],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",298],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",304],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",310],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",316],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",322],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",386],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,332],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",340],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",338],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",348],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",346],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",360],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",358],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",356],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",372],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},370],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",368],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},380],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",378],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,384],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",494],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",396],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",400],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",420],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",410],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",414],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",418],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",428],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",426],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",440],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",434],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",438],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",452],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",446],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",450],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",468],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",458],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",466],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",464],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",476],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",480],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",484],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",488],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",492],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",498],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",506],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",510],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",514],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",518],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",522],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,526],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",534],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",532],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},538],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",647],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",274],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",106],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",112],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",118],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",124],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",130],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",212],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",144],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",142],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},154],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",162],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",170],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",186],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",190],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",194],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",198],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",202],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",206],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",210],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",254],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",220],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",228],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",226],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",236],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",244],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",248],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",252],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",260],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",272],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",310],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",284],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",290],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",296],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",302],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",308],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",316],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",567],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",332],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",328],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,330],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",336],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",340],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",356],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",346],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",350],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",354],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",364],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",362],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",376],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",370],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",374],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",388],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",382],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",386],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",404],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",394],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",402],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",400],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",408],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",412],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",416],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",420],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",424],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",428],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",432],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",436],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",440],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",444],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",448],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",452],[0," surfaceData.opacity = baseColor.a ; \n"],[5,454],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",458],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,460],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",464],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,469],[1,"HAS_DERIVATIVES",467],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,469],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",483],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},475],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,477],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",481],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",487],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",491],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",509],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",497],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,499],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",503],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",507],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",517],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",515],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",531],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",523],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,525],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",529],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",543],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",537],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",541],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",559],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",549],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",557],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",555],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",563],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,565],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",571],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",575],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",579],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",583],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",587],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",591],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,593],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",597],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,599],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",603],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",607],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,609],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",613],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,615],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",619],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,621],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},625],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",629],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,631],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},641],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,637],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,639],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,645],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/hair/Hair.gsp b/packages/custom-material/libs/advanced-shader/hair/Hair.gsp index 80d52b29..ae94ef91 100644 --- a/packages/custom-material/libs/advanced-shader/hair/Hair.gsp +++ b/packages/custom-material/libs/advanced-shader/hair/Hair.gsp @@ -1 +1 @@ -{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",587],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",35],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",29],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,33],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",45],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,43],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",103],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",77],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",75],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},57],[0,"\n"],[5,73],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},69],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",63],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",67],[0,"\n"],[6],[0,"\n"],[5,71],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",81],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",85],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",89],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",93],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",97],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",101],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",133],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",111],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",115],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,119],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",127],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",125],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},131],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",193],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",149],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",147],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},159],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",163],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",167],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",171],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",179],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",187],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",191],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",197],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",351],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",207],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",213],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",219],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",225],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",231],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",289],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",245],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",243],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},255],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",259],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",263],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",267],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",271],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",275],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",279],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",283],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",287],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",331],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",297],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",305],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",303],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",313],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",311],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",321],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",319],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",325],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",329],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",337],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",341],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",345],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",349],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",387],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",361],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",367],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",373],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",379],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",385],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",453],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,395],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",403],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",401],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",407],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",415],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",413],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",427],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",425],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",423],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",439],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},437],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",435],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},447],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",445],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,451],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",561],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",463],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",467],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",471],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",487],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",477],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",481],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",485],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",495],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",493],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",507],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",501],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",505],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",519],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",513],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",517],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",535],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",525],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",533],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",531],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",539],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",543],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",547],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",551],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",555],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",559],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",565],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",569],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,573],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",581],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",579],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},585],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",788],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",39],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",27],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",33],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,37],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",59],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,57],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,49],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",2,52],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",3,55],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",65],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",95],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",73],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",77],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,81],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",89],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",87],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},93],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",189],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",111],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",109],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},121],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",125],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",129],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",133],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",137],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",141],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",145],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",149],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",153],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",157],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",161],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",165],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",169],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,171],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",179],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",187],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float material_HairFirstWidth;\nuniform float material_HairSecondWidth;\nuniform float material_HairFirstStrength;\nuniform float material_HairSecondStrength;\nuniform float material_HairFirstOffset;\nuniform float material_HairSecondOffset;\nuniform vec4 material_HairFirstColor;\nuniform vec4 material_HairSecondColor;\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",193],[0,"\nuniform sampler2D material_HairAnisotropyTexture;\n\n"],[6],[0,"\nvec3 shiftTangent ( vec3 tangent, vec3 normal, float shift ) { return ( normalize ( tangent + normal * shift ) ) ; }\nfloat anisotropySpecular ( SurfaceData surfaceData, vec3 light, float width, float strength, vec3 shiftedTangent ) { vec3 v = surfaceData.viewDir ;\nvec3 H = normalize ( light + v ) ;\nfloat dotTH = dot ( shiftedTangent , H ) ;\nfloat sinTH = sqrt ( 1.0 - dotTH * dotTH ) ;\nfloat dirAtten = smoothstep ( - 1.0 , 0.0 , dotTH ) ;\nreturn dirAtten * pow ( sinTH , width ) * strength ; }\nvoid specularLobehair ( SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { vec3 worldtangentDir = surfaceData.tangent ;\nvec3 worldbitangentDir = surfaceData.bitangent ;\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",197],[0," float shift = texture2D ( material_HairAnisotropyTexture , uv ).r - 0.5 ; \n"],[5,199],[0," float shift = 1.0 ; \n"],[6],[0,"\nvec3 shiftTangent1 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairFirstOffset) ;\nvec3 shiftTangent2 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairSecondOffset) ;\nvec3 firstcol = material_HairFirstColor.rgb ;\nvec3 firstSpecular = firstcol * anisotropySpecular(surfaceData, incidentDirection, material_HairFirstWidth * 15.0, material_HairFirstStrength, shiftTangent1) ;\nvec3 secondcol = material_HairSecondColor.rgb ;\nvec3 secondSpecular = secondcol * anisotropySpecular(surfaceData, incidentDirection, material_HairSecondWidth * 15.0, material_HairSecondStrength, shiftTangent2) ;\nvec3 hairSpecular = clamp ( firstSpecular + secondSpecular , 0.0 , 1.0 ) ;\nspecularColor += attenuationIrradiance * hairSpecular ; }\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",435],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",209],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",215],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",221],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",227],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",233],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",325],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",247],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",245],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},257],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",261],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",265],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",269],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",273],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",277],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",281],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",285],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",289],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",293],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",297],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",301],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",305],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,307],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",311],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",315],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",319],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",323],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",373],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",333],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",337],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,339],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",347],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",345],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",355],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",353],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",363],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",361],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",367],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",371],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",387],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",381],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",385],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",391],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",395],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",399],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",413],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",405],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,407],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",411],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",423],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",419],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,421],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",433],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",429],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,431],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",511],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",445],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",451],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",457],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",463],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",495],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",471],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,473],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",477],[0," return vec3 ( 0 ) ; \n"],[5,489],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",481],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,483],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",487],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},493],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",499],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,501],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",505],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",509],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",517],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",768],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",533],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",529],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,531],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",537],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",541],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",557],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",547],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",551],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",555],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",565],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",563],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",577],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",571],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",575],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",589],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",583],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",587],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",605],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",595],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",603],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",601],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",609],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",613],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",617],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",621],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",625],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",629],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",633],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",637],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",641],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",645],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",649],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",653],[0," surfaceData.opacity = baseColor.a ; \n"],[5,655],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",659],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,661],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",665],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,670],[1,"HAS_DERIVATIVES",668],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,670],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",684],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},676],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,678],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",682],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",688],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",692],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",710],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",698],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,700],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",704],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",708],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",718],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",716],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",732],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",724],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,726],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",730],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",744],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",738],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",742],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",760],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",750],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",758],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",756],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",764],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,766],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},772],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},782],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,778],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,780],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, brdfData, totalDiffuseColor, totalSpecularColor) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,786],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file +{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",588],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",194],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},160],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",172],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",176],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",192],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",198],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",352],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",208],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",214],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",220],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",226],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",232],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",290],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",246],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",244],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},256],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",260],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",280],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",284],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",288],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",332],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",298],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",306],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",304],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",314],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",312],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",322],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",320],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",326],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",330],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",338],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",342],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",346],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",350],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",388],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",362],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",368],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",374],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",380],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",386],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",454],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,396],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",404],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",402],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",408],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",416],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",414],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",428],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",426],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",424],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",440],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},438],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",436],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},448],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",446],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,452],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",562],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",464],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",468],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",488],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",486],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",496],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",494],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",508],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",506],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",520],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",514],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",518],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",536],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",526],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",534],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",540],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",544],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",548],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",552],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",556],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",560],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",566],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",570],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,574],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",582],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",580],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},586],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",675],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",180],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},122],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",126],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",130],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",134],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",138],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",142],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",146],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",150],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",154],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",178],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",184],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",362],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",194],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",200],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",206],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",212],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",218],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",300],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",232],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",230],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},242],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",246],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",250],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",254],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",258],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",262],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",266],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",270],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",290],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",294],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",298],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",342],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",316],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",314],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",324],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",322],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",332],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",330],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",336],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",340],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",348],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",352],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",356],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",360],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",398],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",372],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",378],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",384],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",390],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",396],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",404],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",655],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",420],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",416],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,418],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",424],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",428],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",444],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",434],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",438],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",442],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",452],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",450],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",464],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",458],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",462],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",476],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",470],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",474],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",492],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",482],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",490],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",488],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",496],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",500],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",504],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",508],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",512],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",516],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",520],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",524],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",528],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",532],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",536],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",540],[0," surfaceData.opacity = baseColor.a ; \n"],[5,542],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",546],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,548],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",552],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,557],[1,"HAS_DERIVATIVES",555],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,557],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",571],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},563],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,565],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",569],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",575],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",579],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",597],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",585],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,587],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",591],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",595],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",605],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",603],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",619],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",611],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,613],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",617],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",631],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",625],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",629],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",647],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",637],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",645],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",643],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",651],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,653],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},659],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},669],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,665],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,667],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,673],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/sss/SSS.gsp b/packages/custom-material/libs/advanced-shader/sss/SSS.gsp index 60c9e902..086d48ce 100644 --- a/packages/custom-material/libs/advanced-shader/sss/SSS.gsp +++ b/packages/custom-material/libs/advanced-shader/sss/SSS.gsp @@ -1 +1 @@ -{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",593],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",35],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",29],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,33],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",45],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,43],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",103],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",77],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",75],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},57],[0,"\n"],[5,73],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},69],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",63],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",67],[0,"\n"],[6],[0,"\n"],[5,71],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",81],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",85],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",89],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",93],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",97],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",101],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",133],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",111],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",115],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,119],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",127],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",125],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},131],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",193],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",149],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",147],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},159],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",163],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",167],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",171],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",179],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",187],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",191],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",199],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",203],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",357],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",213],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",219],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",225],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",231],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",237],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",295],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",251],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",249],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},261],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",265],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",269],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",273],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",277],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",281],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",285],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",289],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",293],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",337],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",303],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",311],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",309],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",319],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",317],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",327],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",325],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",331],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",335],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",343],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",347],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",351],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",355],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",393],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",367],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",373],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",379],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",385],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",391],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",459],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,401],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",409],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",407],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",413],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",421],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",419],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",433],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",431],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",429],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",445],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},443],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",441],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},453],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",451],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,457],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",567],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",469],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",473],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",477],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",493],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",483],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",487],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",491],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",501],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",499],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",513],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",507],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",511],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",525],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",519],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",523],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",541],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",531],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",539],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",537],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",545],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",549],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",553],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",557],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",561],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",565],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",571],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",575],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,579],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",587],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",585],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},591],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",802],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",39],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",27],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",33],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,37],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",59],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,57],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,49],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",2,52],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,55],[3,"SCENE_FOG_MODE","==",3,55],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",65],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",95],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",73],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",77],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,81],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",89],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",87],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},93],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",189],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",111],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",109],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},121],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",125],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",129],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",133],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",137],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",141],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",145],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",149],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",153],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",157],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",161],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",165],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",169],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,171],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",175],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",179],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",183],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",187],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",203],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",197],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",201],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nuniform vec4 material_SkinScatterAmount;\nuniform float material_CurvaturePower;\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",207],[0,"\nuniform sampler2D material_CurvatureTexture;\n\n"],[6],[0,"\nstruct FsphericalGaussian { vec3 Axis ; vec3 Sharpness ; vec3 Amplitude ; } ;\nvec3 dotCosineLobe ( FsphericalGaussian G, vec3 N ) { float muDotN = dot ( G.Axis , N ) ;\nconst vec3 c0 = vec3 ( 0.36 ) ;\nconst vec3 c1 = vec3 ( 0.25 / c0 ) ;\nvec3 eml = exp ( - G.Sharpness ) ;\nvec3 em2l = eml * eml ;\nvec3 rl = 1.0 / G.Sharpness ;\nvec3 scale = 1.0 + 2.0 * em2l - rl ;\nvec3 bias = ( eml - em2l ) * rl - em2l ;\nvec3 x = sqrt ( vec3 ( 1.0 ) - scale ) ;\nvec3 x0 = c0 * muDotN ;\nvec3 x1 = c1 * x ;\nvec3 n = x0 + x1 ;\nvec3 y ;\nif ( all ( lessThanEqual ( abs ( x0 ) , x1 ) ) ) { y = ( n * n ) / x ; } else { y = clamp ( vec3 ( muDotN ) , vec3 ( 0.0 ) , vec3 ( 1.0 ) ) ; }\nreturn scale * y + bias ; }\nFsphericalGaussian makeNormalizedSG ( vec3 lightdir, vec3 sharpness ) { FsphericalGaussian sg ;\nsg.Axis = lightdir ;\nsg.Sharpness = sharpness ;\nsg.Amplitude = sg.Sharpness / ( ( 2.0 * PI ) * ( 1.0 - exp ( - 2.0 * sg.Sharpness ) ) ) ;\nreturn sg ; }\nvec3 sgdiffuseLighting ( vec3 light, vec3 normal, vec3 scatterAmt ) { FsphericalGaussian Kernel = makeNormalizedSG(light, 1.0 / max ( scatterAmt.xyz , 0.0001 )) ;\nvec3 diffuse = dotCosineLobe(Kernel, normal) ;\nvec3 diffuselobe = max ( vec3 ( 0.0 ) , ( diffuse - 0.004 ) ) ;\ndiffuse = ( diffuselobe * ( 6.2 * diffuselobe + 0.5 ) ) / ( diffuselobe * ( 6.2 * diffuselobe + 1.7 ) + 0.06 ) ;\nreturn diffuse ; }\nvoid surfaceShadingSSS ( SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",211],[0," vec4 skinCurvatureTexture = texture2D ( material_CurvatureTexture , uv ) ; \n"],[5,213],[0," vec4 skinCurvatureTexture = vec4 ( 1 ) ; \n"],[6],[0,"\nfloat skintexture = skinCurvatureTexture.r * material_CurvaturePower ;\nvec3 scatterAmt = material_SkinScatterAmount.rgb * skintexture ;\nvec3 sg = sgdiffuseLighting(incidentDirection, surfaceData.normal, scatterAmt) ;\nvec3 irradiance = sg * lightColor * PI ;\nfloat attenuation = clearCoatLobe(surfaceData, brdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\ndiffuseLobe(surfaceData, brdfData, attenuationIrradiance, diffuseColor) ;\nif ( surfaceData.dotNV > EPSILON ) { specularLobe(surfaceData, brdfData, incidentDirection, attenuationIrradiance, specularColor) ; }\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",449],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",223],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",229],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",235],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",241],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",247],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",339],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",261],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",259],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},271],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",275],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",279],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",283],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",287],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",291],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",295],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",299],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",303],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",307],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",311],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",315],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",319],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,321],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",325],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",329],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",333],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",337],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",387],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",347],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",351],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,353],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",361],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",359],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",369],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",367],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",377],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",375],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",381],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",385],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",401],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",395],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",399],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",405],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",409],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",413],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",427],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",419],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,421],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",425],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",437],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",433],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,435],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",447],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",443],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,445],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",525],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",459],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",465],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",471],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",477],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",509],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",485],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,487],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",491],[0," return vec3 ( 0 ) ; \n"],[5,503],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",495],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,497],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",501],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},507],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",513],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,515],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",519],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",523],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",531],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",782],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",547],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",543],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,545],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",551],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",555],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",571],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",561],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",565],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",569],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",579],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",577],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",591],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",585],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",589],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",603],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",597],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",601],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",619],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",609],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",617],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",615],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",623],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",627],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",631],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",635],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",639],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",643],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",647],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",651],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",655],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",659],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",663],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",667],[0," surfaceData.opacity = baseColor.a ; \n"],[5,669],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",673],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,675],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",679],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,684],[1,"HAS_DERIVATIVES",682],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,684],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",698],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},690],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,692],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",696],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",702],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",706],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",724],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",712],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,714],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",718],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",722],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",732],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",730],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",746],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",738],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,740],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",744],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",758],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",752],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",756],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",774],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",764],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",772],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",770],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",778],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,780],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},786],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},796],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,792],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,794],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, brdfData, totalDiffuseColor, totalSpecularColor) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,800],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file +{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",594],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",194],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},160],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",172],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",176],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",192],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",200],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",204],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",358],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",214],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",220],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",226],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",232],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",238],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",296],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",252],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",250],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},262],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",290],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",294],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",338],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",304],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",312],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",310],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",320],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",328],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",326],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",332],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",336],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",344],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",348],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",352],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",356],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",394],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",368],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",374],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",380],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",386],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",392],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",460],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,402],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",410],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",408],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",414],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",422],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",420],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",434],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",432],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",430],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",446],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},444],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",442],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},454],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",452],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,458],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",568],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",470],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",494],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",484],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",488],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",492],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",502],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",500],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",514],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",508],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",512],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",526],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",524],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",542],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",540],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",538],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",546],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",550],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",554],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",558],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",562],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",566],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",572],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",576],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,580],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",588],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",586],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},592],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",681],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",180],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},122],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",126],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",130],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",134],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",138],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",142],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",146],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",150],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",154],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",178],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",186],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",190],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",368],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",200],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",206],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",212],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",218],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",224],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",306],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",238],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",236],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},248],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",252],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",256],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",260],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",264],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",268],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",272],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",276],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",280],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",284],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",288],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",292],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",296],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",300],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",304],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",348],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",314],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",322],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",320],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",330],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",328],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",338],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",336],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",342],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",346],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",354],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",358],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",362],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",366],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",404],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",378],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",384],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",390],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",396],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",402],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",410],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",661],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",426],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",422],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,424],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",430],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",434],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",450],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",440],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",444],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",448],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",458],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",456],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",470],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",464],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",468],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",482],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",476],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",480],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",498],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",488],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",496],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",494],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",502],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",506],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",510],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",514],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",518],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",522],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",526],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",530],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",534],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",538],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",542],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",546],[0," surfaceData.opacity = baseColor.a ; \n"],[5,548],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",552],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,554],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",558],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,563],[1,"HAS_DERIVATIVES",561],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,563],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",577],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},569],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,571],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",575],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",581],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",585],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",603],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",591],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,593],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",597],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",601],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",611],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",609],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",625],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",617],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,619],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",623],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",637],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",631],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",635],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",653],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",643],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",651],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",649],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",657],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,659],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},665],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},675],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,671],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,673],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,679],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/bake-pbr/BakePBR.gsp b/packages/custom-material/libs/bake-pbr/BakePBR.gsp index 3a871895..a765bcdc 100644 --- a/packages/custom-material/libs/bake-pbr/BakePBR.gsp +++ b/packages/custom-material/libs/bake-pbr/BakePBR.gsp @@ -1 +1 @@ -{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",708],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",34],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,32],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",44],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,42],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",50],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",108],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",82],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",80],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},62],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,78],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",68],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",72],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,76],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",86],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",90],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",94],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",98],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",102],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",106],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",130],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",128],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",118],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,120],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",124],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,126],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",208],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",206],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",140],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,154],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},144],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,152],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,150],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",162],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",160],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",174],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},168],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},172],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,204],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},186],[0," \n"],[1,"RENDERER_HAS_NORMAL",180],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",184],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,202],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,200],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",288],[0,"\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},218],[0,"\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",246],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,224],[0," mediump int cascadeIndex = 0 ; \n"],[5,226],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",230],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,244],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,234],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,238],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,242],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",286],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",256],[0,"\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,270],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",262],[0,"\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,266],[0,"\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,274],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,284],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",282],[0,"\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",318],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",296],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",300],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,304],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",312],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",310],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},316],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",472],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",328],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",334],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",340],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",346],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",352],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",410],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",366],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",364],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},376],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",380],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",384],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",388],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",392],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",396],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",400],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",408],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",452],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",418],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",426],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",434],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",442],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",440],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",446],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",450],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",458],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",462],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",470],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",508],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",482],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",488],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",494],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",500],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",506],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",574],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,516],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",524],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",522],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",528],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",536],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",534],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",548],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",546],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",544],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",560],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},558],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",556],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},568],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",566],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,572],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",682],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",584],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",588],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",592],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",608],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",602],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",606],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",616],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",614],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",628],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",622],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",626],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",640],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",634],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",638],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",656],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",646],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",654],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",660],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",664],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",668],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",672],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",676],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",680],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",686],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",690],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,694],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",702],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",700],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},706],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",712],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",868],[0,"\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",38],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",26],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",32],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,36],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",58],[0,"\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,56],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,48],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",2,51],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",3,54],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",64],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",70],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",86],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",84],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",80],[0,"\n\n"],[5,82],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",114],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",112],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",96],[0,"\n\n"],[5,110],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0,"\n\n"],[5,108],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},104],[0,"\n\n"],[5,106],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",206],[0,"\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},124],[0,"\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",152],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,130],[0," mediump int cascadeIndex = 0 ; \n"],[5,132],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",136],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,150],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,140],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,144],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,148],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",204],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",162],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,176],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",168],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,172],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,180],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,190],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",188],[0,"\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,194],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,198],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",236],[0,"\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",214],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",218],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,222],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",230],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",228],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},234],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",533],[0,"\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",246],[0,"\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",252],[0,"\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",258],[0,"\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",264],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",270],[0,"\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",423],[0,"\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",284],[0,"\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},294],[0,"\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",298],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",302],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",306],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",310],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",314],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",318],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",322],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",326],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",330],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",334],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",338],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,340],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",344],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",348],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",352],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",356],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",360],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,362],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",366],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",376],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",372],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,374],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",391],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,382],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,385],[3,"REFRACTION_MODE","==",1,385],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",389],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",401],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",397],[0," return 1.0 ; \n"],[5,399],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",405],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",409],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",413],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",417],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",421],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",471],[0,"\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",431],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",435],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,437],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",445],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",443],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",453],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",451],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",461],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",459],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",465],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",469],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",485],[0,"\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",479],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",483],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",489],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",493],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",497],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",511],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",503],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,505],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",509],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",521],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",517],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,519],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",531],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",527],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,529],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",609],[0,"\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",543],[0,"\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",549],[0,"\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",555],[0,"\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",561],[0,"\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",593],[0,"\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",569],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,571],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",575],[0," return vec3 ( 0 ) ; \n"],[5,587],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",579],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,581],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",585],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},591],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",597],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,599],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",603],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",607],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",615],[0,"\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",866],[0,"\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",631],[0,"\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",627],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,629],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",635],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",639],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",655],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",645],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",649],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",653],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",663],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",661],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",675],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",669],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",673],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",687],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",681],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",685],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",703],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",693],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",701],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",699],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",707],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",711],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",715],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",719],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",723],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",727],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",731],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",735],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",739],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",743],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",747],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",751],[0," surfaceData.opacity = baseColor.a ; \n"],[5,753],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",757],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,759],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",763],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,768],[1,"HAS_DERIVATIVES",766],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,768],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",782],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},774],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,776],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",780],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",786],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",790],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",808],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",796],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,798],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",802],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",806],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",816],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",814],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",830],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",822],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,824],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",828],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",842],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",836],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",840],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",858],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",848],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",856],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",854],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",862],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,864],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",872],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},876],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},886],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,882],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,884],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",894],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",892],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",898],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,902],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file +{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",708],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",34],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,32],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",44],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,42],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",50],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",108],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",82],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",80],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},62],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,78],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",68],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",72],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,76],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",86],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",90],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",94],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",98],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",102],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",106],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",130],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",128],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",118],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,120],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",124],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,126],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",208],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",206],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",140],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,154],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},144],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,152],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,150],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",162],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",160],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",174],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},168],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},172],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,204],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},186],[0," \n"],[1,"RENDERER_HAS_NORMAL",180],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",184],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,202],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,200],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",288],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},218],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",246],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,224],[0," mediump int cascadeIndex = 0 ; \n"],[5,226],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",230],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,244],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,234],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,238],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,242],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",286],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",256],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,270],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",262],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,266],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,274],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,284],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",282],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",318],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",296],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",300],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,304],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",312],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",310],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},316],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",472],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",328],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",334],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",340],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",346],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",352],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",410],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",366],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",364],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},376],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",380],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",384],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",388],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",392],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",396],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",400],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",408],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",452],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",418],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",426],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",434],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",442],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",440],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",446],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",450],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",458],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",462],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",470],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",508],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",482],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",488],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",494],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",500],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",506],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",574],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,516],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",524],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",522],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",528],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",536],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",534],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",548],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",546],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",544],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",560],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},558],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",556],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},568],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",566],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,572],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",682],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",584],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",588],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",592],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",608],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",602],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",606],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",616],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",614],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",628],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",622],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",626],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",640],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",634],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",638],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",656],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",646],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",654],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",660],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",664],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",668],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",672],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",676],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",680],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",686],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",690],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,694],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",702],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",700],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},706],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",712],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",868],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",38],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",26],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",32],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,36],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",58],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,56],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,48],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",2,51],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",3,54],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",64],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",70],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",86],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",84],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",80],[0,"\n\n"],[5,82],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",114],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",112],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",96],[0,"\n\n"],[5,110],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0,"\n\n"],[5,108],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},104],[0,"\n\n"],[5,106],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",206],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},124],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",152],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,130],[0," mediump int cascadeIndex = 0 ; \n"],[5,132],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",136],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,150],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,140],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,144],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,148],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",204],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",162],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,176],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",168],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,172],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,180],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,190],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",188],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,194],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,198],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",236],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",214],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",218],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,222],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",230],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",228],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},234],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",533],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",246],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",252],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",258],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",264],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",270],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",423],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",284],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},294],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",298],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",302],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",306],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",310],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",314],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",318],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",322],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",326],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",330],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",334],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",338],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,340],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",344],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",348],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",352],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",356],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",360],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,362],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",366],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",376],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",372],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,374],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",391],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,382],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,385],[3,"REFRACTION_MODE","==",1,385],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",389],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",401],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",397],[0," return 1.0 ; \n"],[5,399],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",405],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",409],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",413],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",417],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",421],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",471],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",431],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",435],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,437],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",445],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",443],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",453],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",451],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",461],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",459],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",465],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",469],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",485],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",479],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",483],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",489],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",493],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",497],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",511],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",503],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,505],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",509],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",521],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",517],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,519],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",531],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",527],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,529],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",609],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",543],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",549],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",555],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",561],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",593],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",569],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,571],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",575],[0," return vec3 ( 0 ) ; \n"],[5,587],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",579],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,581],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",585],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},591],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",597],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,599],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",603],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",607],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",615],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",866],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",631],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",627],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,629],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",635],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",639],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",655],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",645],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",649],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",653],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",663],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",661],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",675],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",669],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",673],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",687],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",681],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",685],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",703],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",693],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",701],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",699],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",707],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",711],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",715],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",719],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",723],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",727],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",731],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",735],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",739],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",743],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",747],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",751],[0," surfaceData.opacity = baseColor.a ; \n"],[5,753],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",757],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,759],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",763],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,768],[1,"HAS_DERIVATIVES",766],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,768],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",782],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},774],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,776],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",780],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",786],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",790],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",808],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",796],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,798],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",802],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",806],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",816],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",814],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",830],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",822],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,824],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",828],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",842],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",836],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",840],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",858],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",848],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",856],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",854],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",862],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,864],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",872],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},876],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},886],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,882],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,884],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",894],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",892],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",898],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,902],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/grid/Grid.gsp b/packages/custom-material/libs/grid/Grid.gsp index 983169eb..a5f01ede 100644 --- a/packages/custom-material/libs/grid/Grid.gsp +++ b/packages/custom-material/libs/grid/Grid.gsp @@ -1 +1 @@ -{"name":"grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewInvMat;\nattribute vec4 POSITION_FLIP;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nbool flipY = camera_ProjectionParams.x < 0.0 ;\nfloat x = flipY ? POSITION_FLIP.z : POSITION_FLIP.x ;\nfloat y = flipY ? POSITION_FLIP.w : POSITION_FLIP.y ;\nnearPoint = UnprojectPoint(x, y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( x , y , 0.0 , 1.0 ) ;\n }\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ProjMat;\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n"],[6],[0,"\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) color.z = 1.0 ;\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) color.x = 1.0 ;\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ;\ngl_FragColor = sRGBToLinear(gl_FragColor) ; }"]]}]}]} \ No newline at end of file +{"name":"grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewInvMat;\nattribute vec4 POSITION_FLIP;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nbool flipY = camera_ProjectionParams.x < 0.0 ;\nfloat x = flipY ? POSITION_FLIP.z : POSITION_FLIP.x ;\nfloat y = flipY ? POSITION_FLIP.w : POSITION_FLIP.y ;\nnearPoint = UnprojectPoint(x, y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( x , y , 0.0 , 1.0 ) ;\n }\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ProjMat;\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n"],[6],[0,"\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) color.z = 1.0 ;\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) color.x = 1.0 ;\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ;\ngl_FragColor = sRGBToLinear(gl_FragColor) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/plain-color/PlainColor.gsp b/packages/custom-material/libs/plain-color/PlainColor.gsp index ccb949de..c8d99222 100644 --- a/packages/custom-material/libs/plain-color/PlainColor.gsp +++ b/packages/custom-material/libs/plain-color/PlainColor.gsp @@ -1 +1 @@ -{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file +{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/water/Water.gsp b/packages/custom-material/libs/water/Water.gsp index fc889410..128892f2 100644 --- a/packages/custom-material/libs/water/Water.gsp +++ b/packages/custom-material/libs/water/Water.gsp @@ -1 +1 @@ -{"name":"water","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * sin ( u_time ) , u_water_speed.y * cos ( u_time ) ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_edgeTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 edgeTex = texture2D ( u_edgeTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat edge = pow ( ( v_color.r + edgeTex.r ) * v_color.r , 2.0 ) ;\nedge = saturate(1.0 - smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edge )) ;\nvec4 finalCol = mix ( waterTex , u_edgeColor , edge ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file +{"name":"water","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * sin ( u_time ) , u_water_speed.y * cos ( u_time ) ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_edgeTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 edgeTex = texture2D ( u_edgeTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat edge = pow ( ( v_color.r + edgeTex.r ) * v_color.r , 2.0 ) ;\nedge = saturate(1.0 - smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edge )) ;\nvec4 finalCol = mix ( waterTex , u_edgeColor , edge ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/water/WaterFall.gsp b/packages/custom-material/libs/water/WaterFall.gsp index 02b315b7..362e5f65 100644 --- a/packages/custom-material/libs/water/WaterFall.gsp +++ b/packages/custom-material/libs/water/WaterFall.gsp @@ -1 +1 @@ -{"name":"water-fall","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_waterfall_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * u_time , u_water_speed.y * u_time ) ;\nwaterfallTexCoords = TEXCOORD_0 + vec2 ( u_waterfall_speed.x * u_time , u_waterfall_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_waterfallTex;\nuniform sampler2D u_edgeNoiseTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 waterfallTex = texture2D ( u_waterfallTex , waterfallTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 streamEdge = texture2D ( u_edgeNoiseTex , waterTexCoords ) ;\nvec4 fallEdge = texture2D ( u_edgeNoiseTex , waterfallTexCoords ) ;\nfloat edgeShape = mix ( fallEdge.r , streamEdge.r , v_color.r ) ;\nedgeShape = saturate(edgeShape * v_color.g) ;\nedgeShape = saturate(smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edgeShape )) ;\nvec4 waterAll = mix ( waterfallTex , waterTex , v_color.r ) ;\nvec4 finalCol = mix ( waterAll , u_edgeColor , edgeShape ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file +{"name":"water-fall","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_waterfall_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * u_time , u_water_speed.y * u_time ) ;\nwaterfallTexCoords = TEXCOORD_0 + vec2 ( u_waterfall_speed.x * u_time , u_waterfall_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_waterfallTex;\nuniform sampler2D u_edgeNoiseTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 waterfallTex = texture2D ( u_waterfallTex , waterfallTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 streamEdge = texture2D ( u_edgeNoiseTex , waterTexCoords ) ;\nvec4 fallEdge = texture2D ( u_edgeNoiseTex , waterfallTexCoords ) ;\nfloat edgeShape = mix ( fallEdge.r , streamEdge.r , v_color.r ) ;\nedgeShape = saturate(edgeShape * v_color.g) ;\nedgeShape = saturate(smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edgeShape )) ;\nvec4 waterAll = mix ( waterfallTex , waterTex , v_color.r ) ;\nvec4 finalCol = mix ( waterAll , u_edgeColor , edgeShape ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/water/WaterRipple.gsp b/packages/custom-material/libs/water/WaterRipple.gsp index eab6ebd2..18566e23 100644 --- a/packages/custom-material/libs/water/WaterRipple.gsp +++ b/packages/custom-material/libs/water/WaterRipple.gsp @@ -1 +1 @@ -{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file +{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp b/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp index bac053ef..3fe70137 100644 --- a/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp +++ b/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp @@ -1 +1 @@ -{"name":"framebuffer-picker-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec3 u_pickColor;\nvoid main() { gl_FragColor = vec4 ( u_pickColor , 1.0 ) ; }"]]}]}]} \ No newline at end of file +{"name":"framebuffer-picker-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec3 u_pickColor;\nvoid main() { gl_FragColor = vec4 ( u_pickColor , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/libs/index.ts index 6bd1d978..962a3093 100644 --- a/packages/framebuffer-picker/libs/index.ts +++ b/packages/framebuffer-picker/libs/index.ts @@ -1,6 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit import FramebufferPickerColorSource from "./FramebufferPickerColor.gsp"; -export { - FramebufferPickerColorSource -}; +export { FramebufferPickerColorSource }; diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/libs/index.ts index 5942bd02..d6be11ce 100644 --- a/packages/geometry-sketch/libs/index.ts +++ b/packages/geometry-sketch/libs/index.ts @@ -2,7 +2,4 @@ import TBNSource from "./material/TBN.gsp"; import WireframeSource from "./material/Wireframe.gsp"; -export { - TBNSource, - WireframeSource -}; +export { TBNSource, WireframeSource }; diff --git a/packages/geometry-sketch/libs/material/TBN.gsp b/packages/geometry-sketch/libs/material/TBN.gsp index ad9af603..5cecec02 100644 --- a/packages/geometry-sketch/libs/material/TBN.gsp +++ b/packages/geometry-sketch/libs/material/TBN.gsp @@ -1 +1 @@ -{"name":"tbnShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float u_lineScale;\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform mat4 u_worldNormal;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { int pointIndex = gl_VertexID / 2 ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},156],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\ngl_Position.xyz += normalize ( normalW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},160],[0," if ( gl_VertexID % 2 == 1 ) { vec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\ngl_Position.xyz += normalize ( tangentW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"SHOW_BITANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},164],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\nvec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\nvec3 bitangentW = cross ( normalW , tangentW ) * tangent.w ;\ngl_Position.xyz += normalize ( bitangentW ) * u_lineScale ; } \n"],[6],[0,"\ngl_Position = camera_VPMat * gl_Position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { gl_FragColor = material_BaseColor ; }"]]}]}]} \ No newline at end of file +{"name":"tbnShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float u_lineScale;\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform mat4 u_worldNormal;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { int pointIndex = gl_VertexID / 2 ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},156],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\ngl_Position.xyz += normalize ( normalW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},160],[0," if ( gl_VertexID % 2 == 1 ) { vec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\ngl_Position.xyz += normalize ( tangentW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"SHOW_BITANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},164],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\nvec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\nvec3 bitangentW = cross ( normalW , tangentW ) * tangent.w ;\ngl_Position.xyz += normalize ( bitangentW ) * u_lineScale ; } \n"],[6],[0,"\ngl_Position = camera_VPMat * gl_Position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { gl_FragColor = material_BaseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/geometry-sketch/libs/material/Wireframe.gsp b/packages/geometry-sketch/libs/material/Wireframe.gsp index 45b1a8d3..97b67197 100644 --- a/packages/geometry-sketch/libs/material/Wireframe.gsp +++ b/packages/geometry-sketch/libs/material/Wireframe.gsp @@ -1 +1 @@ -{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file +{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file diff --git a/packages/gizmo/libs/icon/Icon.gsp b/packages/gizmo/libs/icon/Icon.gsp index 5716c58a..01ca5012 100644 --- a/packages/gizmo/libs/icon/Icon.gsp +++ b/packages/gizmo/libs/icon/Icon.gsp @@ -1 +1 @@ -{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file +{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/libs/index.ts index 2f40a7b0..1c62fb5a 100644 --- a/packages/gizmo/libs/index.ts +++ b/packages/gizmo/libs/index.ts @@ -1,6 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit import IconSource from "./icon/Icon.gsp"; -export { - IconSource -}; +export { IconSource }; diff --git a/packages/lines/libs/index.ts b/packages/lines/libs/index.ts index 7c42eb69..6fee972c 100644 --- a/packages/lines/libs/index.ts +++ b/packages/lines/libs/index.ts @@ -2,7 +2,4 @@ import DashSource from "./line/material/Dash.gsp"; import LineSource from "./line/material/Line.gsp"; -export { - DashSource, - LineSource -}; +export { DashSource, LineSource }; diff --git a/packages/outline/libs/OutlinePostprocess.gsp b/packages/outline/libs/OutlinePostprocess.gsp index 1207ee71..22194ebb 100644 --- a/packages/outline/libs/OutlinePostprocess.gsp +++ b/packages/outline/libs/OutlinePostprocess.gsp @@ -1 +1 @@ -{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,90],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file +{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/libs/OutlineReplace.gsp b/packages/outline/libs/OutlineReplace.gsp index bfd54801..13b40492 100644 --- a/packages/outline/libs/OutlineReplace.gsp +++ b/packages/outline/libs/OutlineReplace.gsp @@ -1 +1 @@ -{"name":"outline-replace-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { Varyings v ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ;\nreturn v ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n"],[7,"COMMON_INCLUDED"],[0,"\n"],[8,"PI","3.14159265359"],[0,"\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n"],[8,"EPSILON","1e-6"],[0,"\n"],[8,"LOG2","1.442695"],[0,"\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 camera_OutlineReplaceColor;\nvoid main() { gl_FragColor = camera_OutlineReplaceColor ; }"]]}]}]} \ No newline at end of file +{"name":"outline-replace-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { Varyings v ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ;\nreturn v ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 camera_OutlineReplaceColor;\nvoid main() { gl_FragColor = camera_OutlineReplaceColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/libs/index.ts b/packages/outline/libs/index.ts index 7ed1df97..9bc1375c 100644 --- a/packages/outline/libs/index.ts +++ b/packages/outline/libs/index.ts @@ -2,7 +2,4 @@ import OutlinePostprocessSource from "./OutlinePostprocess.gsp"; import OutlineReplaceSource from "./OutlineReplace.gsp"; -export { - OutlinePostprocessSource, - OutlineReplaceSource -}; +export { OutlinePostprocessSource, OutlineReplaceSource }; diff --git a/packages/skeleton-viewer/libs/SkeletonViewer.gsp b/packages/skeleton-viewer/libs/SkeletonViewer.gsp index 245afdae..cff6c023 100644 --- a/packages/skeleton-viewer/libs/SkeletonViewer.gsp +++ b/packages/skeleton-viewer/libs/SkeletonViewer.gsp @@ -1 +1 @@ -{"name":"skeleton-viewer","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",62],[0," v_normal = normalize ( mat3 ( renderer_NormalMat ) * NORMAL ) ; \n"],[6],[0,"\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nuniform vec3 u_colorMin;\nuniform vec3 u_colorMax;\nvoid main() { float ndl = dot ( v_normal , vec3 ( 0 , 1 , 0 ) ) * 0.5 + 0.5 ;\nvec3 diffuse = mix ( u_colorMin , u_colorMax , ndl ) ;\ngl_FragColor = vec4 ( diffuse , 1.0 ) ; }"]]}]}]} \ No newline at end of file +{"name":"skeleton-viewer","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",62],[0," v_normal = normalize ( mat3 ( renderer_NormalMat ) * NORMAL ) ; \n"],[6],[0,"\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nuniform vec3 u_colorMin;\nuniform vec3 u_colorMax;\nvoid main() { float ndl = dot ( v_normal , vec3 ( 0 , 1 , 0 ) ) * 0.5 + 0.5 ;\nvec3 diffuse = mix ( u_colorMin , u_colorMax , ndl ) ;\ngl_FragColor = vec4 ( diffuse , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/libs/index.ts index 71dea8a1..b4346676 100644 --- a/packages/skeleton-viewer/libs/index.ts +++ b/packages/skeleton-viewer/libs/index.ts @@ -1,6 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit import SkeletonViewerSource from "./SkeletonViewer.gsp"; -export { - SkeletonViewerSource -}; +export { SkeletonViewerSource }; From 9b4ded4dffce69ebbea38a79b3243ad6967984a8 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 28 Apr 2026 19:19:46 +0800 Subject: [PATCH 10/27] build: regenerate libs/index.ts with // prettier-ignore guard Bundler now emits the export block with a `// prettier-ignore` directive (config-agnostic) instead of trying to mimic the consumer's printWidth. Re-run precompile to update all eight package indices. --- packages/controls/libs/index.ts | 5 ++++- packages/custom-material/libs/index.ts | 1 + packages/framebuffer-picker/libs/index.ts | 5 ++++- packages/geometry-sketch/libs/index.ts | 6 +++++- packages/gizmo/libs/index.ts | 5 ++++- packages/lines/libs/index.ts | 6 +++++- packages/outline/libs/index.ts | 6 +++++- packages/skeleton-viewer/libs/index.ts | 5 ++++- 8 files changed, 32 insertions(+), 7 deletions(-) diff --git a/packages/controls/libs/index.ts b/packages/controls/libs/index.ts index 4eb01a35..830109e4 100644 --- a/packages/controls/libs/index.ts +++ b/packages/controls/libs/index.ts @@ -1,4 +1,7 @@ // Auto-generated by shader-precompile --emit-index — do not edit import BoxSelectionSource from "./box-selection/BoxSelection.gsp"; -export { BoxSelectionSource }; +// prettier-ignore +export { + BoxSelectionSource +}; diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/libs/index.ts index f4bc0b6e..3cdc6040 100644 --- a/packages/custom-material/libs/index.ts +++ b/packages/custom-material/libs/index.ts @@ -11,6 +11,7 @@ import WaterFallSource from "./water/WaterFall.gsp"; import WaterRippleSource from "./water/WaterRipple.gsp"; import WaterSource from "./water/Water.gsp"; +// prettier-ignore export { BakePBRSource, EyeSource, diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/libs/index.ts index 962a3093..1fb1c677 100644 --- a/packages/framebuffer-picker/libs/index.ts +++ b/packages/framebuffer-picker/libs/index.ts @@ -1,4 +1,7 @@ // Auto-generated by shader-precompile --emit-index — do not edit import FramebufferPickerColorSource from "./FramebufferPickerColor.gsp"; -export { FramebufferPickerColorSource }; +// prettier-ignore +export { + FramebufferPickerColorSource +}; diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/libs/index.ts index d6be11ce..1eb3fe9d 100644 --- a/packages/geometry-sketch/libs/index.ts +++ b/packages/geometry-sketch/libs/index.ts @@ -2,4 +2,8 @@ import TBNSource from "./material/TBN.gsp"; import WireframeSource from "./material/Wireframe.gsp"; -export { TBNSource, WireframeSource }; +// prettier-ignore +export { + TBNSource, + WireframeSource +}; diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/libs/index.ts index 1c62fb5a..cc28833f 100644 --- a/packages/gizmo/libs/index.ts +++ b/packages/gizmo/libs/index.ts @@ -1,4 +1,7 @@ // Auto-generated by shader-precompile --emit-index — do not edit import IconSource from "./icon/Icon.gsp"; -export { IconSource }; +// prettier-ignore +export { + IconSource +}; diff --git a/packages/lines/libs/index.ts b/packages/lines/libs/index.ts index 6fee972c..96a3ba2a 100644 --- a/packages/lines/libs/index.ts +++ b/packages/lines/libs/index.ts @@ -2,4 +2,8 @@ import DashSource from "./line/material/Dash.gsp"; import LineSource from "./line/material/Line.gsp"; -export { DashSource, LineSource }; +// prettier-ignore +export { + DashSource, + LineSource +}; diff --git a/packages/outline/libs/index.ts b/packages/outline/libs/index.ts index 9bc1375c..f8ace5a8 100644 --- a/packages/outline/libs/index.ts +++ b/packages/outline/libs/index.ts @@ -2,4 +2,8 @@ import OutlinePostprocessSource from "./OutlinePostprocess.gsp"; import OutlineReplaceSource from "./OutlineReplace.gsp"; -export { OutlinePostprocessSource, OutlineReplaceSource }; +// prettier-ignore +export { + OutlinePostprocessSource, + OutlineReplaceSource +}; diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/libs/index.ts index b4346676..334ae949 100644 --- a/packages/skeleton-viewer/libs/index.ts +++ b/packages/skeleton-viewer/libs/index.ts @@ -1,4 +1,7 @@ // Auto-generated by shader-precompile --emit-index — do not edit import SkeletonViewerSource from "./SkeletonViewer.gsp"; -export { SkeletonViewerSource }; +// prettier-ignore +export { + SkeletonViewerSource +}; From 91bc86178a00930da46acaa8dac99365dd2e3db9 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 28 Apr 2026 19:54:52 +0800 Subject: [PATCH 11/27] fix(build): cold-start build order + correct types path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `pnpm clean && pnpm b:all` from a fresh checkout failed in three ways. Fix each: 1. Rollup ran all package configs in parallel via `Promise.all`, so on a cold checkout `auxiliary-lines` (and other consumers) tried to resolve `@galacean/engine-toolkit-custom-material/dist/es/index.js` before custom-material's bundle had been emitted. Topologically sort `pkgs` in `rollup.config.mjs` by intra-workspace deps before feeding rollup. 2. `pnpm -r run b:types` topo-sorts but the parallel default still raced consumer tsc processes ahead of providers. Add `--workspace-concurrency=1` to the `b:types` script so each package's `tsc` finishes before the next dependent one starts. 3. Adding `libs/**/*` to each package's `tsconfig.json` `include` shifted tsc's emitted declaration tree under `types/src/...`, stranding the package.json `"types": "types/index.d.ts"` pointer. Revert the include addition; keep the same IDE benefit by shipping a tiny `libs/global.d.ts` per package that declares the `*.gsp` module shape locally — sibling to `libs/index.ts`, so the language server picks it up when editing libs files directly. Drop the now-redundant `*.gsp` declaration from each `src/global.d.ts`. Verified: `pnpm clean && pnpm b:all` succeeds end-to-end on a fresh workspace, including 21 .gsp products precompiled and all package types emitted at the package.json-advertised paths. --- package.json | 2 +- packages/controls/libs/global.d.ts | 4 +++ packages/controls/src/global.d.ts | 5 ---- packages/controls/tsconfig.json | 3 +- packages/custom-material/libs/global.d.ts | 4 +++ packages/custom-material/src/global.d.ts | 5 ---- packages/custom-material/tsconfig.json | 3 +- packages/framebuffer-picker/libs/global.d.ts | 4 +++ packages/framebuffer-picker/src/global.d.ts | 5 ---- packages/framebuffer-picker/tsconfig.json | 3 +- packages/geometry-sketch/libs/global.d.ts | 4 +++ packages/geometry-sketch/src/global.d.ts | 5 ---- packages/geometry-sketch/tsconfig.json | 3 +- packages/gizmo/libs/global.d.ts | 4 +++ packages/gizmo/src/global.d.ts | 5 ---- packages/gizmo/tsconfig.json | 3 +- packages/lines/libs/global.d.ts | 4 +++ packages/lines/src/global.d.ts | 5 ---- packages/lines/tsconfig.json | 3 +- packages/outline/libs/global.d.ts | 4 +++ packages/outline/src/global.d.ts | 5 ---- packages/outline/tsconfig.json | 3 +- packages/skeleton-viewer/libs/global.d.ts | 4 +++ packages/skeleton-viewer/src/global.d.ts | 5 ---- packages/skeleton-viewer/tsconfig.json | 3 +- rollup.config.mjs | 29 +++++++++++++++++++- 26 files changed, 69 insertions(+), 58 deletions(-) create mode 100644 packages/controls/libs/global.d.ts create mode 100644 packages/custom-material/libs/global.d.ts create mode 100644 packages/framebuffer-picker/libs/global.d.ts create mode 100644 packages/geometry-sketch/libs/global.d.ts create mode 100644 packages/gizmo/libs/global.d.ts create mode 100644 packages/lines/libs/global.d.ts create mode 100644 packages/outline/libs/global.d.ts create mode 100644 packages/skeleton-viewer/libs/global.d.ts diff --git a/package.json b/package.json index 210fad03..453bc7ef 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "ci": "pnpm install && npm run build && npm run b:types && npm run test-cov", "lint": "eslint packages/*/src --ext .ts", "watch": "rollup -cw -m inline", - "b:types": "pnpm -r --filter=./packages/* run b:types", + "b:types": "pnpm -r --workspace-concurrency=1 --filter=./packages/* run b:types", "precompile": "pnpm -r --filter=./packages/* --if-present run precompile", "build": "npm run precompile && rollup -c", "b:all": "npm run precompile && pnpm run b:types && cross-env BUILD_TYPE=ALL rollup -c", diff --git a/packages/controls/libs/global.d.ts b/packages/controls/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/controls/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/controls/src/global.d.ts b/packages/controls/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/controls/src/global.d.ts +++ b/packages/controls/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/controls/tsconfig.json b/packages/controls/tsconfig.json index 617c700c..4cfb7f0b 100644 --- a/packages/controls/tsconfig.json +++ b/packages/controls/tsconfig.json @@ -13,7 +13,6 @@ "sourceMap": true }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/custom-material/libs/global.d.ts b/packages/custom-material/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/custom-material/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/custom-material/src/global.d.ts b/packages/custom-material/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/custom-material/src/global.d.ts +++ b/packages/custom-material/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/custom-material/tsconfig.json b/packages/custom-material/tsconfig.json index 9496e398..ff527f32 100644 --- a/packages/custom-material/tsconfig.json +++ b/packages/custom-material/tsconfig.json @@ -14,7 +14,6 @@ "sourceMap": true }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/framebuffer-picker/libs/global.d.ts b/packages/framebuffer-picker/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/framebuffer-picker/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/framebuffer-picker/src/global.d.ts b/packages/framebuffer-picker/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/framebuffer-picker/src/global.d.ts +++ b/packages/framebuffer-picker/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/framebuffer-picker/tsconfig.json b/packages/framebuffer-picker/tsconfig.json index 5556eae9..3d701afc 100644 --- a/packages/framebuffer-picker/tsconfig.json +++ b/packages/framebuffer-picker/tsconfig.json @@ -15,7 +15,6 @@ "incremental": false }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/geometry-sketch/libs/global.d.ts b/packages/geometry-sketch/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/geometry-sketch/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/geometry-sketch/src/global.d.ts b/packages/geometry-sketch/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/geometry-sketch/src/global.d.ts +++ b/packages/geometry-sketch/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/geometry-sketch/tsconfig.json b/packages/geometry-sketch/tsconfig.json index 617c700c..4cfb7f0b 100644 --- a/packages/geometry-sketch/tsconfig.json +++ b/packages/geometry-sketch/tsconfig.json @@ -13,7 +13,6 @@ "sourceMap": true }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/gizmo/libs/global.d.ts b/packages/gizmo/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/gizmo/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/gizmo/src/global.d.ts b/packages/gizmo/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/gizmo/src/global.d.ts +++ b/packages/gizmo/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/gizmo/tsconfig.json b/packages/gizmo/tsconfig.json index 617c700c..4cfb7f0b 100644 --- a/packages/gizmo/tsconfig.json +++ b/packages/gizmo/tsconfig.json @@ -13,7 +13,6 @@ "sourceMap": true }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/lines/libs/global.d.ts b/packages/lines/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/lines/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts index 7416df1b..4814c4df 100644 --- a/packages/lines/src/global.d.ts +++ b/packages/lines/src/global.d.ts @@ -4,8 +4,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/lines/tsconfig.json b/packages/lines/tsconfig.json index 617c700c..4cfb7f0b 100644 --- a/packages/lines/tsconfig.json +++ b/packages/lines/tsconfig.json @@ -13,7 +13,6 @@ "sourceMap": true }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/outline/libs/global.d.ts b/packages/outline/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/outline/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/outline/src/global.d.ts b/packages/outline/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/outline/src/global.d.ts +++ b/packages/outline/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/outline/tsconfig.json b/packages/outline/tsconfig.json index 5556eae9..3d701afc 100644 --- a/packages/outline/tsconfig.json +++ b/packages/outline/tsconfig.json @@ -15,7 +15,6 @@ "incremental": false }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/packages/skeleton-viewer/libs/global.d.ts b/packages/skeleton-viewer/libs/global.d.ts new file mode 100644 index 00000000..ef45587d --- /dev/null +++ b/packages/skeleton-viewer/libs/global.d.ts @@ -0,0 +1,4 @@ +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/skeleton-viewer/src/global.d.ts b/packages/skeleton-viewer/src/global.d.ts index 048f4523..8d32d621 100644 --- a/packages/skeleton-viewer/src/global.d.ts +++ b/packages/skeleton-viewer/src/global.d.ts @@ -2,8 +2,3 @@ declare module "*.shader" { const value: string; export default value; } - -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/skeleton-viewer/tsconfig.json b/packages/skeleton-viewer/tsconfig.json index f9c2a9c5..3939a36c 100644 --- a/packages/skeleton-viewer/tsconfig.json +++ b/packages/skeleton-viewer/tsconfig.json @@ -14,7 +14,6 @@ "incremental": false }, "include": [ - "src/**/*", - "libs/**/*" + "src/**/*" ] } diff --git a/rollup.config.mjs b/rollup.config.mjs index a6590759..5bc54e80 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -22,7 +22,7 @@ function walk(dir) { } const pkgsRoot = path.join(process.cwd(), "packages"); -const pkgs = fs +const rawPkgs = fs .readdirSync(pkgsRoot) .map((dir) => path.join(pkgsRoot, dir)) .filter((dir) => fs.statSync(dir).isDirectory()) @@ -33,6 +33,33 @@ const pkgs = fs }; }); +// Topological sort by intra-workspace deps so consumers (e.g. auxiliary-lines +// → custom-material) build after their providers. Without this, rollup's +// `Promise.all` over the flattened config array races, and on a cold checkout +// the consumer's bundle fails to resolve the provider's not-yet-emitted +// `dist/es/index.js`. +const pkgs = (() => { + const byName = new Map(rawPkgs.map((p) => [p.pkgJson.name, p])); + const sorted = []; + const visited = new Set(); + const visiting = new Set(); + function visit(p) { + if (visited.has(p)) return; + if (visiting.has(p)) return; // skip cycles (shouldn't exist, but safe) + visiting.add(p); + const allDeps = { ...(p.pkgJson.dependencies ?? {}), ...(p.pkgJson.peerDependencies ?? {}) }; + for (const dep of Object.keys(allDeps)) { + const depPkg = byName.get(dep); + if (depPkg) visit(depPkg); + } + visiting.delete(p); + visited.add(p); + sorted.push(p); + } + rawPkgs.forEach(visit); + return sorted; +})(); + // "@galacean/engine-toolkit" 、 "@galacean/engine-toolkit-controls" ... function toGlobalName(pkgName) { return camelCase(pkgName); From ed4c032d1502582e95f653e3d57a94fdb881af46 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Wed, 29 Apr 2026 11:07:22 +0800 Subject: [PATCH 12/27] build: regenerate libs/index.ts with TS Server triple-slash hint `fix(shader-compiler): emit triple-slash reference in libs/index.ts` adds `/// ` to auto-generated indices when a sibling `libs/global.d.ts` exists, so opening these loose files in the IDE no longer squiggles `*.gsp` imports as missing type declarations. Re-run precompile to refresh the eight package indices accordingly. --- packages/controls/libs/index.ts | 1 + packages/custom-material/libs/index.ts | 1 + packages/framebuffer-picker/libs/index.ts | 1 + packages/geometry-sketch/libs/index.ts | 1 + packages/gizmo/libs/index.ts | 1 + packages/lines/libs/index.ts | 1 + packages/outline/libs/index.ts | 1 + packages/skeleton-viewer/libs/index.ts | 1 + 8 files changed, 8 insertions(+) diff --git a/packages/controls/libs/index.ts b/packages/controls/libs/index.ts index 830109e4..7ac1be64 100644 --- a/packages/controls/libs/index.ts +++ b/packages/controls/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import BoxSelectionSource from "./box-selection/BoxSelection.gsp"; // prettier-ignore diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/libs/index.ts index 3cdc6040..f8d45b9f 100644 --- a/packages/custom-material/libs/index.ts +++ b/packages/custom-material/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import BakePBRSource from "./bake-pbr/BakePBR.gsp"; import EyeSource from "./advanced-shader/eye/Eye.gsp"; import GridSource from "./grid/Grid.gsp"; diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/libs/index.ts index 1fb1c677..6e4803aa 100644 --- a/packages/framebuffer-picker/libs/index.ts +++ b/packages/framebuffer-picker/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import FramebufferPickerColorSource from "./FramebufferPickerColor.gsp"; // prettier-ignore diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/libs/index.ts index 1eb3fe9d..8caabcf7 100644 --- a/packages/geometry-sketch/libs/index.ts +++ b/packages/geometry-sketch/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import TBNSource from "./material/TBN.gsp"; import WireframeSource from "./material/Wireframe.gsp"; diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/libs/index.ts index cc28833f..7c6289af 100644 --- a/packages/gizmo/libs/index.ts +++ b/packages/gizmo/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import IconSource from "./icon/Icon.gsp"; // prettier-ignore diff --git a/packages/lines/libs/index.ts b/packages/lines/libs/index.ts index 96a3ba2a..a2811ee6 100644 --- a/packages/lines/libs/index.ts +++ b/packages/lines/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import DashSource from "./line/material/Dash.gsp"; import LineSource from "./line/material/Line.gsp"; diff --git a/packages/outline/libs/index.ts b/packages/outline/libs/index.ts index f8ace5a8..a12ba73f 100644 --- a/packages/outline/libs/index.ts +++ b/packages/outline/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import OutlinePostprocessSource from "./OutlinePostprocess.gsp"; import OutlineReplaceSource from "./OutlineReplace.gsp"; diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/libs/index.ts index 334ae949..12106780 100644 --- a/packages/skeleton-viewer/libs/index.ts +++ b/packages/skeleton-viewer/libs/index.ts @@ -1,4 +1,5 @@ // Auto-generated by shader-precompile --emit-index — do not edit +/// import SkeletonViewerSource from "./SkeletonViewer.gsp"; // prettier-ignore From c6858807dd72f4b60bc8ccaf05df298bab7bda9d Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Wed, 29 Apr 2026 13:57:20 +0800 Subject: [PATCH 13/27] build: migrate husky from v4 config to v8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The repo had `husky: ^8.0.3` in devDeps but kept the v4-style `husky.hooks` block in package.json plus stale v4-era scripts in `.git/hooks/`. v8 doesn't read the v4 config, and the leftover `pnpx --no-install husky-run` invocation in the v4 hooks crashes under modern pnpm (which routes `pnpx` to `pnpm dlx` and rejects `--no-install` as a package name). Net effect: per-developer hook behavior was an open box — some envs ran broken hooks, others ran none. Migrate to the v8 standard: - Drop the `husky.hooks` config from package.json. - Add `prepare: husky install` so `pnpm install` initializes hooks on every fresh clone, pointing `core.hooksPath` at `.husky/`. - Commit `.husky/pre-commit` (lint-staged) and `.husky/commit-msg` (commitlint) so all devs share the same hook content via git. - Auto-generated `.husky/_/` is gitignored by husky install. After this, `.git/hooks/` becomes irrelevant (git reads `core.hooksPath`), so each dev's stale v4 leftovers no longer fire. --- .husky/commit-msg | 4 ++++ .husky/pre-commit | 4 ++++ package.json | 7 +------ 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100755 .husky/commit-msg create mode 100755 .husky/pre-commit diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000..45348d3a --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +pnpm exec commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..58b1861c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +pnpm exec lint-staged diff --git a/package.json b/package.json index 453bc7ef..357e2206 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { "preinstall": "npx only-allow pnpm", + "prepare": "husky install", "test": "cross-env TS_NODE_PROJECT=tsconfig.tests.json floss --path tests -r ts-node/register", "test-debug": "cross-env TS_NODE_PROJECT=tsconfig.tests.json floss --path tests -r ts-node/register --debug", "test-cov": "cross-env TS_NODE_PROJECT=tsconfig.tests.json nyc --reporter=lcov floss --path tests -r ts-node/register", @@ -61,12 +62,6 @@ "ts-node": "^10", "typescript": "^4.8.3" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } - }, "lint-staged": { "*.{ts}": [ "eslint --fix", From df4a0c635bacbe238c56ee111cf3c9b71691edfb Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Wed, 29 Apr 2026 13:57:41 +0800 Subject: [PATCH 14/27] build: re-export libs/ from src/, align types path with engine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each package's `src/index.ts` now does `export * from "../libs"`, mirroring engine's pattern. Two effects: 1. `libs/index.ts` joins the TS project graph through the include chain, so the IDE resolves `*.gsp` imports via `src/global.d.ts` (extended with `declare module "*.gsp"`). Drops the previous `libs/global.d.ts` sidecar + auto-emitted triple-slash hint. 2. tsc auto-adjusts rootDir to the package root because `src/` imports cross into `../libs/`, shifting emitted declarations under `types/src/...`. Update each `package.json` `"types"` path accordingly — matches engine's existing layout. Verified: `pnpm clean && pnpm b:all` succeeds end-to-end; all 8 packages emit types at the new paths. --- packages/controls/libs/global.d.ts | 4 ---- packages/controls/libs/index.ts | 1 - packages/controls/package.json | 2 +- packages/controls/src/global.d.ts | 5 +++++ packages/controls/src/index.ts | 2 ++ packages/custom-material/libs/global.d.ts | 4 ---- packages/custom-material/libs/index.ts | 1 - packages/custom-material/package.json | 6 +++--- packages/custom-material/src/global.d.ts | 5 +++++ packages/custom-material/src/index.ts | 2 ++ packages/framebuffer-picker/libs/global.d.ts | 4 ---- packages/framebuffer-picker/libs/index.ts | 1 - packages/framebuffer-picker/package.json | 2 +- packages/framebuffer-picker/src/global.d.ts | 5 +++++ packages/framebuffer-picker/src/index.ts | 2 ++ packages/geometry-sketch/libs/global.d.ts | 4 ---- packages/geometry-sketch/libs/index.ts | 1 - packages/geometry-sketch/package.json | 2 +- packages/geometry-sketch/src/global.d.ts | 5 +++++ packages/geometry-sketch/src/index.ts | 2 ++ packages/gizmo/libs/global.d.ts | 4 ---- packages/gizmo/libs/index.ts | 1 - packages/gizmo/package.json | 2 +- packages/gizmo/src/global.d.ts | 5 +++++ packages/gizmo/src/index.ts | 2 ++ packages/lines/libs/global.d.ts | 4 ---- packages/lines/libs/index.ts | 1 - packages/lines/package.json | 2 +- packages/lines/src/global.d.ts | 5 +++++ packages/lines/src/index.ts | 2 ++ packages/outline/libs/global.d.ts | 4 ---- packages/outline/libs/index.ts | 1 - packages/outline/package.json | 2 +- packages/outline/src/global.d.ts | 5 +++++ packages/outline/src/index.ts | 2 ++ packages/skeleton-viewer/libs/global.d.ts | 4 ---- packages/skeleton-viewer/libs/index.ts | 1 - packages/skeleton-viewer/package.json | 2 +- packages/skeleton-viewer/src/global.d.ts | 5 +++++ packages/skeleton-viewer/src/index.ts | 2 ++ 40 files changed, 66 insertions(+), 50 deletions(-) delete mode 100644 packages/controls/libs/global.d.ts delete mode 100644 packages/custom-material/libs/global.d.ts delete mode 100644 packages/framebuffer-picker/libs/global.d.ts delete mode 100644 packages/geometry-sketch/libs/global.d.ts delete mode 100644 packages/gizmo/libs/global.d.ts delete mode 100644 packages/lines/libs/global.d.ts delete mode 100644 packages/outline/libs/global.d.ts delete mode 100644 packages/skeleton-viewer/libs/global.d.ts diff --git a/packages/controls/libs/global.d.ts b/packages/controls/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/controls/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/controls/libs/index.ts b/packages/controls/libs/index.ts index 7ac1be64..830109e4 100644 --- a/packages/controls/libs/index.ts +++ b/packages/controls/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import BoxSelectionSource from "./box-selection/BoxSelection.gsp"; // prettier-ignore diff --git a/packages/controls/package.json b/packages/controls/package.json index 05f96491..06f89641 100644 --- a/packages/controls/package.json +++ b/packages/controls/package.json @@ -17,7 +17,7 @@ "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "main": "dist/commonjs/browser.js", "module": "dist/es/index.js", "files": [ diff --git a/packages/controls/src/global.d.ts b/packages/controls/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/controls/src/global.d.ts +++ b/packages/controls/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/controls/src/index.ts b/packages/controls/src/index.ts index 71d75558..8472dad4 100644 --- a/packages/controls/src/index.ts +++ b/packages/controls/src/index.ts @@ -10,3 +10,5 @@ export { ControlFreePointer } from "./inputDevice/ControlFreePointer"; export { ControlHandlerType } from "./enums/ControlHandlerType"; export type { IControlInput } from "./inputDevice/IControlInput"; + +export * from "../libs"; diff --git a/packages/custom-material/libs/global.d.ts b/packages/custom-material/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/custom-material/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/libs/index.ts index f8d45b9f..3cdc6040 100644 --- a/packages/custom-material/libs/index.ts +++ b/packages/custom-material/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import BakePBRSource from "./bake-pbr/BakePBR.gsp"; import EyeSource from "./advanced-shader/eye/Eye.gsp"; import GridSource from "./grid/Grid.gsp"; diff --git a/packages/custom-material/package.json b/packages/custom-material/package.json index 922a0881..08b5a4c8 100644 --- a/packages/custom-material/package.json +++ b/packages/custom-material/package.json @@ -17,19 +17,19 @@ "url": "https://github.com/galacean/engine-toolkit" }, "bugs": "https://github.com/galacean/engine-toolkit/issues", - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "main": "dist/commonjs/browser.js", "module": "dist/es/index.js", "exports": { ".": { "module": "./dist/es/index.js", "default": "./dist/commonjs/browser.js", - "types": "./types/index.d.ts" + "types": "./types/src/index.d.ts" }, "./sources": { "module": "./dist/es/sources.module.js", "default": "./dist/commonjs/sources.main.js", - "types": "./types/sources.d.ts" + "types": "./types/src/sources.d.ts" } }, "files": [ diff --git a/packages/custom-material/src/global.d.ts b/packages/custom-material/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/custom-material/src/global.d.ts +++ b/packages/custom-material/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/custom-material/src/index.ts b/packages/custom-material/src/index.ts index a3d8110e..d0f3bad1 100644 --- a/packages/custom-material/src/index.ts +++ b/packages/custom-material/src/index.ts @@ -3,3 +3,5 @@ export * from "./grid"; export * from "./water"; export { BakePBRMaterial } from "./bake-pbr/BakePBRMaterial"; export { PlainColorMaterial } from "./plain-color/PlainColorMaterial"; + +export * from "../libs"; diff --git a/packages/framebuffer-picker/libs/global.d.ts b/packages/framebuffer-picker/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/framebuffer-picker/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/libs/index.ts index 6e4803aa..1fb1c677 100644 --- a/packages/framebuffer-picker/libs/index.ts +++ b/packages/framebuffer-picker/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import FramebufferPickerColorSource from "./FramebufferPickerColor.gsp"; // prettier-ignore diff --git a/packages/framebuffer-picker/package.json b/packages/framebuffer-picker/package.json index b8ad7334..5cee9d86 100755 --- a/packages/framebuffer-picker/package.json +++ b/packages/framebuffer-picker/package.json @@ -18,7 +18,7 @@ "b:types": "tsc", "precompile": "shader-compiler-precompile src libs --clean --emit-index" }, - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "files": [ "dist/**/*", "types/**/*" diff --git a/packages/framebuffer-picker/src/global.d.ts b/packages/framebuffer-picker/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/framebuffer-picker/src/global.d.ts +++ b/packages/framebuffer-picker/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/framebuffer-picker/src/index.ts b/packages/framebuffer-picker/src/index.ts index ae50ce5b..cb4dbff6 100644 --- a/packages/framebuffer-picker/src/index.ts +++ b/packages/framebuffer-picker/src/index.ts @@ -1 +1,3 @@ export { FramebufferPicker } from "./FramebufferPicker"; + +export * from "../libs"; diff --git a/packages/geometry-sketch/libs/global.d.ts b/packages/geometry-sketch/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/geometry-sketch/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/libs/index.ts index 8caabcf7..1eb3fe9d 100644 --- a/packages/geometry-sketch/libs/index.ts +++ b/packages/geometry-sketch/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import TBNSource from "./material/TBN.gsp"; import WireframeSource from "./material/Wireframe.gsp"; diff --git a/packages/geometry-sketch/package.json b/packages/geometry-sketch/package.json index 1b9eeb2f..e6e6124f 100644 --- a/packages/geometry-sketch/package.json +++ b/packages/geometry-sketch/package.json @@ -17,7 +17,7 @@ "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "main": "dist/commonjs/browser.js", "module": "dist/es/index.js", "files": [ diff --git a/packages/geometry-sketch/src/global.d.ts b/packages/geometry-sketch/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/geometry-sketch/src/global.d.ts +++ b/packages/geometry-sketch/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/geometry-sketch/src/index.ts b/packages/geometry-sketch/src/index.ts index 6d22632f..45d7c7a1 100644 --- a/packages/geometry-sketch/src/index.ts +++ b/packages/geometry-sketch/src/index.ts @@ -1,3 +1,5 @@ export { SketchMode } from "./SketchMode"; export { SketchRenderer } from "./SketchRenderer"; export { WireframeMaterial, NormalMaterial, TangentMaterial, BiTangentMaterial } from "./material"; + +export * from "../libs"; diff --git a/packages/gizmo/libs/global.d.ts b/packages/gizmo/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/gizmo/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/libs/index.ts index 7c6289af..cc28833f 100644 --- a/packages/gizmo/libs/index.ts +++ b/packages/gizmo/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import IconSource from "./icon/Icon.gsp"; // prettier-ignore diff --git a/packages/gizmo/package.json b/packages/gizmo/package.json index e650b5e6..c6d36817 100644 --- a/packages/gizmo/package.json +++ b/packages/gizmo/package.json @@ -17,7 +17,7 @@ "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "main": "dist/commonjs/browser.js", "module": "dist/es/index.js", "files": [ diff --git a/packages/gizmo/src/global.d.ts b/packages/gizmo/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/gizmo/src/global.d.ts +++ b/packages/gizmo/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/gizmo/src/index.ts b/packages/gizmo/src/index.ts index 93f1a4c9..77ffe89e 100644 --- a/packages/gizmo/src/index.ts +++ b/packages/gizmo/src/index.ts @@ -3,3 +3,5 @@ export { Group } from "./Group"; export { State } from "./enums/GizmoState"; export { AnchorType, CoordinateType } from "./enums/GroupState"; + +export * from "../libs"; diff --git a/packages/lines/libs/global.d.ts b/packages/lines/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/lines/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/lines/libs/index.ts b/packages/lines/libs/index.ts index a2811ee6..96a3ba2a 100644 --- a/packages/lines/libs/index.ts +++ b/packages/lines/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import DashSource from "./line/material/Dash.gsp"; import LineSource from "./line/material/Line.gsp"; diff --git a/packages/lines/package.json b/packages/lines/package.json index 2236b2e0..ca9efe24 100644 --- a/packages/lines/package.json +++ b/packages/lines/package.json @@ -17,7 +17,7 @@ "precompile": "shader-compiler-precompile src libs --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "main": "dist/commonjs/browser.js", "module": "dist/es/index.js", "files": [ diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts index 4814c4df..7416df1b 100644 --- a/packages/lines/src/global.d.ts +++ b/packages/lines/src/global.d.ts @@ -4,3 +4,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/lines/src/index.ts b/packages/lines/src/index.ts index fa07292f..1a85051f 100644 --- a/packages/lines/src/index.ts +++ b/packages/lines/src/index.ts @@ -1,3 +1,5 @@ export * from "./line/constants"; export { DashLine } from "./line/DashLine"; export { Line } from "./line/Line"; + +export * from "../libs"; diff --git a/packages/outline/libs/global.d.ts b/packages/outline/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/outline/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/outline/libs/index.ts b/packages/outline/libs/index.ts index a12ba73f..f8ace5a8 100644 --- a/packages/outline/libs/index.ts +++ b/packages/outline/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import OutlinePostprocessSource from "./OutlinePostprocess.gsp"; import OutlineReplaceSource from "./OutlineReplace.gsp"; diff --git a/packages/outline/package.json b/packages/outline/package.json index a8efaa85..2f8491e9 100755 --- a/packages/outline/package.json +++ b/packages/outline/package.json @@ -18,7 +18,7 @@ "b:types": "tsc", "precompile": "shader-compiler-precompile src libs --clean --emit-index" }, - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "files": [ "dist/**/*", "types/**/*" diff --git a/packages/outline/src/global.d.ts b/packages/outline/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/outline/src/global.d.ts +++ b/packages/outline/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/outline/src/index.ts b/packages/outline/src/index.ts index f4f1c632..94d5afbb 100644 --- a/packages/outline/src/index.ts +++ b/packages/outline/src/index.ts @@ -1 +1,3 @@ export { OutlineManager } from "./OutlineManager"; + +export * from "../libs"; diff --git a/packages/skeleton-viewer/libs/global.d.ts b/packages/skeleton-viewer/libs/global.d.ts deleted file mode 100644 index ef45587d..00000000 --- a/packages/skeleton-viewer/libs/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.gsp" { - const value: object; - export default value; -} diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/libs/index.ts index 12106780..334ae949 100644 --- a/packages/skeleton-viewer/libs/index.ts +++ b/packages/skeleton-viewer/libs/index.ts @@ -1,5 +1,4 @@ // Auto-generated by shader-precompile --emit-index — do not edit -/// import SkeletonViewerSource from "./SkeletonViewer.gsp"; // prettier-ignore diff --git a/packages/skeleton-viewer/package.json b/packages/skeleton-viewer/package.json index 2d65606d..3f82cc09 100755 --- a/packages/skeleton-viewer/package.json +++ b/packages/skeleton-viewer/package.json @@ -16,7 +16,7 @@ "url": "https://github.com/galacean/engine-toolkit" }, "bugs": "https://github.com/galacean/engine-toolkit/issues", - "types": "types/index.d.ts", + "types": "types/src/index.d.ts", "module": "dist/es/index.js", "main": "dist/commonjs/browser.js", "files": [ diff --git a/packages/skeleton-viewer/src/global.d.ts b/packages/skeleton-viewer/src/global.d.ts index 8d32d621..048f4523 100644 --- a/packages/skeleton-viewer/src/global.d.ts +++ b/packages/skeleton-viewer/src/global.d.ts @@ -2,3 +2,8 @@ declare module "*.shader" { const value: string; export default value; } + +declare module "*.gsp" { + const value: object; + export default value; +} diff --git a/packages/skeleton-viewer/src/index.ts b/packages/skeleton-viewer/src/index.ts index b285282e..0efe9c23 100644 --- a/packages/skeleton-viewer/src/index.ts +++ b/packages/skeleton-viewer/src/index.ts @@ -1 +1,3 @@ export { SkeletonViewer } from "./SkeletonViewer"; + +export * from "../libs"; From 7e94338a1b7b538c569386eff46fa6f21835e707 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Fri, 8 May 2026 18:43:16 +0800 Subject: [PATCH 15/27] refactor: align with engine ShaderLab migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapt to three breaking changes from the engine ShaderLab refactor: 1. `.gsp` → `.shaderc` artifact rename (engine b7db30b78). Delete the stale `.gsp` outputs; `*.shaderc` ambient declarations replace `*.gsp` in each package's `src/global.d.ts`; rollup.config.mjs comment updated. The `libs/index.ts` files re-emitted by the new CLI now import `.shaderc`. 2. `ShaderLibrary/` namespace for engine library #includes (engine moved chunks under `ShaderLibrary/`). Rewrite `#include "Common/..."` etc. to `#include "ShaderLibrary/Common/..."` across 19 .shader and .glsl files (70 sites total). 3. Drop `material.renderState` wiring (engine d21484b62). Render state now flows through ShaderLab DSL + shaderData: - PlainColor.shader exposes blend / depth / render-queue / cull variables; PlainColorMaterial sets `depthEnabled = 1` by default. gizmo Utils opts out via `shaderData.setInt("depthEnabled", 0)` and drops the redundant CullMode.Off overrides (already DSL constant). - SkeletonViewer.shader uses DSL constants for `Enabled = false` (depth) and `RenderQueueType = Transparent`; SkeletonViewer.ts no longer touches renderState. Switches the rollup config to import from `@galacean/engine-shader-compiler/bundler/rollup` (engine subpath re-shape). --- ...{BoxSelection.gsp => BoxSelection.shaderc} | 0 packages/controls/libs/index.ts | 4 +- .../src/box-selection/BoxSelection.shader | 6 +-- packages/controls/src/global.d.ts | 2 +- .../libs/advanced-shader/eye/Eye.gsp | 1 - .../libs/advanced-shader/eye/Eye.shaderc | 1 + .../libs/advanced-shader/hair/Hair.gsp | 1 - .../libs/advanced-shader/hair/Hair.shaderc | 1 + .../libs/advanced-shader/sss/SSS.gsp | 1 - .../libs/advanced-shader/sss/SSS.shaderc | 1 + .../custom-material/libs/bake-pbr/BakePBR.gsp | 1 - .../libs/bake-pbr/BakePBR.shaderc | 1 + .../libs/grid/{Grid.gsp => Grid.shaderc} | 0 packages/custom-material/libs/index.ts | 24 ++++++------ .../libs/plain-color/PlainColor.gsp | 1 - .../libs/plain-color/PlainColor.shaderc | 1 + ...{PlanarShadow.gsp => PlanarShadow.shaderc} | 0 ...hadowOnly.gsp => PlanarShadowOnly.shaderc} | 0 .../libs/water/{Water.gsp => Water.shaderc} | 0 .../{WaterFall.gsp => WaterFall.shaderc} | 0 .../{WaterRipple.gsp => WaterRipple.shaderc} | 0 .../advanced-shader/eye/EyeForwardPass.glsl | 16 ++++---- .../advanced-shader/hair/HairForwardPass.glsl | 14 +++---- .../advanced-shader/hair/HairLightDirect.glsl | 4 +- .../advanced-shader/sss/SSSForwardPass.glsl | 14 +++---- .../advanced-shader/sss/SSSLightDirect.glsl | 6 +-- .../src/bake-pbr/BakePBR.shader | 2 +- packages/custom-material/src/global.d.ts | 2 +- packages/custom-material/src/grid/Grid.shader | 4 +- .../src/plain-color/PlainColor.shader | 38 ++++++++++++++++--- .../src/plain-color/PlainColorMaterial.ts | 5 ++- .../custom-material/src/water/Water.shader | 4 +- .../src/water/WaterFall.shader | 4 +- .../src/water/WaterRipple.shader | 4 +- ...lor.gsp => FramebufferPickerColor.shaderc} | 0 packages/framebuffer-picker/libs/index.ts | 4 +- .../src/FramebufferPickerColor.shader | 10 ++--- packages/framebuffer-picker/src/global.d.ts | 2 +- packages/geometry-sketch/libs/index.ts | 6 +-- .../libs/material/{TBN.gsp => TBN.shaderc} | 0 .../{Wireframe.gsp => Wireframe.shaderc} | 0 packages/geometry-sketch/src/global.d.ts | 2 +- .../geometry-sketch/src/material/TBN.shader | 8 ++-- .../src/material/Wireframe.shader | 8 ++-- .../libs/icon/{Icon.gsp => Icon.shaderc} | 0 packages/gizmo/libs/index.ts | 4 +- packages/gizmo/src/Utils.ts | 6 +-- packages/gizmo/src/global.d.ts | 2 +- packages/gizmo/src/icon/Icon.shader | 10 ++--- packages/lines/libs/index.ts | 6 +-- .../line/material/{Dash.gsp => Dash.shaderc} | 0 .../line/material/{Line.gsp => Line.shaderc} | 0 packages/lines/src/global.d.ts | 2 +- ...process.gsp => OutlinePostprocess.shaderc} | 0 ...lineReplace.gsp => OutlineReplace.shaderc} | 0 packages/outline/libs/index.ts | 6 +-- .../outline/src/OutlinePostprocess.shader | 4 +- packages/outline/src/OutlineReplace.shader | 10 ++--- packages/outline/src/global.d.ts | 2 +- .../skeleton-viewer/libs/SkeletonViewer.gsp | 1 - .../libs/SkeletonViewer.shaderc | 1 + packages/skeleton-viewer/libs/index.ts | 4 +- .../skeleton-viewer/src/SkeletonViewer.shader | 8 +++- .../skeleton-viewer/src/SkeletonViewer.ts | 3 -- packages/skeleton-viewer/src/global.d.ts | 2 +- rollup.config.mjs | 6 +-- 66 files changed, 155 insertions(+), 125 deletions(-) rename packages/controls/libs/box-selection/{BoxSelection.gsp => BoxSelection.shaderc} (100%) delete mode 100644 packages/custom-material/libs/advanced-shader/eye/Eye.gsp create mode 100644 packages/custom-material/libs/advanced-shader/eye/Eye.shaderc delete mode 100644 packages/custom-material/libs/advanced-shader/hair/Hair.gsp create mode 100644 packages/custom-material/libs/advanced-shader/hair/Hair.shaderc delete mode 100644 packages/custom-material/libs/advanced-shader/sss/SSS.gsp create mode 100644 packages/custom-material/libs/advanced-shader/sss/SSS.shaderc delete mode 100644 packages/custom-material/libs/bake-pbr/BakePBR.gsp create mode 100644 packages/custom-material/libs/bake-pbr/BakePBR.shaderc rename packages/custom-material/libs/grid/{Grid.gsp => Grid.shaderc} (100%) delete mode 100644 packages/custom-material/libs/plain-color/PlainColor.gsp create mode 100644 packages/custom-material/libs/plain-color/PlainColor.shaderc rename packages/custom-material/libs/planar-shadow/{PlanarShadow.gsp => PlanarShadow.shaderc} (100%) rename packages/custom-material/libs/planar-shadow/{PlanarShadowOnly.gsp => PlanarShadowOnly.shaderc} (100%) rename packages/custom-material/libs/water/{Water.gsp => Water.shaderc} (100%) rename packages/custom-material/libs/water/{WaterFall.gsp => WaterFall.shaderc} (100%) rename packages/custom-material/libs/water/{WaterRipple.gsp => WaterRipple.shaderc} (100%) rename packages/framebuffer-picker/libs/{FramebufferPickerColor.gsp => FramebufferPickerColor.shaderc} (100%) rename packages/geometry-sketch/libs/material/{TBN.gsp => TBN.shaderc} (100%) rename packages/geometry-sketch/libs/material/{Wireframe.gsp => Wireframe.shaderc} (100%) rename packages/gizmo/libs/icon/{Icon.gsp => Icon.shaderc} (100%) rename packages/lines/libs/line/material/{Dash.gsp => Dash.shaderc} (100%) rename packages/lines/libs/line/material/{Line.gsp => Line.shaderc} (100%) rename packages/outline/libs/{OutlinePostprocess.gsp => OutlinePostprocess.shaderc} (100%) rename packages/outline/libs/{OutlineReplace.gsp => OutlineReplace.shaderc} (100%) delete mode 100644 packages/skeleton-viewer/libs/SkeletonViewer.gsp create mode 100644 packages/skeleton-viewer/libs/SkeletonViewer.shaderc diff --git a/packages/controls/libs/box-selection/BoxSelection.gsp b/packages/controls/libs/box-selection/BoxSelection.shaderc similarity index 100% rename from packages/controls/libs/box-selection/BoxSelection.gsp rename to packages/controls/libs/box-selection/BoxSelection.shaderc diff --git a/packages/controls/libs/index.ts b/packages/controls/libs/index.ts index 830109e4..c23c5ca7 100644 --- a/packages/controls/libs/index.ts +++ b/packages/controls/libs/index.ts @@ -1,5 +1,5 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import BoxSelectionSource from "./box-selection/BoxSelection.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import BoxSelectionSource from "./box-selection/BoxSelection.shaderc"; // prettier-ignore export { diff --git a/packages/controls/src/box-selection/BoxSelection.shader b/packages/controls/src/box-selection/BoxSelection.shader index 833ae554..0de67295 100644 --- a/packages/controls/src/box-selection/BoxSelection.shader +++ b/packages/controls/src/box-selection/BoxSelection.shader @@ -4,10 +4,10 @@ Shader "box" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" void vert(Attributes attr) { gl_Position = vec4(attr.POSITION, 1.0); diff --git a/packages/controls/src/global.d.ts b/packages/controls/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/controls/src/global.d.ts +++ b/packages/controls/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/custom-material/libs/advanced-shader/eye/Eye.gsp b/packages/custom-material/libs/advanced-shader/eye/Eye.gsp deleted file mode 100644 index 95a85c6a..00000000 --- a/packages/custom-material/libs/advanced-shader/eye/Eye.gsp +++ /dev/null @@ -1 +0,0 @@ -{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",540],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",288],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",144],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",150],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",156],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",162],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",168],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",226],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",182],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",180],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},192],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",196],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",200],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",204],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",208],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",212],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",216],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",220],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",224],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",268],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",242],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",240],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",250],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",248],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",258],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",256],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",266],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",274],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",286],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",324],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",298],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",304],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",310],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",316],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",322],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",386],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,332],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",340],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",338],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",348],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",346],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",360],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",358],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",356],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",372],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},370],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",368],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},380],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",378],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,384],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",494],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",396],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",400],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",420],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",410],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",414],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",418],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",428],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",426],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",440],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",434],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",438],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",452],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",446],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",450],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",468],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",458],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",466],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",464],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",476],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",480],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",484],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",488],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",492],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",498],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",506],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",510],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",514],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",518],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",522],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,526],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",534],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",532],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},538],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",647],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",274],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",106],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",112],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",118],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",124],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",130],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",212],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",144],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",142],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},154],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",162],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",170],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",186],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",190],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",194],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",198],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",202],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",206],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",210],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",254],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",220],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",228],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",226],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",236],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",244],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",248],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",252],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",260],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",272],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",310],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",284],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",290],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",296],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",302],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",308],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",316],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",567],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",332],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",328],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,330],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",336],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",340],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",356],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",346],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",350],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",354],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",364],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",362],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",376],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",370],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",374],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",388],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",382],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",386],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",404],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",394],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",402],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",400],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",408],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",412],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",416],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",420],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",424],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",428],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",432],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",436],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",440],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",444],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",448],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",452],[0," surfaceData.opacity = baseColor.a ; \n"],[5,454],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",458],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,460],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",464],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,469],[1,"HAS_DERIVATIVES",467],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,469],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",483],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},475],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,477],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",481],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",487],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",491],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",509],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",497],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,499],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",503],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",507],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",517],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",515],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",531],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",523],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,525],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",529],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",543],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",537],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",541],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",559],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",549],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",557],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",555],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",563],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,565],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",571],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",575],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",579],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",583],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",587],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",591],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,593],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",597],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,599],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",603],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",607],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,609],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",613],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,615],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",619],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,621],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},625],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",629],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,631],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},641],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,637],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,639],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,645],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/eye/Eye.shaderc b/packages/custom-material/libs/advanced-shader/eye/Eye.shaderc new file mode 100644 index 00000000..2ba2857c --- /dev/null +++ b/packages/custom-material/libs/advanced-shader/eye/Eye.shaderc @@ -0,0 +1 @@ +{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",534],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",282],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",144],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",150],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",156],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",162],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",168],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",220],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",182],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",180],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",190],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",194],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",198],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",202],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",206],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",210],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",214],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",218],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",262],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",228],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",236],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",244],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",252],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",250],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",256],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",260],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",268],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",280],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",318],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",292],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",298],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",304],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",310],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",316],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",380],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,326],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",334],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",332],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",342],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",340],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",354],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",352],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",350],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",366],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},364],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",362],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},374],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",372],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,378],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",488],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",390],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",394],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",398],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",414],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",408],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",412],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",422],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",420],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",434],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",428],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",446],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",440],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",444],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",462],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",452],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",460],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",458],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",470],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",486],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",492],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",496],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",500],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",504],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",508],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",512],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",516],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,520],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",528],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",526],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},532],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",641],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",268],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",106],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",112],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",118],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",124],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",130],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",206],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",144],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",142],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",152],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",156],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",160],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",164],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",168],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",172],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",176],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",192],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",196],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",200],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",204],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",248],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",214],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",222],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",220],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",230],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",228],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",238],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",236],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",242],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",246],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",254],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",258],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",266],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",304],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",278],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",284],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",290],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",296],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",302],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",310],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",561],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",326],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",322],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,324],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",330],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",334],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",350],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",340],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",344],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",348],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",358],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",356],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",370],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",364],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",368],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",382],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",376],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",380],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",398],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",388],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",396],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",394],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",402],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",406],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",410],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",414],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",418],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",422],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",426],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",430],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",434],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",438],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",442],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",446],[0," surfaceData.opacity = baseColor.a ; \n"],[5,448],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",452],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,454],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",458],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,463],[1,"HAS_DERIVATIVES",461],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,463],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",477],[0," \n"],[1,"NEED_VERTEX_TANGENT",469],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,471],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",475],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",481],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",485],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",503],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",491],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,493],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",497],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",501],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",511],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",509],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",525],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",517],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,519],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",523],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",537],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",531],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",535],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",553],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",543],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",551],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",549],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",557],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,559],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",565],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",569],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",573],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",577],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",581],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",585],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,587],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",591],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,593],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",597],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",601],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,603],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",607],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,609],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",613],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,615],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},619],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",623],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,625],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},635],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,631],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,633],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,639],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/hair/Hair.gsp b/packages/custom-material/libs/advanced-shader/hair/Hair.gsp deleted file mode 100644 index ae94ef91..00000000 --- a/packages/custom-material/libs/advanced-shader/hair/Hair.gsp +++ /dev/null @@ -1 +0,0 @@ -{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",588],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",194],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},160],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",172],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",176],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",192],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",198],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",352],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",208],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",214],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",220],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",226],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",232],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",290],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",246],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",244],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},256],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",260],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",280],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",284],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",288],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",332],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",298],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",306],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",304],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",314],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",312],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",322],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",320],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",326],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",330],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",338],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",342],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",346],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",350],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",388],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",362],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",368],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",374],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",380],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",386],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",454],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,396],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",404],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",402],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",408],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",416],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",414],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",428],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",426],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",424],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",440],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},438],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",436],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},448],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",446],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,452],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",562],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",464],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",468],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",488],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",486],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",496],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",494],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",508],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",506],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",520],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",514],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",518],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",536],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",526],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",534],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",540],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",544],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",548],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",552],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",556],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",560],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",566],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",570],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,574],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",582],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",580],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},586],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",675],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",180],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},122],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",126],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",130],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",134],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",138],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",142],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",146],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",150],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",154],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",178],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",184],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",362],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",194],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",200],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",206],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",212],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",218],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",300],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",232],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",230],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},242],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",246],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",250],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",254],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",258],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",262],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",266],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",270],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",290],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",294],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",298],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",342],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",316],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",314],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",324],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",322],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",332],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",330],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",336],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",340],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",348],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",352],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",356],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",360],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",398],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",372],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",378],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",384],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",390],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",396],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",404],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",655],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",420],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",416],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,418],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",424],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",428],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",444],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",434],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",438],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",442],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",452],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",450],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",464],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",458],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",462],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",476],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",470],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",474],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",492],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",482],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",490],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",488],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",496],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",500],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",504],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",508],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",512],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",516],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",520],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",524],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",528],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",532],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",536],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",540],[0," surfaceData.opacity = baseColor.a ; \n"],[5,542],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",546],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,548],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",552],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,557],[1,"HAS_DERIVATIVES",555],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,557],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",571],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},563],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,565],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",569],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",575],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",579],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",597],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",585],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,587],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",591],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",595],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",605],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",603],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",619],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",611],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,613],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",617],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",631],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",625],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",629],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",647],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",637],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",645],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",643],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",651],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,653],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},659],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},669],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,665],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,667],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,673],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/hair/Hair.shaderc b/packages/custom-material/libs/advanced-shader/hair/Hair.shaderc new file mode 100644 index 00000000..e92093af --- /dev/null +++ b/packages/custom-material/libs/advanced-shader/hair/Hair.shaderc @@ -0,0 +1 @@ +{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",576],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",188],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",186],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",192],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",340],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",202],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",208],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",214],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",220],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",226],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",278],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",240],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",238],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",248],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",252],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",256],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",260],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",276],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",320],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",294],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",292],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",302],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",300],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",310],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",314],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",326],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",330],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",334],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",338],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",376],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",350],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",356],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",362],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",368],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",374],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",442],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,384],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",392],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",390],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",396],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",404],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",402],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",416],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",414],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",412],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",428],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},426],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",424],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},436],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",434],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,440],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",550],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",452],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",456],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",460],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",476],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",470],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",484],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",496],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",490],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",494],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",508],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",506],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",524],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",514],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",522],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",528],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",536],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",540],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",544],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",548],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",554],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",558],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,562],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",570],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",568],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},574],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",663],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",174],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",120],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",124],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",128],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",132],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",136],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",140],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",144],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",148],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",152],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",156],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",160],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",172],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",178],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",350],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",188],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",194],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",200],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",206],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",212],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",288],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",226],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",224],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",234],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",238],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",242],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",246],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",250],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",254],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",258],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",286],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",330],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",296],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",304],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",302],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",312],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",310],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",320],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",324],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",328],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",336],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",340],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",344],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",348],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",386],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",360],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",366],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",372],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",378],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",384],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",392],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",643],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",408],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",404],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,406],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",412],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",416],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",432],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",422],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",426],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",430],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",440],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",438],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",452],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",446],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",450],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",464],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",458],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",462],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",480],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",470],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",478],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",476],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",484],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",488],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",492],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",496],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",500],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",504],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",508],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",512],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",516],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",520],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",524],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",528],[0," surfaceData.opacity = baseColor.a ; \n"],[5,530],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",534],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,536],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",540],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,545],[1,"HAS_DERIVATIVES",543],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,545],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",559],[0," \n"],[1,"NEED_VERTEX_TANGENT",551],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,553],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",557],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",563],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",567],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",585],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",573],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,575],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",579],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",583],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",593],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",591],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",607],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",599],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,601],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",605],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",619],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",613],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",617],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",635],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",625],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",633],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",631],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",639],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,641],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},647],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},657],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,653],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,655],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,661],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/sss/SSS.gsp b/packages/custom-material/libs/advanced-shader/sss/SSS.gsp deleted file mode 100644 index 086d48ce..00000000 --- a/packages/custom-material/libs/advanced-shader/sss/SSS.gsp +++ /dev/null @@ -1 +0,0 @@ -{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",594],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",194],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},160],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",172],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",176],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",192],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",200],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",204],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",358],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",214],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",220],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",226],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",232],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",238],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",296],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",252],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",250],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},262],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",290],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",294],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",338],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",304],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",312],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",310],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",320],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",328],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",326],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",332],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",336],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",344],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",348],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",352],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",356],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",394],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",368],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",374],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",380],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",386],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",392],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",460],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,402],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",410],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",408],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",414],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",422],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",420],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",434],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",432],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",430],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",446],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},444],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",442],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},454],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",452],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,458],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",568],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",470],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",494],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",484],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",488],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",492],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",502],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",500],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",514],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",508],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",512],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",526],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",524],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",542],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",540],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",538],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",546],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",550],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",554],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",558],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",562],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",566],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",572],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",576],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,580],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",588],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",586],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},592],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",681],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",180],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},122],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",126],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",130],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",134],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",138],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",142],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",146],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",150],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",154],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",178],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",186],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",190],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",368],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",200],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",206],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",212],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",218],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",224],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",306],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",238],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",236],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},248],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",252],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",256],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",260],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",264],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",268],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",272],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",276],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",280],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",284],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",288],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",292],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",296],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",300],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",304],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",348],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",314],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",322],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",320],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",330],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",328],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",338],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",336],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",342],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",346],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",354],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",358],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",362],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",366],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",404],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",378],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",384],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",390],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",396],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",402],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",410],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",661],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",426],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",422],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,424],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",430],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",434],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",450],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",440],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",444],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",448],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",458],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",456],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",470],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",464],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",468],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",482],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",476],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",480],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",498],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",488],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",496],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",494],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",502],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",506],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",510],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",514],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",518],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",522],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",526],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",530],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",534],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",538],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",542],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",546],[0," surfaceData.opacity = baseColor.a ; \n"],[5,548],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",552],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,554],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",558],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,563],[1,"HAS_DERIVATIVES",561],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,563],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",577],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},569],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,571],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",575],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",581],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",585],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",603],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",591],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,593],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",597],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",601],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",611],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",609],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",625],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",617],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,619],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",623],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",637],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",631],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",635],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",653],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",643],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",651],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",649],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",657],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,659],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},665],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},675],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,671],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,673],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,679],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/advanced-shader/sss/SSS.shaderc b/packages/custom-material/libs/advanced-shader/sss/SSS.shaderc new file mode 100644 index 00000000..402d9ec8 --- /dev/null +++ b/packages/custom-material/libs/advanced-shader/sss/SSS.shaderc @@ -0,0 +1 @@ +{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",582],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",188],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",186],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",194],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",198],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",346],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",208],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",214],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",220],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",226],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",232],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",284],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",246],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",244],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",254],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",258],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",282],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",326],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",292],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",300],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",298],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",308],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",306],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",316],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",314],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",320],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",324],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",332],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",336],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",340],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",344],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",382],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",356],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",362],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",368],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",374],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",380],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",448],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,390],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",398],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",396],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",402],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",410],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",408],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",422],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",420],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",418],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",434],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},432],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",430],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},442],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",440],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,446],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",556],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",458],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",462],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",482],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",476],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",480],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",490],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",488],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",502],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",496],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",500],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",514],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",508],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",512],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",530],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",528],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",526],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",534],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",538],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",542],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",546],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",550],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",554],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",560],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",564],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,568],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",576],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",574],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},580],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",669],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",174],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",120],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",124],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",128],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",132],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",136],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",140],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",144],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",148],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",152],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",156],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",160],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",172],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",180],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",184],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",356],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",194],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",200],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",206],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",212],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",218],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",294],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",232],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",230],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",240],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",244],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",248],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",252],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",256],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",260],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",264],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",280],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",284],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",288],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",292],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",336],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",302],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",310],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",318],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",316],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",326],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",324],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",330],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",334],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",342],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",346],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",350],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",354],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",392],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",366],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",372],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",378],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",384],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",390],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",398],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",649],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",414],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",410],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,412],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",418],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",422],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",438],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",428],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",432],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",436],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",446],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",444],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",458],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",452],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",456],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",470],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",464],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",468],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",486],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",476],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",484],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",482],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",490],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",494],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",498],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",502],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",506],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",510],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",514],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",518],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",522],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",526],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",530],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",534],[0," surfaceData.opacity = baseColor.a ; \n"],[5,536],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",540],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,542],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",546],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,551],[1,"HAS_DERIVATIVES",549],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,551],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",565],[0," \n"],[1,"NEED_VERTEX_TANGENT",557],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,559],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",563],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",569],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",573],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",591],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",579],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,581],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",585],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",589],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",599],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",597],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",613],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",605],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,607],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",611],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",625],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",619],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",623],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",641],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",631],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",639],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",637],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",645],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,647],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},653],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},663],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,659],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,661],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,667],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/bake-pbr/BakePBR.gsp b/packages/custom-material/libs/bake-pbr/BakePBR.gsp deleted file mode 100644 index a765bcdc..00000000 --- a/packages/custom-material/libs/bake-pbr/BakePBR.gsp +++ /dev/null @@ -1 +0,0 @@ -{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",708],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",34],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,32],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",44],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,42],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",50],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",108],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",82],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",80],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},62],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,78],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",68],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",72],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,76],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",86],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",90],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",94],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",98],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",102],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",106],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",130],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",128],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",118],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,120],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",124],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,126],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",208],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",206],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",140],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,154],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},144],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,152],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,150],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",162],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",160],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",174],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},168],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},172],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,204],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},186],[0," \n"],[1,"RENDERER_HAS_NORMAL",180],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",184],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,202],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,200],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",288],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},218],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",246],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,224],[0," mediump int cascadeIndex = 0 ; \n"],[5,226],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",230],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,244],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,234],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,238],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,242],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",286],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",256],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,270],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",262],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,266],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,274],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,284],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",282],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",318],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",296],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",300],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,304],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",312],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",310],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},316],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",472],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",328],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",334],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",340],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",346],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",352],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",410],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",366],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",364],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},376],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",380],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",384],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",388],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",392],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",396],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",400],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",408],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",452],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",418],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",426],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",434],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",442],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",440],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",446],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",450],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",458],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",462],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",470],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",508],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",482],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",488],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",494],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",500],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",506],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",574],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,516],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",524],[0," vec3 normalWS ; \n"],[1,"RENDERER_HAS_TANGENT",522],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",528],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",536],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",534],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",548],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",546],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",544],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",560],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},558],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"RENDERER_HAS_TANGENT",556],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},568],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",566],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,572],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",682],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",584],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",588],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",592],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",608],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",602],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",606],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",616],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",614],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",628],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",622],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",626],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",640],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",634],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",638],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",656],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",646],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",654],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",660],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",664],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",668],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",672],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",676],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",680],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",686],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",690],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,694],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",702],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",700],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},706],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",712],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",868],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",38],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",26],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",32],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,36],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",58],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,56],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,48],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",2,51],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,54],[3,"SCENE_FOG_MODE","==",3,54],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",64],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",70],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",86],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",84],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",80],[0,"\n\n"],[5,82],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",114],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",112],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",96],[0,"\n\n"],[5,110],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0,"\n\n"],[5,108],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},104],[0,"\n\n"],[5,106],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",206],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},124],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",152],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,130],[0," mediump int cascadeIndex = 0 ; \n"],[5,132],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",136],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,150],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,140],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,144],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,148],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",204],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",162],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,176],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",168],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,172],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,180],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,190],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",188],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,194],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,198],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",236],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",214],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",218],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,222],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",230],[0,"varying vec3 normalWS;\n\n"],[1,"RENDERER_HAS_TANGENT",228],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},234],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",533],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",246],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",252],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",258],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",264],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",270],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",423],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",284],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"or","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"}},294],[0,"\n\n"],[7,"NEED_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",298],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT",302],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",306],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",310],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",314],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",318],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",322],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",326],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",330],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",334],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",338],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,340],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",344],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",348],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",352],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",356],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",360],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,362],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",366],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",376],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",372],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,374],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",391],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,382],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,385],[3,"REFRACTION_MODE","==",1,385],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",389],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",401],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",397],[0," return 1.0 ; \n"],[5,399],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",405],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",409],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",413],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",417],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",421],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",471],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",431],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",435],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,437],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",445],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",443],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",453],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",451],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",461],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",459],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",465],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",469],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",485],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",479],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",483],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",489],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",493],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",497],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",511],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",503],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,505],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",509],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",521],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",517],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,519],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",531],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",527],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,529],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",609],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",543],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",549],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",555],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",561],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",593],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",569],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,571],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",575],[0," return vec3 ( 0 ) ; \n"],[5,587],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",579],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,581],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",585],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},591],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",597],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,599],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",603],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",607],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",615],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",866],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",631],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",627],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,629],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",635],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",639],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",655],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",645],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",649],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",653],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",663],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",661],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",675],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",669],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",673],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",687],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",681],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",685],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",703],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",693],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",701],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",699],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",707],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",711],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",715],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",719],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",723],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",727],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",731],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",735],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",739],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",743],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",747],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",751],[0," surfaceData.opacity = baseColor.a ; \n"],[5,753],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",757],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,759],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",763],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,768],[1,"HAS_DERIVATIVES",766],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,768],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT",782],[0," \n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},774],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,776],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",780],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",786],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",790],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",808],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",796],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,798],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",802],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",806],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",816],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",814],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",830],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",822],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,824],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",828],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",842],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",836],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",840],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",858],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",848],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",856],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",854],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",862],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,864],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",872],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},876],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},886],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,882],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,884],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",894],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",892],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",898],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,902],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/bake-pbr/BakePBR.shaderc b/packages/custom-material/libs/bake-pbr/BakePBR.shaderc new file mode 100644 index 00000000..9f1b0261 --- /dev/null +++ b/packages/custom-material/libs/bake-pbr/BakePBR.shaderc @@ -0,0 +1 @@ +{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",714],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}}},10],[0,"\n\n"],[7,"NEED_VERTEX_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},16],[0,"\n\n"],[7,"NEED_TANGENT_SPACE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"COMMON_INCLUDED",46],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",40],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,44],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",56],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,54],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",62],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",120],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",94],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",92],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,90],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},86],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",80],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",84],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,88],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",98],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",102],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",106],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",110],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",114],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",118],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",142],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",140],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",130],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,132],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",136],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,138],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",220],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",218],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",152],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,166],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},156],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,164],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,162],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",174],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",172],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",186],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},180],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},184],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,216],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," \n"],[1,"RENDERER_HAS_NORMAL",192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,214],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},210],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},204],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},208],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,212],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",300],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},230],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",258],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,236],[0," mediump int cascadeIndex = 0 ; \n"],[5,238],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,256],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,246],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,250],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,254],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",298],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",268],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,282],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",274],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,278],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,286],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,296],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",294],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",330],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",308],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",312],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,316],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",324],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",322],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},328],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",478],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",340],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",346],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",352],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",358],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",364],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",416],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",378],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",376],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",386],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",390],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",394],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",398],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",402],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",406],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",410],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",414],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",458],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",432],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",430],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",440],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",438],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",448],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",446],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",452],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",456],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",464],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",468],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",476],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",514],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",488],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",494],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",500],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",506],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",512],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",580],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,522],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",530],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",528],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",534],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",542],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",540],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",554],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",552],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",550],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",566],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},564],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",562],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},574],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",572],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,578],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",688],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",590],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",594],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",614],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",604],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",608],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",612],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",622],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",620],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",634],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",628],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",632],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",646],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",640],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",644],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",662],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",660],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",658],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",666],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",670],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",674],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",678],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",682],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",686],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",692],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",696],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,700],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",708],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"NEED_VERTEX_TANGENT",706],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},712],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",718],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",874],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}}},10],[0,"\n\n"],[7,"NEED_VERTEX_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},16],[0,"\n\n"],[7,"NEED_TANGENT_SPACE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"COMMON_INCLUDED",50],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",38],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",44],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,48],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",70],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,68],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,60],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,66],[3,"SCENE_FOG_MODE","==",2,63],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,66],[3,"SCENE_FOG_MODE","==",3,66],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",76],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",82],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",98],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",96],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",92],[0,"\n\n"],[5,94],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",126],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",124],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",108],[0,"\n\n"],[5,122],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},112],[0,"\n\n"],[5,120],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},116],[0,"\n\n"],[5,118],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",218],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},136],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",164],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,142],[0," mediump int cascadeIndex = 0 ; \n"],[5,144],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",148],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,162],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,152],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,156],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,160],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",216],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",174],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,188],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",180],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,184],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,192],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",200],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,206],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,210],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,214],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",248],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",226],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",230],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,234],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",242],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",240],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},246],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",539],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",258],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",264],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",270],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",276],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",282],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",429],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",296],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",294],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",304],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",308],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",312],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",316],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",320],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",324],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",328],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",332],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",336],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",340],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",344],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,346],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",350],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",354],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",358],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",362],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",366],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,368],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",372],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",382],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",378],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,380],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",397],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,388],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,391],[3,"REFRACTION_MODE","==",1,391],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",395],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",407],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",403],[0," return 1.0 ; \n"],[5,405],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",411],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",415],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",419],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",423],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",427],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",477],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",437],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",441],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,443],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",451],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",449],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",459],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",457],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",467],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",465],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",471],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",475],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",491],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",485],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",489],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",495],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",499],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",503],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",517],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",509],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,511],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",515],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",527],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",523],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,525],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",537],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",533],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,535],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",615],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",549],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",555],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",561],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",567],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",599],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",575],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,577],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",581],[0," return vec3 ( 0 ) ; \n"],[5,593],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",585],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,587],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",591],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},597],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",603],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,605],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",609],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",613],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",621],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",872],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",637],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",633],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,635],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",641],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",645],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",661],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",651],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",655],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",659],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",669],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",667],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",681],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",675],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",679],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",693],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",687],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",691],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",709],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",699],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",707],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",705],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",713],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",717],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",721],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",725],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",729],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",733],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",737],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",741],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",745],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",749],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",753],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",757],[0," surfaceData.opacity = baseColor.a ; \n"],[5,759],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",763],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,765],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",769],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,774],[1,"HAS_DERIVATIVES",772],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,774],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",788],[0," \n"],[1,"NEED_VERTEX_TANGENT",780],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,782],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",786],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",792],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",796],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",814],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",802],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,804],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",808],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",812],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",822],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",820],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",836],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",828],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,830],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",834],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",848],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",842],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",846],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",864],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",854],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",862],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",860],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",868],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,870],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",878],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},882],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},892],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,888],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,890],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",900],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",898],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",904],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,908],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/grid/Grid.gsp b/packages/custom-material/libs/grid/Grid.shaderc similarity index 100% rename from packages/custom-material/libs/grid/Grid.gsp rename to packages/custom-material/libs/grid/Grid.shaderc diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/libs/index.ts index 3cdc6040..055bd99e 100644 --- a/packages/custom-material/libs/index.ts +++ b/packages/custom-material/libs/index.ts @@ -1,15 +1,15 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import BakePBRSource from "./bake-pbr/BakePBR.gsp"; -import EyeSource from "./advanced-shader/eye/Eye.gsp"; -import GridSource from "./grid/Grid.gsp"; -import HairSource from "./advanced-shader/hair/Hair.gsp"; -import PlainColorSource from "./plain-color/PlainColor.gsp"; -import PlanarShadowOnlySource from "./planar-shadow/PlanarShadowOnly.gsp"; -import PlanarShadowSource from "./planar-shadow/PlanarShadow.gsp"; -import SSSSource from "./advanced-shader/sss/SSS.gsp"; -import WaterFallSource from "./water/WaterFall.gsp"; -import WaterRippleSource from "./water/WaterRipple.gsp"; -import WaterSource from "./water/Water.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import BakePBRSource from "./bake-pbr/BakePBR.shaderc"; +import EyeSource from "./advanced-shader/eye/Eye.shaderc"; +import GridSource from "./grid/Grid.shaderc"; +import HairSource from "./advanced-shader/hair/Hair.shaderc"; +import PlainColorSource from "./plain-color/PlainColor.shaderc"; +import PlanarShadowOnlySource from "./planar-shadow/PlanarShadowOnly.shaderc"; +import PlanarShadowSource from "./planar-shadow/PlanarShadow.shaderc"; +import SSSSource from "./advanced-shader/sss/SSS.shaderc"; +import WaterFallSource from "./water/WaterFall.shaderc"; +import WaterRippleSource from "./water/WaterRipple.shaderc"; +import WaterSource from "./water/Water.shaderc"; // prettier-ignore export { diff --git a/packages/custom-material/libs/plain-color/PlainColor.gsp b/packages/custom-material/libs/plain-color/PlainColor.gsp deleted file mode 100644 index c8d99222..00000000 --- a/packages/custom-material/libs/plain-color/PlainColor.gsp +++ /dev/null @@ -1 +0,0 @@ -{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/plain-color/PlainColor.shaderc b/packages/custom-material/libs/plain-color/PlainColor.shaderc new file mode 100644 index 00000000..c348e416 --- /dev/null +++ b/packages/custom-material/libs/plain-color/PlainColor.shaderc @@ -0,0 +1 @@ +{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"25":0},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","10":"depthEnabled","11":"depthWriteEnabled","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadow.gsp b/packages/custom-material/libs/planar-shadow/PlanarShadow.shaderc similarity index 100% rename from packages/custom-material/libs/planar-shadow/PlanarShadow.gsp rename to packages/custom-material/libs/planar-shadow/PlanarShadow.shaderc diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.gsp b/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc similarity index 100% rename from packages/custom-material/libs/planar-shadow/PlanarShadowOnly.gsp rename to packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc diff --git a/packages/custom-material/libs/water/Water.gsp b/packages/custom-material/libs/water/Water.shaderc similarity index 100% rename from packages/custom-material/libs/water/Water.gsp rename to packages/custom-material/libs/water/Water.shaderc diff --git a/packages/custom-material/libs/water/WaterFall.gsp b/packages/custom-material/libs/water/WaterFall.shaderc similarity index 100% rename from packages/custom-material/libs/water/WaterFall.gsp rename to packages/custom-material/libs/water/WaterFall.shaderc diff --git a/packages/custom-material/libs/water/WaterRipple.gsp b/packages/custom-material/libs/water/WaterRipple.shaderc similarity index 100% rename from packages/custom-material/libs/water/WaterRipple.gsp rename to packages/custom-material/libs/water/WaterRipple.shaderc diff --git a/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl b/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl index fe4e4d94..07fbb405 100644 --- a/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/eye/EyeForwardPass.glsl @@ -1,16 +1,16 @@ #ifndef FORWARD_PASS_PBR_INCLUDED #define FORWARD_PASS_PBR_INCLUDED -#include "Common/Common.glsl" -#include "Common/Fog.glsl" +#include "ShaderLibrary/Common/Common.glsl" +#include "ShaderLibrary/Common/Fog.glsl" -#include "Common/Attributes.glsl" -#include "PBR/VaryingsPBR.glsl" -#include "PBR/LightDirectPBR.glsl" -#include "PBR/LightIndirectPBR.glsl" +#include "ShaderLibrary/Common/Attributes.glsl" +#include "ShaderLibrary/PBR/VaryingsPBR.glsl" +#include "ShaderLibrary/PBR/LightDirectPBR.glsl" +#include "ShaderLibrary/PBR/LightIndirectPBR.glsl" -#include "PBR/VertexPBR.glsl" -#include "PBR/FragmentPBR.glsl" +#include "ShaderLibrary/PBR/VertexPBR.glsl" +#include "ShaderLibrary/PBR/FragmentPBR.glsl" #include "./EyeFunction.glsl" diff --git a/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl b/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl index f15f2d40..8211c2bc 100644 --- a/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/hair/HairForwardPass.glsl @@ -1,16 +1,16 @@ #ifndef FORWARD_PASS_PBR_INCLUDED #define FORWARD_PASS_PBR_INCLUDED -#include "Common/Common.glsl" -#include "Common/Fog.glsl" +#include "ShaderLibrary/Common/Common.glsl" +#include "ShaderLibrary/Common/Fog.glsl" -#include "Common/Attributes.glsl" -#include "PBR/VaryingsPBR.glsl" +#include "ShaderLibrary/Common/Attributes.glsl" +#include "ShaderLibrary/PBR/VaryingsPBR.glsl" #include "./HairLightDirect.glsl" -#include "PBR/LightIndirectPBR.glsl" +#include "ShaderLibrary/PBR/LightIndirectPBR.glsl" -#include "PBR/VertexPBR.glsl" -#include "PBR/FragmentPBR.glsl" +#include "ShaderLibrary/PBR/VertexPBR.glsl" +#include "ShaderLibrary/PBR/FragmentPBR.glsl" Varyings PBRVertex(Attributes attributes) { diff --git a/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl b/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl index e7bebdae..286cde1b 100644 --- a/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl +++ b/packages/custom-material/src/advanced-shader/hair/HairLightDirect.glsl @@ -1,6 +1,6 @@ #define FUNCTION_SPECULAR_LOBE specularLobehair -#include "PBR/BSDF.glsl" +#include "ShaderLibrary/PBR/BSDF.glsl" #include "./HairFunction.glsl" @@ -29,4 +29,4 @@ void specularLobehair(Varyings varyings, SurfaceData surfaceData, BRDFData brdfD specularColor += attenuationIrradiance * hairSpecular; } -#include "PBR/LightDirectPBR.glsl" \ No newline at end of file +#include "ShaderLibrary/PBR/LightDirectPBR.glsl" \ No newline at end of file diff --git a/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl b/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl index 5a46b437..19aedc07 100644 --- a/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl +++ b/packages/custom-material/src/advanced-shader/sss/SSSForwardPass.glsl @@ -1,16 +1,16 @@ #ifndef FORWARD_PASS_PBR_INCLUDED #define FORWARD_PASS_PBR_INCLUDED -#include "Common/Common.glsl" -#include "Common/Fog.glsl" +#include "ShaderLibrary/Common/Common.glsl" +#include "ShaderLibrary/Common/Fog.glsl" -#include "Common/Attributes.glsl" -#include "PBR/VaryingsPBR.glsl" +#include "ShaderLibrary/Common/Attributes.glsl" +#include "ShaderLibrary/PBR/VaryingsPBR.glsl" #include "./SSSLightDirect.glsl" -#include "PBR/LightIndirectPBR.glsl" +#include "ShaderLibrary/PBR/LightIndirectPBR.glsl" -#include "PBR/VertexPBR.glsl" -#include "PBR/FragmentPBR.glsl" +#include "ShaderLibrary/PBR/VertexPBR.glsl" +#include "ShaderLibrary/PBR/FragmentPBR.glsl" Varyings PBRVertex(Attributes attributes) { Varyings varyings; diff --git a/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl b/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl index cce4d270..eb47db24 100644 --- a/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl +++ b/packages/custom-material/src/advanced-shader/sss/SSSLightDirect.glsl @@ -1,7 +1,7 @@ #define FUNCTION_SURFACE_SHADING surfaceShadingSSS -#include "PBR/BSDF.glsl" -#include "PBR/ReflectionLobe.glsl" +#include "ShaderLibrary/PBR/BSDF.glsl" +#include "ShaderLibrary/PBR/ReflectionLobe.glsl" #include "./SSSFunction.glsl" void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor) { @@ -36,4 +36,4 @@ void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdf totalSpecularColor += specularColor; } -#include "PBR/LightDirectPBR.glsl" \ No newline at end of file +#include "ShaderLibrary/PBR/LightDirectPBR.glsl" \ No newline at end of file diff --git a/packages/custom-material/src/bake-pbr/BakePBR.shader b/packages/custom-material/src/bake-pbr/BakePBR.shader index 2860b495..14c6dcec 100644 --- a/packages/custom-material/src/bake-pbr/BakePBR.shader +++ b/packages/custom-material/src/bake-pbr/BakePBR.shader @@ -36,7 +36,7 @@ Shader "bake-pbr" { VertexShader = BakePBRVertex; FragmentShader = BakePBRFragment; - #include "PBR/ForwardPassPBR.glsl" + #include "ShaderLibrary/PBR/ForwardPassPBR.glsl" #ifdef LIGHTMAP_TEXTURE sampler2D u_lightMapTexture; diff --git a/packages/custom-material/src/global.d.ts b/packages/custom-material/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/custom-material/src/global.d.ts +++ b/packages/custom-material/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/custom-material/src/grid/Grid.shader b/packages/custom-material/src/grid/Grid.shader index f6c6717c..b3810e65 100644 --- a/packages/custom-material/src/grid/Grid.shader +++ b/packages/custom-material/src/grid/Grid.shader @@ -4,7 +4,7 @@ Shader "grid" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" + #include "ShaderLibrary/Common/Common.glsl" mat4 camera_ViewInvMat; mat4 camera_ProjMat; @@ -42,7 +42,7 @@ Shader "grid" { return v; } - #include "Common/Transform.glsl" + #include "ShaderLibrary/Common/Transform.glsl" float u_far; float u_near; diff --git a/packages/custom-material/src/plain-color/PlainColor.shader b/packages/custom-material/src/plain-color/PlainColor.shader index a1c37f05..8fa31a76 100644 --- a/packages/custom-material/src/plain-color/PlainColor.shader +++ b/packages/custom-material/src/plain-color/PlainColor.shader @@ -1,15 +1,43 @@ Shader "plain-color" { SubShader "Default" { Pass "Forward" { + Bool blendEnabled; + Bool depthEnabled; + Bool depthWriteEnabled; + RenderQueueType renderQueueType; + BlendFactor sourceColorBlendFactor; + BlendFactor destinationColorBlendFactor; + BlendFactor sourceAlphaBlendFactor; + BlendFactor destinationAlphaBlendFactor; + + DepthState = { + Enabled = depthEnabled; + WriteEnabled = depthWriteEnabled; + } + + BlendState = { + Enabled = blendEnabled; + SourceColorBlendFactor = sourceColorBlendFactor; + DestinationColorBlendFactor = destinationColorBlendFactor; + SourceAlphaBlendFactor = sourceAlphaBlendFactor; + DestinationAlphaBlendFactor = destinationAlphaBlendFactor; + } + + RasterState = { + CullMode = CullMode.Off; + } + + RenderQueueType = renderQueueType; + VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" + #include "ShaderLibrary/Skin/Skin.glsl" + #include "ShaderLibrary/Skin/BlendShape.glsl" - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" void vert(Attributes attr) { vec4 position = vec4(attr.POSITION, 1.0); diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index 6d37c279..5dba7981 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -1,4 +1,4 @@ -import { BaseMaterial, Color, CullMode, Engine, Shader } from "@galacean/engine"; +import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; import shaderSource from "./PlainColor.shader"; Shader.find("plain-color") || Shader.create(shaderSource); @@ -34,7 +34,8 @@ export class PlainColorMaterial extends BaseMaterial { shaderData.setColor(PlainColorMaterial._baseColorProp, new Color(1, 1, 1, 1)); - this.renderState.rasterState.cullMode = CullMode.Off; + // depth test on by default; gizmo overlays opt out by setting `depthEnabled` to 0. + shaderData.setInt("depthEnabled", 1); } override clone(): PlainColorMaterial { diff --git a/packages/custom-material/src/water/Water.shader b/packages/custom-material/src/water/Water.shader index 28b441a5..9fb2b0ce 100644 --- a/packages/custom-material/src/water/Water.shader +++ b/packages/custom-material/src/water/Water.shader @@ -9,7 +9,7 @@ Shader "water" { vec2 u_water_speed; vec2 u_distorsion_speed; - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec4 v_color; @@ -32,7 +32,7 @@ Shader "water" { return v; } - #include "Common/Common.glsl" + #include "ShaderLibrary/Common/Common.glsl" sampler2D material_NormalTexture; sampler2D u_waterTex; diff --git a/packages/custom-material/src/water/WaterFall.shader b/packages/custom-material/src/water/WaterFall.shader index 721fa450..0ce50904 100644 --- a/packages/custom-material/src/water/WaterFall.shader +++ b/packages/custom-material/src/water/WaterFall.shader @@ -10,7 +10,7 @@ Shader "water-fall" { vec2 u_waterfall_speed; vec2 u_distorsion_speed; - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec2 waterTexCoords; @@ -35,7 +35,7 @@ Shader "water-fall" { return v; } - #include "Common/Common.glsl" + #include "ShaderLibrary/Common/Common.glsl" sampler2D material_NormalTexture; sampler2D u_waterTex; diff --git a/packages/custom-material/src/water/WaterRipple.shader b/packages/custom-material/src/water/WaterRipple.shader index c8d54f93..fec6d943 100644 --- a/packages/custom-material/src/water/WaterRipple.shader +++ b/packages/custom-material/src/water/WaterRipple.shader @@ -9,7 +9,7 @@ Shader "water-ripple" { vec2 u_foam_speed; vec2 u_distorsion_speed; - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec2 waterTexCoords; @@ -30,7 +30,7 @@ Shader "water-ripple" { return v; } - #include "Common/Common.glsl" + #include "ShaderLibrary/Common/Common.glsl" sampler2D material_NormalTexture; sampler2D u_foamTex; diff --git a/packages/framebuffer-picker/libs/FramebufferPickerColor.gsp b/packages/framebuffer-picker/libs/FramebufferPickerColor.shaderc similarity index 100% rename from packages/framebuffer-picker/libs/FramebufferPickerColor.gsp rename to packages/framebuffer-picker/libs/FramebufferPickerColor.shaderc diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/libs/index.ts index 1fb1c677..ac8341db 100644 --- a/packages/framebuffer-picker/libs/index.ts +++ b/packages/framebuffer-picker/libs/index.ts @@ -1,5 +1,5 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import FramebufferPickerColorSource from "./FramebufferPickerColor.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import FramebufferPickerColorSource from "./FramebufferPickerColor.shaderc"; // prettier-ignore export { diff --git a/packages/framebuffer-picker/src/FramebufferPickerColor.shader b/packages/framebuffer-picker/src/FramebufferPickerColor.shader index a8d86398..19e079eb 100644 --- a/packages/framebuffer-picker/src/FramebufferPickerColor.shader +++ b/packages/framebuffer-picker/src/FramebufferPickerColor.shader @@ -4,12 +4,12 @@ Shader "framebuffer-picker-color" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" + #include "ShaderLibrary/Skin/Skin.glsl" + #include "ShaderLibrary/Skin/BlendShape.glsl" - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" void vert(Attributes attr) { vec4 position = vec4(attr.POSITION, 1.0); diff --git a/packages/framebuffer-picker/src/global.d.ts b/packages/framebuffer-picker/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/framebuffer-picker/src/global.d.ts +++ b/packages/framebuffer-picker/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/libs/index.ts index 1eb3fe9d..4dc0bdd4 100644 --- a/packages/geometry-sketch/libs/index.ts +++ b/packages/geometry-sketch/libs/index.ts @@ -1,6 +1,6 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import TBNSource from "./material/TBN.gsp"; -import WireframeSource from "./material/Wireframe.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import TBNSource from "./material/TBN.shaderc"; +import WireframeSource from "./material/Wireframe.shaderc"; // prettier-ignore export { diff --git a/packages/geometry-sketch/libs/material/TBN.gsp b/packages/geometry-sketch/libs/material/TBN.shaderc similarity index 100% rename from packages/geometry-sketch/libs/material/TBN.gsp rename to packages/geometry-sketch/libs/material/TBN.shaderc diff --git a/packages/geometry-sketch/libs/material/Wireframe.gsp b/packages/geometry-sketch/libs/material/Wireframe.shaderc similarity index 100% rename from packages/geometry-sketch/libs/material/Wireframe.gsp rename to packages/geometry-sketch/libs/material/Wireframe.shaderc diff --git a/packages/geometry-sketch/src/global.d.ts b/packages/geometry-sketch/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/geometry-sketch/src/global.d.ts +++ b/packages/geometry-sketch/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/geometry-sketch/src/material/TBN.shader b/packages/geometry-sketch/src/material/TBN.shader index 1604d693..dd4dc1f8 100644 --- a/packages/geometry-sketch/src/material/TBN.shader +++ b/packages/geometry-sketch/src/material/TBN.shader @@ -4,9 +4,9 @@ Shader "tbnShader" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" + #include "ShaderLibrary/Skin/Skin.glsl" float u_lineScale; mat4 camera_VPMat; @@ -15,7 +15,7 @@ Shader "tbnShader" { #include "./GeometryTextureDefine.glsl" - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" void vert(Attributes attr) { int pointIndex = gl_VertexID / 2; diff --git a/packages/geometry-sketch/src/material/Wireframe.shader b/packages/geometry-sketch/src/material/Wireframe.shader index a254392f..90894554 100644 --- a/packages/geometry-sketch/src/material/Wireframe.shader +++ b/packages/geometry-sketch/src/material/Wireframe.shader @@ -4,9 +4,9 @@ Shader "wireframeShader" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" + #include "ShaderLibrary/Skin/Skin.glsl" float u_lineScale; mat4 camera_VPMat; @@ -15,7 +15,7 @@ Shader "wireframeShader" { #include "./GeometryTextureDefine.glsl" - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec3 v_baryCenter; diff --git a/packages/gizmo/libs/icon/Icon.gsp b/packages/gizmo/libs/icon/Icon.shaderc similarity index 100% rename from packages/gizmo/libs/icon/Icon.gsp rename to packages/gizmo/libs/icon/Icon.shaderc diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/libs/index.ts index cc28833f..35fe2543 100644 --- a/packages/gizmo/libs/index.ts +++ b/packages/gizmo/libs/index.ts @@ -1,5 +1,5 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import IconSource from "./icon/Icon.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import IconSource from "./icon/Icon.shaderc"; // prettier-ignore export { diff --git a/packages/gizmo/src/Utils.ts b/packages/gizmo/src/Utils.ts index 62a361c8..9e7879cf 100644 --- a/packages/gizmo/src/Utils.ts +++ b/packages/gizmo/src/Utils.ts @@ -1,4 +1,4 @@ -import { Engine, PrimitiveMesh, ModelMesh, CullMode, Vector3 } from "@galacean/engine"; +import { Engine, PrimitiveMesh, ModelMesh, Vector3 } from "@galacean/engine"; import { State } from "./enums/GizmoState"; import { GizmoMesh } from "./GizmoMesh"; import { PlainColorMaterial } from "@galacean/engine-toolkit-custom-material"; @@ -126,9 +126,7 @@ export class Utils { ); Utils.yellowMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0); Utils.rotatePlaneMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0, 0.2); - Utils.rotatePlaneMaterial.renderState.rasterState.cullMode = CullMode.Off; Utils.invisibleMaterialRotate = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0); - Utils.invisibleMaterialRotate.renderState.rasterState.cullMode = CullMode.Off; Utils.invisibleMaterialCircle = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0); // scale material @@ -211,7 +209,7 @@ export class Utils { ): PlainColorMaterial { const material = new PlainColorMaterial(engine); material.isTransparent = true; - material.renderState.depthState.enabled = false; + material.shaderData.setInt("depthEnabled", 0); material.baseColor.set(r, g, b, a); material.name = name.toString(); return material; diff --git a/packages/gizmo/src/global.d.ts b/packages/gizmo/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/gizmo/src/global.d.ts +++ b/packages/gizmo/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/gizmo/src/icon/Icon.shader b/packages/gizmo/src/icon/Icon.shader index 646c4e63..13b0756e 100644 --- a/packages/gizmo/src/icon/Icon.shader +++ b/packages/gizmo/src/icon/Icon.shader @@ -4,15 +4,15 @@ Shader "icon" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" + #include "ShaderLibrary/Skin/Skin.glsl" + #include "ShaderLibrary/Skin/BlendShape.glsl" vec2 u_size; vec4 u_pixelViewport; - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec2 v_uv; diff --git a/packages/lines/libs/index.ts b/packages/lines/libs/index.ts index 96a3ba2a..307a009a 100644 --- a/packages/lines/libs/index.ts +++ b/packages/lines/libs/index.ts @@ -1,6 +1,6 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import DashSource from "./line/material/Dash.gsp"; -import LineSource from "./line/material/Line.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import DashSource from "./line/material/Dash.shaderc"; +import LineSource from "./line/material/Line.shaderc"; // prettier-ignore export { diff --git a/packages/lines/libs/line/material/Dash.gsp b/packages/lines/libs/line/material/Dash.shaderc similarity index 100% rename from packages/lines/libs/line/material/Dash.gsp rename to packages/lines/libs/line/material/Dash.shaderc diff --git a/packages/lines/libs/line/material/Line.gsp b/packages/lines/libs/line/material/Line.shaderc similarity index 100% rename from packages/lines/libs/line/material/Line.gsp rename to packages/lines/libs/line/material/Line.shaderc diff --git a/packages/lines/src/global.d.ts b/packages/lines/src/global.d.ts index 7416df1b..1ff57a66 100644 --- a/packages/lines/src/global.d.ts +++ b/packages/lines/src/global.d.ts @@ -5,7 +5,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/outline/libs/OutlinePostprocess.gsp b/packages/outline/libs/OutlinePostprocess.shaderc similarity index 100% rename from packages/outline/libs/OutlinePostprocess.gsp rename to packages/outline/libs/OutlinePostprocess.shaderc diff --git a/packages/outline/libs/OutlineReplace.gsp b/packages/outline/libs/OutlineReplace.shaderc similarity index 100% rename from packages/outline/libs/OutlineReplace.gsp rename to packages/outline/libs/OutlineReplace.shaderc diff --git a/packages/outline/libs/index.ts b/packages/outline/libs/index.ts index f8ace5a8..e3d074cb 100644 --- a/packages/outline/libs/index.ts +++ b/packages/outline/libs/index.ts @@ -1,6 +1,6 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import OutlinePostprocessSource from "./OutlinePostprocess.gsp"; -import OutlineReplaceSource from "./OutlineReplace.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import OutlinePostprocessSource from "./OutlinePostprocess.shaderc"; +import OutlineReplaceSource from "./OutlineReplace.shaderc"; // prettier-ignore export { diff --git a/packages/outline/src/OutlinePostprocess.shader b/packages/outline/src/OutlinePostprocess.shader index 0db2c2a3..d9408d6f 100644 --- a/packages/outline/src/OutlinePostprocess.shader +++ b/packages/outline/src/OutlinePostprocess.shader @@ -4,7 +4,7 @@ Shader "outline-postprocess-shader" { VertexShader = vert; FragmentShader = frag; - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec2 v_uv; @@ -19,7 +19,7 @@ Shader "outline-postprocess-shader" { return v; } - #include "Common/Common.glsl" + #include "ShaderLibrary/Common/Common.glsl" vec3 material_OutlineColor; sampler2D material_OutlineTexture; diff --git a/packages/outline/src/OutlineReplace.shader b/packages/outline/src/OutlineReplace.shader index 6f169422..bcaed911 100644 --- a/packages/outline/src/OutlineReplace.shader +++ b/packages/outline/src/OutlineReplace.shader @@ -4,12 +4,12 @@ Shader "outline-replace-shader" { VertexShader = vert; FragmentShader = frag; - #include "Common/Common.glsl" - #include "Common/Transform.glsl" - #include "Skin/Skin.glsl" - #include "Skin/BlendShape.glsl" + #include "ShaderLibrary/Common/Common.glsl" + #include "ShaderLibrary/Common/Transform.glsl" + #include "ShaderLibrary/Skin/Skin.glsl" + #include "ShaderLibrary/Skin/BlendShape.glsl" - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" Varyings vert(Attributes attr) { Varyings v; diff --git a/packages/outline/src/global.d.ts b/packages/outline/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/outline/src/global.d.ts +++ b/packages/outline/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/packages/skeleton-viewer/libs/SkeletonViewer.gsp b/packages/skeleton-viewer/libs/SkeletonViewer.gsp deleted file mode 100644 index cff6c023..00000000 --- a/packages/skeleton-viewer/libs/SkeletonViewer.gsp +++ /dev/null @@ -1 +0,0 @@ -{"name":"skeleton-viewer","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",62],[0," v_normal = normalize ( mat3 ( renderer_NormalMat ) * NORMAL ) ; \n"],[6],[0,"\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nuniform vec3 u_colorMin;\nuniform vec3 u_colorMax;\nvoid main() { float ndl = dot ( v_normal , vec3 ( 0 , 1 , 0 ) ) * 0.5 + 0.5 ;\nvec3 diffuse = mix ( u_colorMin , u_colorMax , ndl ) ;\ngl_FragColor = vec4 ( diffuse , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/skeleton-viewer/libs/SkeletonViewer.shaderc b/packages/skeleton-viewer/libs/SkeletonViewer.shaderc new file mode 100644 index 00000000..4c970b5d --- /dev/null +++ b/packages/skeleton-viewer/libs/SkeletonViewer.shaderc @@ -0,0 +1 @@ +{"name":"skeleton-viewer","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"10":false,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",62],[0," v_normal = normalize ( mat3 ( renderer_NormalMat ) * NORMAL ) ; \n"],[6],[0,"\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_normal;\n\nuniform vec3 u_colorMin;\nuniform vec3 u_colorMax;\nvoid main() { float ndl = dot ( v_normal , vec3 ( 0 , 1 , 0 ) ) * 0.5 + 0.5 ;\nvec3 diffuse = mix ( u_colorMin , u_colorMax , ndl ) ;\ngl_FragColor = vec4 ( diffuse , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/libs/index.ts index 334ae949..fd874a95 100644 --- a/packages/skeleton-viewer/libs/index.ts +++ b/packages/skeleton-viewer/libs/index.ts @@ -1,5 +1,5 @@ -// Auto-generated by shader-precompile --emit-index — do not edit -import SkeletonViewerSource from "./SkeletonViewer.gsp"; +// Auto-generated by shader-compiler-precompile --emit-index — do not edit. +import SkeletonViewerSource from "./SkeletonViewer.shaderc"; // prettier-ignore export { diff --git a/packages/skeleton-viewer/src/SkeletonViewer.shader b/packages/skeleton-viewer/src/SkeletonViewer.shader index 4d2544a6..c84e959b 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.shader +++ b/packages/skeleton-viewer/src/SkeletonViewer.shader @@ -1,13 +1,19 @@ Shader "skeleton-viewer" { SubShader "Default" { Pass "Forward" { + DepthState = { + Enabled = false; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; mat4 renderer_MVPMat; mat4 renderer_NormalMat; - #include "Common/Attributes.glsl" + #include "ShaderLibrary/Common/Attributes.glsl" struct Varyings { vec3 v_normal; diff --git a/packages/skeleton-viewer/src/SkeletonViewer.ts b/packages/skeleton-viewer/src/SkeletonViewer.ts index a653f173..e2f5dcb7 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.ts +++ b/packages/skeleton-viewer/src/SkeletonViewer.ts @@ -8,7 +8,6 @@ import { ModelMesh, PrimitiveMesh, Quaternion, - RenderQueueType, Script, Shader, SkinnedMeshRenderer, @@ -47,8 +46,6 @@ export class SkeletonViewer extends Script { const engine = entity.engine; if (!materialMap.get(engine)) { const material = new Material(entity.engine, Shader.find("skeleton-viewer")); - material.renderState.rasterState.depthBias = -100000000; - material.renderState.renderQueueType = RenderQueueType.Transparent; materialMap.set(engine, material); } diff --git a/packages/skeleton-viewer/src/global.d.ts b/packages/skeleton-viewer/src/global.d.ts index 048f4523..eafdc01a 100644 --- a/packages/skeleton-viewer/src/global.d.ts +++ b/packages/skeleton-viewer/src/global.d.ts @@ -3,7 +3,7 @@ declare module "*.shader" { export default value; } -declare module "*.gsp" { +declare module "*.shaderc" { const value: object; export default value; } diff --git a/rollup.config.mjs b/rollup.config.mjs index 5bc54e80..9185a935 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,5 +1,5 @@ import resolve from "@rollup/plugin-node-resolve"; -import { shaderCompiler } from "@galacean/engine-shader-compiler/bundler"; +import { shaderCompiler } from "@galacean/engine-shader-compiler/bundler/rollup"; import license from "rollup-plugin-license"; import { binary2base64 } from "rollup-plugin-binary2base64"; import commonjs from "@rollup/plugin-commonjs"; @@ -70,9 +70,9 @@ const mainFields = ["module", "main"]; const plugins = [ resolve({ extensions, preferBuiltins: true, mainFields }), - // Transform-only — `.shader`/`.glsl`/`.gsp` files become string/JSON modules. + // Transform-only — `.shader`/`.glsl`/`.shaderc` files become string/JSON modules. // Each package owns its own `precompile` npm script that drives the CLI to - // emit `.gsp` artifacts under `/libs/`; rollup never runs precompile. + // emit `.shaderc` artifacts under `/libs/`; rollup never runs precompile. shaderCompiler(), swc( defineRollupSwcOption({ From feb2f182f723b9f93cb32f584f1755e35f0a6ddb Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Sat, 9 May 2026 15:07:06 +0800 Subject: [PATCH 16/27] refactor(planar-shadow): pin shadow-pass render state in ShaderLab DSL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shadow pass's render state (queue / blend / depth-write / 10 stencil knobs) was previously written via `material.renderStates[1]`, which engine d21484b62 removed. Move all of it into PlanarShadowOnly .shader's ShaderLab DSL — every value is a constant for this material so const blocks suffice; `ReferenceValue` is intentionally not declared so the runtime falls back to RenderState's field initializer (0). PlanarShadowShaderFactory loses the dead 24-line render-state block and the BlendFactor / CompareFunction / RenderQueueType / StencilOperation imports that supported it. --- .../planar-shadow/PlanarShadowOnly.shaderc | 2 +- .../src/planar-shadow/PlanarShadowOnly.shader | 27 +++++++++++++ .../PlanarShadowShaderFactory.ts | 38 ++----------------- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc b/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc index 3e107d72..11012594 100644 --- a/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc +++ b/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc @@ -1 +1 @@ -{"name":"PlanarShadowOnly","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"PlanarShadow","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform vec3 u_lightDir;\nuniform float u_planarHeight;\nuniform vec4 u_planarShadowColor;\nuniform float u_planarShadowFalloff;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_VPMat;\nattribute vec4 POSITION;\n\n"],[1,"RENDERER_HAS_SKIN",4],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\nvarying vec4 color;\n\n\n"],[1,"RENDERER_HAS_SKIN",14],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",10],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,12],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\n\n"],[6],[0,"\nvec3 ShadowProjectPos ( vec4 vertPos ) { vec3 shadowPos ;\nvec3 worldPos = ( renderer_ModelMat * vertPos ).xyz ;\nshadowPos.y = min ( worldPos.y , u_planarHeight ) ;\nshadowPos.xz = worldPos.xz - u_lightDir.xz * max ( 0.0 , worldPos.y - u_planarHeight ) / u_lightDir.y ;\nreturn shadowPos ; }\nvoid main() { \nvec4 position = vec4 ( POSITION.xyz , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_SKIN",24],[0," \n"],[1,"RENDERER_USE_JOINT_TEXTURE",20],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,22],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec3 shadowPos = ShadowProjectPos(position) ;\ngl_Position = camera_VPMat * vec4 ( shadowPos , 1.0 ) ;\nvec3 center = vec3 ( renderer_ModelMat[3].x , u_planarHeight , renderer_ModelMat[3].z ) ;\nfloat falloff = 0.5 - clamp ( distance ( shadowPos , center ) * u_planarShadowFalloff , 0.0 , 1.0 ) ;\ncolor = u_planarShadowColor ;\ncolor.a *= falloff ;\n }"]],"fragmentShaderInstructions":[[0,"varying vec4 color;\n\n\n"],[1,"RENDERER_HAS_SKIN",10],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\n\n"],[5,8],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_FragColor = color ; }"]]}]}]} \ No newline at end of file +{"name":"PlanarShadowOnly","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"PlanarShadow","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"11":false,"13":true,"17":2,"18":2,"19":6,"20":6,"21":0,"22":0,"23":0,"24":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform vec3 u_lightDir;\nuniform float u_planarHeight;\nuniform vec4 u_planarShadowColor;\nuniform float u_planarShadowFalloff;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_VPMat;\nattribute vec4 POSITION;\n\n"],[1,"RENDERER_HAS_SKIN",4],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\nvarying vec4 color;\n\n\n"],[1,"RENDERER_HAS_SKIN",14],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",10],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,12],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\n\n"],[6],[0,"\nvec3 ShadowProjectPos ( vec4 vertPos ) { vec3 shadowPos ;\nvec3 worldPos = ( renderer_ModelMat * vertPos ).xyz ;\nshadowPos.y = min ( worldPos.y , u_planarHeight ) ;\nshadowPos.xz = worldPos.xz - u_lightDir.xz * max ( 0.0 , worldPos.y - u_planarHeight ) / u_lightDir.y ;\nreturn shadowPos ; }\nvoid main() { \nvec4 position = vec4 ( POSITION.xyz , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_SKIN",24],[0," \n"],[1,"RENDERER_USE_JOINT_TEXTURE",20],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,22],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec3 shadowPos = ShadowProjectPos(position) ;\ngl_Position = camera_VPMat * vec4 ( shadowPos , 1.0 ) ;\nvec3 center = vec3 ( renderer_ModelMat[3].x , u_planarHeight , renderer_ModelMat[3].z ) ;\nfloat falloff = 0.5 - clamp ( distance ( shadowPos , center ) * u_planarShadowFalloff , 0.0 , 1.0 ) ;\ncolor = u_planarShadowColor ;\ncolor.a *= falloff ;\n }"]],"fragmentShaderInstructions":[[0,"varying vec4 color;\n\n\n"],[1,"RENDERER_HAS_SKIN",10],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\n\n"],[5,8],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader b/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader index 6a858830..02178cc2 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader +++ b/packages/custom-material/src/planar-shadow/PlanarShadowOnly.shader @@ -1,6 +1,33 @@ Shader "PlanarShadowOnly" { SubShader "Default" { Pass "PlanarShadow" { + DepthState = { + WriteEnabled = false; + } + + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.One; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + } + + // ReferenceValue not declared → defaults to 0 (RenderState field initializer). + StencilState = { + Enabled = true; + CompareFunctionFront = CompareFunction.Equal; + CompareFunctionBack = CompareFunction.Equal; + FailOperationFront = StencilOperation.Keep; + FailOperationBack = StencilOperation.Keep; + ZFailOperationFront = StencilOperation.Keep; + ZFailOperationBack = StencilOperation.Keep; + PassOperationFront = StencilOperation.IncrementWrap; + PassOperationBack = StencilOperation.IncrementWrap; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index c0362015..c6c0e173 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -1,14 +1,4 @@ -import { - BlendFactor, - Color, - CompareFunction, - Material, - RenderQueueType, - Shader, - ShaderProperty, - StencilOperation, - Vector3 -} from "@galacean/engine"; +import { Color, Material, Shader, ShaderProperty, Vector3 } from "@galacean/engine"; import planarShadowOnlySource from "./PlanarShadowOnly.shader"; @@ -25,30 +15,8 @@ export class PlanarShadowShaderFactory { static replaceShader(material: Material) { material.shader = Shader.find("planarShadowShader"); - const shadowRenderState = material.renderStates[1]; - shadowRenderState.renderQueueType = RenderQueueType.Transparent; - shadowRenderState.depthState.writeEnabled = false; - - const targetBlendState = shadowRenderState.blendState.targetBlendState; - targetBlendState.enabled = true; - targetBlendState.sourceColorBlendFactor = BlendFactor.SourceAlpha; - targetBlendState.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; - targetBlendState.sourceAlphaBlendFactor = BlendFactor.One; - targetBlendState.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; - - // set shadow pass stencilState - const stencilState = shadowRenderState.stencilState; - stencilState.enabled = true; - stencilState.referenceValue = 0; - stencilState.compareFunctionFront = CompareFunction.Equal; - stencilState.compareFunctionBack = CompareFunction.Equal; - stencilState.failOperationFront = StencilOperation.Keep; - stencilState.failOperationBack = StencilOperation.Keep; - stencilState.zFailOperationFront = StencilOperation.Keep; - stencilState.zFailOperationBack = StencilOperation.Keep; - stencilState.passOperationFront = StencilOperation.IncrementWrap; - stencilState.passOperationBack = StencilOperation.IncrementWrap; - + // Render state for the shadow pass (queue / blend / depth / stencil) is + // pinned in PlanarShadowOnly.shader's ShaderLab DSL block. const shaderData = material.shaderData; shaderData.setFloat(PlanarShadowShaderFactory._shadowFalloffProp, 0); shaderData.setColor(PlanarShadowShaderFactory._shadowColorProp, new Color(1.0, 1.0, 1.0, 1.0)); From 9116bc9c7cbf215a1ce682fc70c541b6f56458aa Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Sat, 9 May 2026 15:43:16 +0800 Subject: [PATCH 17/27] refactor: drop residual material.renderState writes in lines + gizmo icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comprehensive sweep after the engine d21484b62 (remove material.renderState) — these toolkit packages still wrote to it and would TypeError at runtime / TS-error post types-build: - lines/LineMaterial: full constructor cleanup (cull / depth / blend / queue moved to Line.shader and Dash.shader DSL — DashMaterial inherits LineMaterial so both shaders need the same DSL block). - gizmo/icon/IconMaterial: drop the cullMode write; Icon.shader pins CullMode = Off as a DSL constant. - gizmo/icon/Icon.ts: drop the depthState.enabled = false write; Icon.shader pins DepthState { Enabled = false; } — gizmo icons are always overlay-style with depth disabled. Also fix planar-shadow/README.md docs example that was using the removed `engine-shader-lab` package and `shaderLab` config field. --- .../src/planar-shadow/README.md | 12 +++++------ packages/gizmo/libs/icon/Icon.shaderc | 2 +- packages/gizmo/src/icon/Icon.shader | 8 +++++++ packages/gizmo/src/icon/Icon.ts | 1 - packages/gizmo/src/icon/IconMaterial.ts | 4 +++- .../lines/libs/line/material/Dash.shaderc | 2 +- .../lines/libs/line/material/Line.shaderc | 2 +- packages/lines/src/line/material/Dash.shader | 20 ++++++++++++++++++ packages/lines/src/line/material/Line.shader | 20 ++++++++++++++++++ .../lines/src/line/material/LineMaterial.ts | 21 ++++--------------- 10 files changed, 64 insertions(+), 28 deletions(-) diff --git a/packages/custom-material/src/planar-shadow/README.md b/packages/custom-material/src/planar-shadow/README.md index ee107c08..5eae9da2 100644 --- a/packages/custom-material/src/planar-shadow/README.md +++ b/packages/custom-material/src/planar-shadow/README.md @@ -20,17 +20,17 @@ for (let i = 0, n = renderers.length; i < n; i++) { } ``` -##### OR with `ShaderLab` +##### OR with `ShaderCompiler` -- Init engine with `ShaderLab` +- Init engine with `ShaderCompiler` ```ts - import { ShaderLab } from "@galacean/engine-shader-lab"; - // Init engine with shaderLab - WebGLEngine.create({ canvas: "canvas", shaderLab }); + import { ShaderCompiler } from "@galacean/engine-shader-compiler"; + // Init engine with shaderCompiler + WebGLEngine.create({ canvas: "canvas", shaderCompiler: new ShaderCompiler() }); ``` -- Create shader through `ShaderLab` +- Create shader through ShaderLab DSL ```ts import { PlanarShadowShaderSource } from "@galacean/engine-toolkit"; diff --git a/packages/gizmo/libs/icon/Icon.shaderc b/packages/gizmo/libs/icon/Icon.shaderc index 01ca5012..c0096bbc 100644 --- a/packages/gizmo/libs/icon/Icon.shaderc +++ b/packages/gizmo/libs/icon/Icon.shaderc @@ -1 +1 @@ -{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file +{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"10":false,"25":0},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/gizmo/src/icon/Icon.shader b/packages/gizmo/src/icon/Icon.shader index 13b0756e..12d8d114 100644 --- a/packages/gizmo/src/icon/Icon.shader +++ b/packages/gizmo/src/icon/Icon.shader @@ -1,6 +1,14 @@ Shader "icon" { SubShader "Default" { Pass "Forward" { + DepthState = { + Enabled = false; + } + + RasterState = { + CullMode = CullMode.Off; + } + VertexShader = vert; FragmentShader = frag; diff --git a/packages/gizmo/src/icon/Icon.ts b/packages/gizmo/src/icon/Icon.ts index 2a260f4b..a0cedeee 100644 --- a/packages/gizmo/src/icon/Icon.ts +++ b/packages/gizmo/src/icon/Icon.ts @@ -95,7 +95,6 @@ export class Icon extends Script { meshRenderer.mesh = mesh; meshRenderer.priority = 1; const iconMaterial = new IconMaterial(engine); - iconMaterial.renderState.depthState.enabled = false; iconMaterial.isTransparent = true; meshRenderer.setMaterial(iconMaterial); this._material = iconMaterial; diff --git a/packages/gizmo/src/icon/IconMaterial.ts b/packages/gizmo/src/icon/IconMaterial.ts index cdd98382..104deb95 100644 --- a/packages/gizmo/src/icon/IconMaterial.ts +++ b/packages/gizmo/src/icon/IconMaterial.ts @@ -45,7 +45,9 @@ export class IconMaterial extends BaseMaterial { constructor(engine: Engine) { super(engine, Shader.find("icon")); this.shaderData.setColor(IconMaterial._baseColorProp, new Color(1, 1, 1, 1)); - this.renderState.rasterState.cullMode = CullMode.Off; + // RasterState (CullMode.Off) and DepthState (Enabled=false) are pinned in + // Icon.shader's ShaderLab DSL — gizmo icons are always double-sided + // overlays that ignore depth. } override clone(): IconMaterial { diff --git a/packages/lines/libs/line/material/Dash.shaderc b/packages/lines/libs/line/material/Dash.shaderc index 292c1fd6..335fe298 100644 --- a/packages/lines/libs/line/material/Dash.shaderc +++ b/packages/lines/libs/line/material/Dash.shaderc @@ -1 +1 @@ -{"name":"dash","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_width;\nuniform vec2 u_dash;\nattribute vec2 a_pos;\nattribute vec2 a_normal;\nattribute vec2 a_data;\nattribute float a_lengthsofar;\n\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_direction;\nvarying float v_part;\nvarying vec2 v_tex;\n\nvoid main() { \nv_direction = a_data.x ;\nv_part = a_data.y ;\nfloat layer_index = 1.0 ;\nv_origin = a_pos ;\nfloat texcoord_y = 0.0 ;\ntexcoord_y = a_lengthsofar / ( u_dash.x + u_dash.y ) ;\nif ( v_direction == 1.0 ) { v_tex = vec2 ( 1.0 , texcoord_y ) ; } else { v_tex = vec2 ( 0.0 , texcoord_y ) ; }\nvec2 position = a_pos + a_normal * u_width ;\nv_position = position ;\ngl_Position = renderer_MVPMat * vec4 ( position , 0.0 , 1 ) ;\n }"]],"fragmentShaderInstructions":[[0,"uniform float u_width;\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_part;\nvarying vec2 v_tex;\n\nuniform vec4 u_color;\nuniform int u_join;\nuniform int u_cap;\nuniform sampler2D u_texture;\nfloat IS_CAP = 0.0;\nvoid main() { vec4 finalColor ;\nif ( u_cap == 0 && v_part == IS_CAP ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nif ( u_join == 1 && v_part > 1.5 ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nvec4 textureColor = texture2D ( u_texture , v_tex ) ;\nif ( textureColor.a <= 0.5 ) { gl_FragColor = vec4 ( u_color.rgb , 0.0 ) ; } else { gl_FragColor = u_color ; } }"]]}]}]} \ No newline at end of file +{"name":"dash","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"1":0,"2":0,"3":6,"4":6,"5":7,"6":7,"11":false,"25":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_width;\nuniform vec2 u_dash;\nattribute vec2 a_pos;\nattribute vec2 a_normal;\nattribute vec2 a_data;\nattribute float a_lengthsofar;\n\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_direction;\nvarying float v_part;\nvarying vec2 v_tex;\n\nvoid main() { \nv_direction = a_data.x ;\nv_part = a_data.y ;\nfloat layer_index = 1.0 ;\nv_origin = a_pos ;\nfloat texcoord_y = 0.0 ;\ntexcoord_y = a_lengthsofar / ( u_dash.x + u_dash.y ) ;\nif ( v_direction == 1.0 ) { v_tex = vec2 ( 1.0 , texcoord_y ) ; } else { v_tex = vec2 ( 0.0 , texcoord_y ) ; }\nvec2 position = a_pos + a_normal * u_width ;\nv_position = position ;\ngl_Position = renderer_MVPMat * vec4 ( position , 0.0 , 1 ) ;\n }"]],"fragmentShaderInstructions":[[0,"uniform float u_width;\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_part;\nvarying vec2 v_tex;\n\nuniform vec4 u_color;\nuniform int u_join;\nuniform int u_cap;\nuniform sampler2D u_texture;\nfloat IS_CAP = 0.0;\nvoid main() { vec4 finalColor ;\nif ( u_cap == 0 && v_part == IS_CAP ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nif ( u_join == 1 && v_part > 1.5 ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nvec4 textureColor = texture2D ( u_texture , v_tex ) ;\nif ( textureColor.a <= 0.5 ) { gl_FragColor = vec4 ( u_color.rgb , 0.0 ) ; } else { gl_FragColor = u_color ; } }"]]}]}]} \ No newline at end of file diff --git a/packages/lines/libs/line/material/Line.shaderc b/packages/lines/libs/line/material/Line.shaderc index 084991dd..4eae35d8 100644 --- a/packages/lines/libs/line/material/Line.shaderc +++ b/packages/lines/libs/line/material/Line.shaderc @@ -1 +1 @@ -{"name":"line","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_width;\nattribute vec2 a_pos;\nattribute vec2 a_normal;\nattribute vec2 a_data;\n\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_direction;\nvarying float v_part;\n\nvoid main() { \nv_direction = a_data.x ;\nv_part = a_data.y ;\nfloat layer_index = 1.0 ;\nv_origin = a_pos ;\nvec2 position = a_pos + a_normal * u_width ;\nv_position = position ;\ngl_Position = renderer_MVPMat * vec4 ( position , 0.0 , 1 ) ;\n }"]],"fragmentShaderInstructions":[[0,"uniform float u_width;\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_part;\n\nuniform vec4 u_color;\nuniform int u_join;\nuniform int u_cap;\nfloat IS_CAP = 0.0;\nvoid main() { vec4 finalColor ;\nif ( u_cap == 0 && v_part == IS_CAP ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nif ( u_join == 1 && v_part > 1.0 ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\ngl_FragColor = u_color ; }"]]}]}]} \ No newline at end of file +{"name":"line","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"1":0,"2":0,"3":6,"4":6,"5":7,"6":7,"11":false,"25":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_width;\nattribute vec2 a_pos;\nattribute vec2 a_normal;\nattribute vec2 a_data;\n\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_direction;\nvarying float v_part;\n\nvoid main() { \nv_direction = a_data.x ;\nv_part = a_data.y ;\nfloat layer_index = 1.0 ;\nv_origin = a_pos ;\nvec2 position = a_pos + a_normal * u_width ;\nv_position = position ;\ngl_Position = renderer_MVPMat * vec4 ( position , 0.0 , 1 ) ;\n }"]],"fragmentShaderInstructions":[[0,"uniform float u_width;\nvarying vec2 v_origin;\nvarying vec2 v_position;\nvarying float v_part;\n\nuniform vec4 u_color;\nuniform int u_join;\nuniform int u_cap;\nfloat IS_CAP = 0.0;\nvoid main() { vec4 finalColor ;\nif ( u_cap == 0 && v_part == IS_CAP ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\nif ( u_join == 1 && v_part > 1.0 ) { if ( distance ( v_position , v_origin ) > u_width ) { discard ; } }\ngl_FragColor = u_color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/lines/src/line/material/Dash.shader b/packages/lines/src/line/material/Dash.shader index 4d9a71cf..dbce03cd 100644 --- a/packages/lines/src/line/material/Dash.shader +++ b/packages/lines/src/line/material/Dash.shader @@ -1,6 +1,26 @@ Shader "dash" { SubShader "Default" { Pass "Forward" { + DepthState = { + WriteEnabled = false; + } + + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.SourceAlpha; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + ColorBlendOperation = BlendOperation.Add; + AlphaBlendOperation = BlendOperation.Add; + } + + RasterState = { + CullMode = CullMode.Off; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/lines/src/line/material/Line.shader b/packages/lines/src/line/material/Line.shader index 702b725b..45c71d0f 100644 --- a/packages/lines/src/line/material/Line.shader +++ b/packages/lines/src/line/material/Line.shader @@ -1,6 +1,26 @@ Shader "line" { SubShader "Default" { Pass "Forward" { + DepthState = { + WriteEnabled = false; + } + + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.SourceAlpha; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + ColorBlendOperation = BlendOperation.Add; + AlphaBlendOperation = BlendOperation.Add; + } + + RasterState = { + CullMode = CullMode.Off; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/lines/src/line/material/LineMaterial.ts b/packages/lines/src/line/material/LineMaterial.ts index 764eb129..c3bdaa9e 100644 --- a/packages/lines/src/line/material/LineMaterial.ts +++ b/packages/lines/src/line/material/LineMaterial.ts @@ -1,25 +1,12 @@ -import { Material, Shader, Engine, CullMode, RenderQueueType, BlendFactor, BlendOperation } from "@galacean/engine"; +import { Material, Shader, Engine } from "@galacean/engine"; import "./lineShader"; export class LineMaterial extends Material { constructor(engine: Engine) { super(engine, Shader.find("line")); - const { - depthState, - blendState: { targetBlendState }, - rasterState - } = this.renderState; - rasterState.cullMode = CullMode.Off; - depthState.writeEnabled = false; - this.renderState.renderQueueType = RenderQueueType.Transparent; - - targetBlendState.enabled = true; - targetBlendState.sourceColorBlendFactor = BlendFactor.SourceAlpha; - targetBlendState.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; - targetBlendState.sourceAlphaBlendFactor = BlendFactor.SourceAlpha; - targetBlendState.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; - targetBlendState.colorBlendOperation = BlendOperation.Add; - targetBlendState.alphaBlendOperation = BlendOperation.Add; + // Render state (transparent + back-blend + no depth-write + no cull) is + // pinned in Line.shader / Dash.shader's ShaderLab DSL — fixed for all + // line / dash materials, so const blocks suffice. } } From b010ef9f36491a831205cb8a3574de091b453ca3 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 11 May 2026 14:55:23 +0800 Subject: [PATCH 18/27] refactor: register shaders via _createFromPrecompiled at module load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each *Material.ts now imports its precompiled `*Source` from `/libs` barrel and registers via `Shader._createFromPrecompiled` at module top. The split-out `lineShader.ts` / `dashShader.ts` side-effect files are folded into the corresponding `LineMaterial.ts` / `DashMaterial.ts`. `_createFromPrecompiled` only writes to the static `Shader._shaderMap` and doesn't read `Shader._shaderCompiler`, so top-level invocation is safe — no timing dependency on `WebGLEngine.create({ shaderCompiler })`. planar-shadow keeps its multi-pass composition lazy in `_ensureCombinedShader` because that path depends on `Shader.find("PBR")` which requires the engine's ShaderPool to have run. rollup.config.mjs: per-package `shaderCompiler({ filter, precompile })` instances. `pnpm build` / `pnpm watch` auto-runs precompile in `buildStart` and starts a file watcher in watch mode, so editing a `.shader` source regenerates the matching `.shaderc` + barrel without a separate `pnpm precompile` step. --- .../box-selection/BoxSelectionSSMaterial.ts | 5 ++-- .../src/bake-pbr/BakePBRMaterial.ts | 5 ++-- .../custom-material/src/grid/GridMaterial.ts | 5 ++-- .../src/plain-color/PlainColorMaterial.ts | 5 ++-- .../PlanarShadowShaderFactory.ts | 21 ++++++++-------- .../src/water/WaterMaterial.ts | 5 ++-- .../src/water/WaterRippleMaterial.ts | 5 ++-- .../src/water/WaterfallMaterial.ts | 5 ++-- .../src/FramebufferPicker.ts | 5 ++-- .../src/material/TBNMaterial.ts | 5 ++-- .../src/material/WireframeMaterial.ts | 5 ++-- packages/gizmo/src/icon/IconMaterial.ts | 5 ++-- .../lines/src/line/material/DashMaterial.ts | 5 +++- .../lines/src/line/material/LineMaterial.ts | 5 +++- .../lines/src/line/material/dashShader.ts | 5 ---- .../lines/src/line/material/lineShader.ts | 5 ---- packages/outline/src/OutlineManager.ts | 9 ++++--- .../skeleton-viewer/src/SkeletonViewer.ts | 5 ++-- rollup.config.mjs | 25 ++++++++++++++++--- 19 files changed, 81 insertions(+), 54 deletions(-) delete mode 100644 packages/lines/src/line/material/dashShader.ts delete mode 100644 packages/lines/src/line/material/lineShader.ts diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index 78384e4e..7353a045 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -1,8 +1,9 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Vector2, Vector4 } from "@galacean/engine"; -import shaderSource from "./BoxSelection.shader"; +import { BoxSelectionSource } from "../../libs"; -Shader.find("box") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("box") || Shader._createFromPrecompiled(BoxSelectionSource); export class BoxSelectionSSMaterial extends BaseMaterial { private static _borderWidth = ShaderProperty.getByName("u_width"); diff --git a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts index 832eda6f..5928e63c 100644 --- a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts +++ b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts @@ -1,7 +1,8 @@ import { Engine, PBRMaterial, Shader, ShaderProperty, Texture2D } from "@galacean/engine"; -import shaderSource from "./BakePBR.shader"; +import { BakePBRSource } from "../../libs"; -Shader.find("bake-pbr") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("bake-pbr") || Shader._createFromPrecompiled(BakePBRSource); /** * Bake PBR Material. diff --git a/packages/custom-material/src/grid/GridMaterial.ts b/packages/custom-material/src/grid/GridMaterial.ts index e339e6de..b1a26321 100644 --- a/packages/custom-material/src/grid/GridMaterial.ts +++ b/packages/custom-material/src/grid/GridMaterial.ts @@ -1,7 +1,8 @@ import { BaseMaterial, Engine, MathUtil, Shader, ShaderProperty } from "@galacean/engine"; -import shaderSource from "./Grid.shader"; +import { GridSource } from "../../libs"; -Shader.find("grid") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("grid") || Shader._createFromPrecompiled(GridSource); /** * Grid Material. diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index 5dba7981..ace3c273 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -1,7 +1,8 @@ import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; -import shaderSource from "./PlainColor.shader"; +import { PlainColorSource } from "../../libs"; -Shader.find("plain-color") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("plain-color") || Shader._createFromPrecompiled(PlainColorSource); /** * plain color Material. don't effected by light and fog. diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index c6c0e173..1d9da8a2 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -1,6 +1,9 @@ import { Color, Material, Shader, ShaderProperty, Vector3 } from "@galacean/engine"; -import planarShadowOnlySource from "./PlanarShadowOnly.shader"; +import { PlanarShadowOnlySource } from "../../libs"; + +// @ts-ignore +Shader.find("PlanarShadowOnly") || Shader._createFromPrecompiled(PlanarShadowOnlySource); export class PlanarShadowShaderFactory { private static _lightDirProp = ShaderProperty.getByName("u_lightDir"); @@ -8,11 +11,18 @@ export class PlanarShadowShaderFactory { private static _shadowColorProp = ShaderProperty.getByName("u_planarShadowColor"); private static _shadowFalloffProp = ShaderProperty.getByName("u_planarShadowFalloff"); + private static _ensureCombinedShader(): void { + if (Shader.find("planarShadowShader")) return; + const planarShadowPass = Shader.find("PlanarShadowOnly").subShaders[0].passes[0]; + Shader.create("planarShadowShader", [Shader.find("PBR").subShaders[0].passes[2], planarShadowPass]); + } + /** * Replace material Shader and initialization. * @param material - Material to replace and initialization. */ static replaceShader(material: Material) { + PlanarShadowShaderFactory._ensureCombinedShader(); material.shader = Shader.find("planarShadowShader"); // Render state for the shadow pass (queue / blend / depth / stencil) is @@ -60,12 +70,3 @@ export class PlanarShadowShaderFactory { material.shaderData.setFloat(PlanarShadowShaderFactory._shadowFalloffProp, value); } } - -if (!Shader.find("planarShadowShader")) { - // The .shader file precompiles to a standalone Shader; we steal its single - // pass and combine it with PBR's shadow caster pass for the actual material - // shader. - Shader.create(planarShadowOnlySource); - const planarShadowPass = Shader.find("PlanarShadowOnly").subShaders[0].passes[0]; - Shader.create("planarShadowShader", [Shader.find("PBR").subShaders[0].passes[2], planarShadowPass]); -} diff --git a/packages/custom-material/src/water/WaterMaterial.ts b/packages/custom-material/src/water/WaterMaterial.ts index 5885f4f7..0afcd20e 100644 --- a/packages/custom-material/src/water/WaterMaterial.ts +++ b/packages/custom-material/src/water/WaterMaterial.ts @@ -1,7 +1,8 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; -import shaderSource from "./Water.shader"; +import { WaterSource } from "../../libs"; -Shader.find("water") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("water") || Shader._createFromPrecompiled(WaterSource); export class WaterMaterial extends BaseMaterial { private static _waterSpeed = ShaderProperty.getByName("u_water_speed"); diff --git a/packages/custom-material/src/water/WaterRippleMaterial.ts b/packages/custom-material/src/water/WaterRippleMaterial.ts index 1422b245..3925c97b 100644 --- a/packages/custom-material/src/water/WaterRippleMaterial.ts +++ b/packages/custom-material/src/water/WaterRippleMaterial.ts @@ -1,7 +1,8 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector3 } from "@galacean/engine"; -import shaderSource from "./WaterRipple.shader"; +import { WaterRippleSource } from "../../libs"; -Shader.find("water-ripple") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("water-ripple") || Shader._createFromPrecompiled(WaterRippleSource); export class WaterRippleMaterial extends BaseMaterial { private static _foamColor = ShaderProperty.getByName("u_foamColor"); diff --git a/packages/custom-material/src/water/WaterfallMaterial.ts b/packages/custom-material/src/water/WaterfallMaterial.ts index a5f0326d..e9ed27f4 100644 --- a/packages/custom-material/src/water/WaterfallMaterial.ts +++ b/packages/custom-material/src/water/WaterfallMaterial.ts @@ -1,7 +1,8 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; -import shaderSource from "./WaterFall.shader"; +import { WaterFallSource } from "../../libs"; -Shader.find("water-fall") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("water-fall") || Shader._createFromPrecompiled(WaterFallSource); export class WaterFallMaterial extends BaseMaterial { private static _waterSpeed = ShaderProperty.getByName("u_water_speed"); diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index 7ff15943..367a0b0e 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -19,9 +19,10 @@ import { Vector3 } from "@galacean/engine"; -import colorShaderSource from "./FramebufferPickerColor.shader"; +import { FramebufferPickerColorSource } from "../libs"; -const pickShader = Shader.find("framebuffer-picker-color") || Shader.create(colorShaderSource); +// @ts-ignore +const pickShader = Shader.find("framebuffer-picker-color") || Shader._createFromPrecompiled(FramebufferPickerColorSource); pickShader.subShaders.forEach((subShader: SubShader) => { subShader.passes.forEach((pass) => { pass.setTag("spriteDisableBatching", true); diff --git a/packages/geometry-sketch/src/material/TBNMaterial.ts b/packages/geometry-sketch/src/material/TBNMaterial.ts index dca430d7..51d79f6f 100644 --- a/packages/geometry-sketch/src/material/TBNMaterial.ts +++ b/packages/geometry-sketch/src/material/TBNMaterial.ts @@ -1,8 +1,9 @@ import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; -import shaderSource from "./TBN.shader"; +import { TBNSource } from "../../libs"; -Shader.find("tbnShader") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("tbnShader") || Shader._createFromPrecompiled(TBNSource); /** * Material for normal shading diff --git a/packages/geometry-sketch/src/material/WireframeMaterial.ts b/packages/geometry-sketch/src/material/WireframeMaterial.ts index e7cb439a..28f4de8c 100644 --- a/packages/geometry-sketch/src/material/WireframeMaterial.ts +++ b/packages/geometry-sketch/src/material/WireframeMaterial.ts @@ -1,8 +1,9 @@ import { BaseMaterial, Color, Engine, RenderFace, Shader } from "@galacean/engine"; -import shaderSource from "./Wireframe.shader"; +import { WireframeSource } from "../../libs"; -Shader.find("wireframeShader") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("wireframeShader") || Shader._createFromPrecompiled(WireframeSource); export class WireframeMaterial extends BaseMaterial { /** diff --git a/packages/gizmo/src/icon/IconMaterial.ts b/packages/gizmo/src/icon/IconMaterial.ts index 104deb95..c5b3d7ca 100644 --- a/packages/gizmo/src/icon/IconMaterial.ts +++ b/packages/gizmo/src/icon/IconMaterial.ts @@ -1,8 +1,9 @@ import { BaseMaterial, Color, CullMode, Engine, Shader, Texture2D } from "@galacean/engine"; -import shaderSource from "./Icon.shader"; +import { IconSource } from "../../libs"; -Shader.find("icon") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("icon") || Shader._createFromPrecompiled(IconSource); /** * Icon Material. don't effected by light and fog. diff --git a/packages/lines/src/line/material/DashMaterial.ts b/packages/lines/src/line/material/DashMaterial.ts index 2a3f62e1..79449410 100644 --- a/packages/lines/src/line/material/DashMaterial.ts +++ b/packages/lines/src/line/material/DashMaterial.ts @@ -1,6 +1,9 @@ import { Shader, Engine } from "@galacean/engine"; import { LineMaterial } from "./LineMaterial"; -import "./dashShader"; +import { DashSource } from "../../../libs"; + +// @ts-ignore +Shader.find("dash") || Shader._createFromPrecompiled(DashSource); export class DashMaterial extends LineMaterial { constructor(engine: Engine) { diff --git a/packages/lines/src/line/material/LineMaterial.ts b/packages/lines/src/line/material/LineMaterial.ts index c3bdaa9e..4a465c5b 100644 --- a/packages/lines/src/line/material/LineMaterial.ts +++ b/packages/lines/src/line/material/LineMaterial.ts @@ -1,6 +1,9 @@ import { Material, Shader, Engine } from "@galacean/engine"; -import "./lineShader"; +import { LineSource } from "../../../libs"; + +// @ts-ignore +Shader.find("line") || Shader._createFromPrecompiled(LineSource); export class LineMaterial extends Material { constructor(engine: Engine) { diff --git a/packages/lines/src/line/material/dashShader.ts b/packages/lines/src/line/material/dashShader.ts deleted file mode 100644 index 766d0500..00000000 --- a/packages/lines/src/line/material/dashShader.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Shader } from "@galacean/engine"; - -import shaderSource from "./Dash.shader"; - -Shader.find("dash") || Shader.create(shaderSource); diff --git a/packages/lines/src/line/material/lineShader.ts b/packages/lines/src/line/material/lineShader.ts deleted file mode 100644 index 9da47672..00000000 --- a/packages/lines/src/line/material/lineShader.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Shader } from "@galacean/engine"; - -import shaderSource from "./Line.shader"; - -Shader.find("line") || Shader.create(shaderSource); diff --git a/packages/outline/src/OutlineManager.ts b/packages/outline/src/OutlineManager.ts index 76109a4a..4a0d3bd2 100644 --- a/packages/outline/src/OutlineManager.ts +++ b/packages/outline/src/OutlineManager.ts @@ -24,11 +24,12 @@ import { dependentComponents } from "@galacean/engine"; -import outlinePostprocessShaderSource from "./OutlinePostprocess.shader"; -import outlineReplaceShaderSource from "./OutlineReplace.shader"; +import { OutlinePostprocessSource, OutlineReplaceSource } from "../libs"; -Shader.find("outline-postprocess-shader") || Shader.create(outlinePostprocessShaderSource); -Shader.find("outline-replace-shader") || Shader.create(outlineReplaceShaderSource); +// @ts-ignore +Shader.find("outline-postprocess-shader") || Shader._createFromPrecompiled(OutlinePostprocessSource); +// @ts-ignore +Shader.find("outline-replace-shader") || Shader._createFromPrecompiled(OutlineReplaceSource); /** * Show outline of entities. diff --git a/packages/skeleton-viewer/src/SkeletonViewer.ts b/packages/skeleton-viewer/src/SkeletonViewer.ts index e2f5dcb7..0c60ef19 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.ts +++ b/packages/skeleton-viewer/src/SkeletonViewer.ts @@ -14,9 +14,10 @@ import { Vector3 } from "@galacean/engine"; -import shaderSource from "./SkeletonViewer.shader"; +import { SkeletonViewerSource } from "../libs"; -Shader.find("skeleton-viewer") || Shader.create(shaderSource); +// @ts-ignore +Shader.find("skeleton-viewer") || Shader._createFromPrecompiled(SkeletonViewerSource); /** * Skeleton visualization. diff --git a/rollup.config.mjs b/rollup.config.mjs index 9185a935..4487a07a 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -68,12 +68,29 @@ function toGlobalName(pkgName) { const extensions = [".js", ".jsx", ".ts", ".tsx"]; const mainFields = ["module", "main"]; +function hasShaderSource(pkgLocation) { + const srcDir = path.join(pkgLocation, "src"); + if (!fs.existsSync(srcDir)) return false; + return walk(srcDir).some((f) => f && f.endsWith(".shader")); +} + +const shaderPlugins = pkgs + .filter((p) => hasShaderSource(p.location)) + .map((p) => + shaderCompiler({ + filter: (id) => id.startsWith(p.location + path.sep) && /\.(shader|shaderc)$/.test(id), + precompile: { + input: path.join(p.location, "src"), + output: path.join(p.location, "libs"), + clean: true, + emitIndex: true + } + }) + ); + const plugins = [ resolve({ extensions, preferBuiltins: true, mainFields }), - // Transform-only — `.shader`/`.glsl`/`.shaderc` files become string/JSON modules. - // Each package owns its own `precompile` npm script that drives the CLI to - // emit `.shaderc` artifacts under `/libs/`; rollup never runs precompile. - shaderCompiler(), + ...shaderPlugins, swc( defineRollupSwcOption({ include: /\.[mc]?[jt]sx?$/, From 7daf0355aebe8be405deb7c75ee86b109731349f Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 11 May 2026 15:59:33 +0800 Subject: [PATCH 19/27] =?UTF-8?q?refactor:=20rename=20libs/=20=E2=86=92=20?= =?UTF-8?q?compiledShaders/=20to=20match=20engine=20convention?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align with engine's `packages/shader/compiledShaders/` naming so all three repos (engine / engine-toolkit / editor) use the same directory name for precompiled `.shaderc` artifacts. Renames are `git mv` so history follows. Updates 8 packages with shader sources: directory rename, import paths (`../../libs` → `../../compiledShaders`, plus depth variants), `precompile` npm scripts, and the per-package `shaderCompiler` precompile output in rollup.config.mjs. --- .../box-selection/BoxSelection.shaderc | 0 packages/controls/{libs => compiledShaders}/index.ts | 0 packages/controls/package.json | 2 +- packages/controls/src/box-selection/BoxSelectionSSMaterial.ts | 2 +- packages/controls/src/index.ts | 2 +- .../{libs => compiledShaders}/advanced-shader/eye/Eye.shaderc | 0 .../{libs => compiledShaders}/advanced-shader/hair/Hair.shaderc | 0 .../{libs => compiledShaders}/advanced-shader/sss/SSS.shaderc | 0 .../{libs => compiledShaders}/bake-pbr/BakePBR.shaderc | 0 .../custom-material/{libs => compiledShaders}/grid/Grid.shaderc | 0 packages/custom-material/{libs => compiledShaders}/index.ts | 0 .../{libs => compiledShaders}/plain-color/PlainColor.shaderc | 0 .../planar-shadow/PlanarShadow.shaderc | 0 .../planar-shadow/PlanarShadowOnly.shaderc | 0 .../{libs => compiledShaders}/water/Water.shaderc | 0 .../{libs => compiledShaders}/water/WaterFall.shaderc | 0 .../{libs => compiledShaders}/water/WaterRipple.shaderc | 0 packages/custom-material/package.json | 2 +- packages/custom-material/src/bake-pbr/BakePBRMaterial.ts | 2 +- packages/custom-material/src/grid/GridMaterial.ts | 2 +- packages/custom-material/src/index.ts | 2 +- packages/custom-material/src/plain-color/PlainColorMaterial.ts | 2 +- .../src/planar-shadow/PlanarShadowShaderFactory.ts | 2 +- packages/custom-material/src/water/WaterMaterial.ts | 2 +- packages/custom-material/src/water/WaterRippleMaterial.ts | 2 +- packages/custom-material/src/water/WaterfallMaterial.ts | 2 +- .../{libs => compiledShaders}/FramebufferPickerColor.shaderc | 0 packages/framebuffer-picker/{libs => compiledShaders}/index.ts | 0 packages/framebuffer-picker/package.json | 2 +- packages/framebuffer-picker/src/FramebufferPicker.ts | 2 +- packages/framebuffer-picker/src/index.ts | 2 +- packages/geometry-sketch/{libs => compiledShaders}/index.ts | 0 .../{libs => compiledShaders}/material/TBN.shaderc | 0 .../{libs => compiledShaders}/material/Wireframe.shaderc | 0 packages/geometry-sketch/package.json | 2 +- packages/geometry-sketch/src/index.ts | 2 +- packages/geometry-sketch/src/material/TBNMaterial.ts | 2 +- packages/geometry-sketch/src/material/WireframeMaterial.ts | 2 +- packages/gizmo/{libs => compiledShaders}/icon/Icon.shaderc | 0 packages/gizmo/{libs => compiledShaders}/index.ts | 0 packages/gizmo/package.json | 2 +- packages/gizmo/src/icon/IconMaterial.ts | 2 +- packages/gizmo/src/index.ts | 2 +- packages/lines/{libs => compiledShaders}/index.ts | 0 .../lines/{libs => compiledShaders}/line/material/Dash.shaderc | 0 .../lines/{libs => compiledShaders}/line/material/Line.shaderc | 0 packages/lines/package.json | 2 +- packages/lines/src/index.ts | 2 +- packages/lines/src/line/material/DashMaterial.ts | 2 +- packages/lines/src/line/material/LineMaterial.ts | 2 +- .../{libs => compiledShaders}/OutlinePostprocess.shaderc | 0 .../outline/{libs => compiledShaders}/OutlineReplace.shaderc | 0 packages/outline/{libs => compiledShaders}/index.ts | 0 packages/outline/package.json | 2 +- packages/outline/src/OutlineManager.ts | 2 +- packages/outline/src/index.ts | 2 +- .../{libs => compiledShaders}/SkeletonViewer.shaderc | 0 packages/skeleton-viewer/{libs => compiledShaders}/index.ts | 0 packages/skeleton-viewer/package.json | 2 +- packages/skeleton-viewer/src/SkeletonViewer.ts | 2 +- packages/skeleton-viewer/src/index.ts | 2 +- rollup.config.mjs | 2 +- 62 files changed, 33 insertions(+), 33 deletions(-) rename packages/controls/{libs => compiledShaders}/box-selection/BoxSelection.shaderc (100%) rename packages/controls/{libs => compiledShaders}/index.ts (100%) rename packages/custom-material/{libs => compiledShaders}/advanced-shader/eye/Eye.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/advanced-shader/hair/Hair.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/advanced-shader/sss/SSS.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/bake-pbr/BakePBR.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/grid/Grid.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/index.ts (100%) rename packages/custom-material/{libs => compiledShaders}/plain-color/PlainColor.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/planar-shadow/PlanarShadow.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/planar-shadow/PlanarShadowOnly.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/water/Water.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/water/WaterFall.shaderc (100%) rename packages/custom-material/{libs => compiledShaders}/water/WaterRipple.shaderc (100%) rename packages/framebuffer-picker/{libs => compiledShaders}/FramebufferPickerColor.shaderc (100%) rename packages/framebuffer-picker/{libs => compiledShaders}/index.ts (100%) rename packages/geometry-sketch/{libs => compiledShaders}/index.ts (100%) rename packages/geometry-sketch/{libs => compiledShaders}/material/TBN.shaderc (100%) rename packages/geometry-sketch/{libs => compiledShaders}/material/Wireframe.shaderc (100%) rename packages/gizmo/{libs => compiledShaders}/icon/Icon.shaderc (100%) rename packages/gizmo/{libs => compiledShaders}/index.ts (100%) rename packages/lines/{libs => compiledShaders}/index.ts (100%) rename packages/lines/{libs => compiledShaders}/line/material/Dash.shaderc (100%) rename packages/lines/{libs => compiledShaders}/line/material/Line.shaderc (100%) rename packages/outline/{libs => compiledShaders}/OutlinePostprocess.shaderc (100%) rename packages/outline/{libs => compiledShaders}/OutlineReplace.shaderc (100%) rename packages/outline/{libs => compiledShaders}/index.ts (100%) rename packages/skeleton-viewer/{libs => compiledShaders}/SkeletonViewer.shaderc (100%) rename packages/skeleton-viewer/{libs => compiledShaders}/index.ts (100%) diff --git a/packages/controls/libs/box-selection/BoxSelection.shaderc b/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc similarity index 100% rename from packages/controls/libs/box-selection/BoxSelection.shaderc rename to packages/controls/compiledShaders/box-selection/BoxSelection.shaderc diff --git a/packages/controls/libs/index.ts b/packages/controls/compiledShaders/index.ts similarity index 100% rename from packages/controls/libs/index.ts rename to packages/controls/compiledShaders/index.ts diff --git a/packages/controls/package.json b/packages/controls/package.json index 06f89641..8f90536f 100644 --- a/packages/controls/package.json +++ b/packages/controls/package.json @@ -14,7 +14,7 @@ "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index", + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/src/index.d.ts", diff --git a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts index 7353a045..550e2d2f 100644 --- a/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts +++ b/packages/controls/src/box-selection/BoxSelectionSSMaterial.ts @@ -1,6 +1,6 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Vector2, Vector4 } from "@galacean/engine"; -import { BoxSelectionSource } from "../../libs"; +import { BoxSelectionSource } from "../../compiledShaders"; // @ts-ignore Shader.find("box") || Shader._createFromPrecompiled(BoxSelectionSource); diff --git a/packages/controls/src/index.ts b/packages/controls/src/index.ts index 8472dad4..c2b83874 100644 --- a/packages/controls/src/index.ts +++ b/packages/controls/src/index.ts @@ -11,4 +11,4 @@ export { ControlHandlerType } from "./enums/ControlHandlerType"; export type { IControlInput } from "./inputDevice/IControlInput"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/custom-material/libs/advanced-shader/eye/Eye.shaderc b/packages/custom-material/compiledShaders/advanced-shader/eye/Eye.shaderc similarity index 100% rename from packages/custom-material/libs/advanced-shader/eye/Eye.shaderc rename to packages/custom-material/compiledShaders/advanced-shader/eye/Eye.shaderc diff --git a/packages/custom-material/libs/advanced-shader/hair/Hair.shaderc b/packages/custom-material/compiledShaders/advanced-shader/hair/Hair.shaderc similarity index 100% rename from packages/custom-material/libs/advanced-shader/hair/Hair.shaderc rename to packages/custom-material/compiledShaders/advanced-shader/hair/Hair.shaderc diff --git a/packages/custom-material/libs/advanced-shader/sss/SSS.shaderc b/packages/custom-material/compiledShaders/advanced-shader/sss/SSS.shaderc similarity index 100% rename from packages/custom-material/libs/advanced-shader/sss/SSS.shaderc rename to packages/custom-material/compiledShaders/advanced-shader/sss/SSS.shaderc diff --git a/packages/custom-material/libs/bake-pbr/BakePBR.shaderc b/packages/custom-material/compiledShaders/bake-pbr/BakePBR.shaderc similarity index 100% rename from packages/custom-material/libs/bake-pbr/BakePBR.shaderc rename to packages/custom-material/compiledShaders/bake-pbr/BakePBR.shaderc diff --git a/packages/custom-material/libs/grid/Grid.shaderc b/packages/custom-material/compiledShaders/grid/Grid.shaderc similarity index 100% rename from packages/custom-material/libs/grid/Grid.shaderc rename to packages/custom-material/compiledShaders/grid/Grid.shaderc diff --git a/packages/custom-material/libs/index.ts b/packages/custom-material/compiledShaders/index.ts similarity index 100% rename from packages/custom-material/libs/index.ts rename to packages/custom-material/compiledShaders/index.ts diff --git a/packages/custom-material/libs/plain-color/PlainColor.shaderc b/packages/custom-material/compiledShaders/plain-color/PlainColor.shaderc similarity index 100% rename from packages/custom-material/libs/plain-color/PlainColor.shaderc rename to packages/custom-material/compiledShaders/plain-color/PlainColor.shaderc diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadow.shaderc b/packages/custom-material/compiledShaders/planar-shadow/PlanarShadow.shaderc similarity index 100% rename from packages/custom-material/libs/planar-shadow/PlanarShadow.shaderc rename to packages/custom-material/compiledShaders/planar-shadow/PlanarShadow.shaderc diff --git a/packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc b/packages/custom-material/compiledShaders/planar-shadow/PlanarShadowOnly.shaderc similarity index 100% rename from packages/custom-material/libs/planar-shadow/PlanarShadowOnly.shaderc rename to packages/custom-material/compiledShaders/planar-shadow/PlanarShadowOnly.shaderc diff --git a/packages/custom-material/libs/water/Water.shaderc b/packages/custom-material/compiledShaders/water/Water.shaderc similarity index 100% rename from packages/custom-material/libs/water/Water.shaderc rename to packages/custom-material/compiledShaders/water/Water.shaderc diff --git a/packages/custom-material/libs/water/WaterFall.shaderc b/packages/custom-material/compiledShaders/water/WaterFall.shaderc similarity index 100% rename from packages/custom-material/libs/water/WaterFall.shaderc rename to packages/custom-material/compiledShaders/water/WaterFall.shaderc diff --git a/packages/custom-material/libs/water/WaterRipple.shaderc b/packages/custom-material/compiledShaders/water/WaterRipple.shaderc similarity index 100% rename from packages/custom-material/libs/water/WaterRipple.shaderc rename to packages/custom-material/compiledShaders/water/WaterRipple.shaderc diff --git a/packages/custom-material/package.json b/packages/custom-material/package.json index 08b5a4c8..b40be617 100644 --- a/packages/custom-material/package.json +++ b/packages/custom-material/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index", + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "publishConfig": { diff --git a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts index 5928e63c..bf49cf23 100644 --- a/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts +++ b/packages/custom-material/src/bake-pbr/BakePBRMaterial.ts @@ -1,5 +1,5 @@ import { Engine, PBRMaterial, Shader, ShaderProperty, Texture2D } from "@galacean/engine"; -import { BakePBRSource } from "../../libs"; +import { BakePBRSource } from "../../compiledShaders"; // @ts-ignore Shader.find("bake-pbr") || Shader._createFromPrecompiled(BakePBRSource); diff --git a/packages/custom-material/src/grid/GridMaterial.ts b/packages/custom-material/src/grid/GridMaterial.ts index b1a26321..d66a94e5 100644 --- a/packages/custom-material/src/grid/GridMaterial.ts +++ b/packages/custom-material/src/grid/GridMaterial.ts @@ -1,5 +1,5 @@ import { BaseMaterial, Engine, MathUtil, Shader, ShaderProperty } from "@galacean/engine"; -import { GridSource } from "../../libs"; +import { GridSource } from "../../compiledShaders"; // @ts-ignore Shader.find("grid") || Shader._createFromPrecompiled(GridSource); diff --git a/packages/custom-material/src/index.ts b/packages/custom-material/src/index.ts index d0f3bad1..c7293841 100644 --- a/packages/custom-material/src/index.ts +++ b/packages/custom-material/src/index.ts @@ -4,4 +4,4 @@ export * from "./water"; export { BakePBRMaterial } from "./bake-pbr/BakePBRMaterial"; export { PlainColorMaterial } from "./plain-color/PlainColorMaterial"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/custom-material/src/plain-color/PlainColorMaterial.ts b/packages/custom-material/src/plain-color/PlainColorMaterial.ts index ace3c273..22b6c74a 100644 --- a/packages/custom-material/src/plain-color/PlainColorMaterial.ts +++ b/packages/custom-material/src/plain-color/PlainColorMaterial.ts @@ -1,5 +1,5 @@ import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; -import { PlainColorSource } from "../../libs"; +import { PlainColorSource } from "../../compiledShaders"; // @ts-ignore Shader.find("plain-color") || Shader._createFromPrecompiled(PlainColorSource); diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index 1d9da8a2..ecb8a2bf 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -1,6 +1,6 @@ import { Color, Material, Shader, ShaderProperty, Vector3 } from "@galacean/engine"; -import { PlanarShadowOnlySource } from "../../libs"; +import { PlanarShadowOnlySource } from "../../compiledShaders"; // @ts-ignore Shader.find("PlanarShadowOnly") || Shader._createFromPrecompiled(PlanarShadowOnlySource); diff --git a/packages/custom-material/src/water/WaterMaterial.ts b/packages/custom-material/src/water/WaterMaterial.ts index 0afcd20e..24420c99 100644 --- a/packages/custom-material/src/water/WaterMaterial.ts +++ b/packages/custom-material/src/water/WaterMaterial.ts @@ -1,5 +1,5 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; -import { WaterSource } from "../../libs"; +import { WaterSource } from "../../compiledShaders"; // @ts-ignore Shader.find("water") || Shader._createFromPrecompiled(WaterSource); diff --git a/packages/custom-material/src/water/WaterRippleMaterial.ts b/packages/custom-material/src/water/WaterRippleMaterial.ts index 3925c97b..7e80a984 100644 --- a/packages/custom-material/src/water/WaterRippleMaterial.ts +++ b/packages/custom-material/src/water/WaterRippleMaterial.ts @@ -1,5 +1,5 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector3 } from "@galacean/engine"; -import { WaterRippleSource } from "../../libs"; +import { WaterRippleSource } from "../../compiledShaders"; // @ts-ignore Shader.find("water-ripple") || Shader._createFromPrecompiled(WaterRippleSource); diff --git a/packages/custom-material/src/water/WaterfallMaterial.ts b/packages/custom-material/src/water/WaterfallMaterial.ts index e9ed27f4..3f177dd0 100644 --- a/packages/custom-material/src/water/WaterfallMaterial.ts +++ b/packages/custom-material/src/water/WaterfallMaterial.ts @@ -1,5 +1,5 @@ import { BaseMaterial, Engine, Shader, ShaderProperty, Texture2D, Vector2, Vector4 } from "@galacean/engine"; -import { WaterFallSource } from "../../libs"; +import { WaterFallSource } from "../../compiledShaders"; // @ts-ignore Shader.find("water-fall") || Shader._createFromPrecompiled(WaterFallSource); diff --git a/packages/framebuffer-picker/libs/FramebufferPickerColor.shaderc b/packages/framebuffer-picker/compiledShaders/FramebufferPickerColor.shaderc similarity index 100% rename from packages/framebuffer-picker/libs/FramebufferPickerColor.shaderc rename to packages/framebuffer-picker/compiledShaders/FramebufferPickerColor.shaderc diff --git a/packages/framebuffer-picker/libs/index.ts b/packages/framebuffer-picker/compiledShaders/index.ts similarity index 100% rename from packages/framebuffer-picker/libs/index.ts rename to packages/framebuffer-picker/compiledShaders/index.ts diff --git a/packages/framebuffer-picker/package.json b/packages/framebuffer-picker/package.json index 5cee9d86..916aaf18 100755 --- a/packages/framebuffer-picker/package.json +++ b/packages/framebuffer-picker/package.json @@ -16,7 +16,7 @@ "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index" + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index" }, "types": "types/src/index.d.ts", "files": [ diff --git a/packages/framebuffer-picker/src/FramebufferPicker.ts b/packages/framebuffer-picker/src/FramebufferPicker.ts index 367a0b0e..52af9da7 100644 --- a/packages/framebuffer-picker/src/FramebufferPicker.ts +++ b/packages/framebuffer-picker/src/FramebufferPicker.ts @@ -19,7 +19,7 @@ import { Vector3 } from "@galacean/engine"; -import { FramebufferPickerColorSource } from "../libs"; +import { FramebufferPickerColorSource } from "../compiledShaders"; // @ts-ignore const pickShader = Shader.find("framebuffer-picker-color") || Shader._createFromPrecompiled(FramebufferPickerColorSource); diff --git a/packages/framebuffer-picker/src/index.ts b/packages/framebuffer-picker/src/index.ts index cb4dbff6..94065416 100644 --- a/packages/framebuffer-picker/src/index.ts +++ b/packages/framebuffer-picker/src/index.ts @@ -1,3 +1,3 @@ export { FramebufferPicker } from "./FramebufferPicker"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/geometry-sketch/libs/index.ts b/packages/geometry-sketch/compiledShaders/index.ts similarity index 100% rename from packages/geometry-sketch/libs/index.ts rename to packages/geometry-sketch/compiledShaders/index.ts diff --git a/packages/geometry-sketch/libs/material/TBN.shaderc b/packages/geometry-sketch/compiledShaders/material/TBN.shaderc similarity index 100% rename from packages/geometry-sketch/libs/material/TBN.shaderc rename to packages/geometry-sketch/compiledShaders/material/TBN.shaderc diff --git a/packages/geometry-sketch/libs/material/Wireframe.shaderc b/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc similarity index 100% rename from packages/geometry-sketch/libs/material/Wireframe.shaderc rename to packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc diff --git a/packages/geometry-sketch/package.json b/packages/geometry-sketch/package.json index e6e6124f..2efa4d6a 100644 --- a/packages/geometry-sketch/package.json +++ b/packages/geometry-sketch/package.json @@ -14,7 +14,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index", + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/src/index.d.ts", diff --git a/packages/geometry-sketch/src/index.ts b/packages/geometry-sketch/src/index.ts index 45d7c7a1..7d78113d 100644 --- a/packages/geometry-sketch/src/index.ts +++ b/packages/geometry-sketch/src/index.ts @@ -2,4 +2,4 @@ export { SketchMode } from "./SketchMode"; export { SketchRenderer } from "./SketchRenderer"; export { WireframeMaterial, NormalMaterial, TangentMaterial, BiTangentMaterial } from "./material"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/geometry-sketch/src/material/TBNMaterial.ts b/packages/geometry-sketch/src/material/TBNMaterial.ts index 51d79f6f..a269a37c 100644 --- a/packages/geometry-sketch/src/material/TBNMaterial.ts +++ b/packages/geometry-sketch/src/material/TBNMaterial.ts @@ -1,6 +1,6 @@ import { BaseMaterial, Color, Engine, Shader } from "@galacean/engine"; -import { TBNSource } from "../../libs"; +import { TBNSource } from "../../compiledShaders"; // @ts-ignore Shader.find("tbnShader") || Shader._createFromPrecompiled(TBNSource); diff --git a/packages/geometry-sketch/src/material/WireframeMaterial.ts b/packages/geometry-sketch/src/material/WireframeMaterial.ts index 28f4de8c..ffa4d86c 100644 --- a/packages/geometry-sketch/src/material/WireframeMaterial.ts +++ b/packages/geometry-sketch/src/material/WireframeMaterial.ts @@ -1,6 +1,6 @@ import { BaseMaterial, Color, Engine, RenderFace, Shader } from "@galacean/engine"; -import { WireframeSource } from "../../libs"; +import { WireframeSource } from "../../compiledShaders"; // @ts-ignore Shader.find("wireframeShader") || Shader._createFromPrecompiled(WireframeSource); diff --git a/packages/gizmo/libs/icon/Icon.shaderc b/packages/gizmo/compiledShaders/icon/Icon.shaderc similarity index 100% rename from packages/gizmo/libs/icon/Icon.shaderc rename to packages/gizmo/compiledShaders/icon/Icon.shaderc diff --git a/packages/gizmo/libs/index.ts b/packages/gizmo/compiledShaders/index.ts similarity index 100% rename from packages/gizmo/libs/index.ts rename to packages/gizmo/compiledShaders/index.ts diff --git a/packages/gizmo/package.json b/packages/gizmo/package.json index c6d36817..bcb84bc0 100644 --- a/packages/gizmo/package.json +++ b/packages/gizmo/package.json @@ -14,7 +14,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index", + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/src/index.d.ts", diff --git a/packages/gizmo/src/icon/IconMaterial.ts b/packages/gizmo/src/icon/IconMaterial.ts index c5b3d7ca..3e6cc9a7 100644 --- a/packages/gizmo/src/icon/IconMaterial.ts +++ b/packages/gizmo/src/icon/IconMaterial.ts @@ -1,6 +1,6 @@ import { BaseMaterial, Color, CullMode, Engine, Shader, Texture2D } from "@galacean/engine"; -import { IconSource } from "../../libs"; +import { IconSource } from "../../compiledShaders"; // @ts-ignore Shader.find("icon") || Shader._createFromPrecompiled(IconSource); diff --git a/packages/gizmo/src/index.ts b/packages/gizmo/src/index.ts index 77ffe89e..25e5ef7a 100644 --- a/packages/gizmo/src/index.ts +++ b/packages/gizmo/src/index.ts @@ -4,4 +4,4 @@ export { Group } from "./Group"; export { State } from "./enums/GizmoState"; export { AnchorType, CoordinateType } from "./enums/GroupState"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/lines/libs/index.ts b/packages/lines/compiledShaders/index.ts similarity index 100% rename from packages/lines/libs/index.ts rename to packages/lines/compiledShaders/index.ts diff --git a/packages/lines/libs/line/material/Dash.shaderc b/packages/lines/compiledShaders/line/material/Dash.shaderc similarity index 100% rename from packages/lines/libs/line/material/Dash.shaderc rename to packages/lines/compiledShaders/line/material/Dash.shaderc diff --git a/packages/lines/libs/line/material/Line.shaderc b/packages/lines/compiledShaders/line/material/Line.shaderc similarity index 100% rename from packages/lines/libs/line/material/Line.shaderc rename to packages/lines/compiledShaders/line/material/Line.shaderc diff --git a/packages/lines/package.json b/packages/lines/package.json index ca9efe24..11a39211 100644 --- a/packages/lines/package.json +++ b/packages/lines/package.json @@ -14,7 +14,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index", + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index", "lint:fix": "tslint --fix --project ./tsconfig.json" }, "types": "types/src/index.d.ts", diff --git a/packages/lines/src/index.ts b/packages/lines/src/index.ts index 1a85051f..4a3125d8 100644 --- a/packages/lines/src/index.ts +++ b/packages/lines/src/index.ts @@ -2,4 +2,4 @@ export * from "./line/constants"; export { DashLine } from "./line/DashLine"; export { Line } from "./line/Line"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/lines/src/line/material/DashMaterial.ts b/packages/lines/src/line/material/DashMaterial.ts index 79449410..e4ba5905 100644 --- a/packages/lines/src/line/material/DashMaterial.ts +++ b/packages/lines/src/line/material/DashMaterial.ts @@ -1,6 +1,6 @@ import { Shader, Engine } from "@galacean/engine"; import { LineMaterial } from "./LineMaterial"; -import { DashSource } from "../../../libs"; +import { DashSource } from "../../../compiledShaders"; // @ts-ignore Shader.find("dash") || Shader._createFromPrecompiled(DashSource); diff --git a/packages/lines/src/line/material/LineMaterial.ts b/packages/lines/src/line/material/LineMaterial.ts index 4a465c5b..756fc9fa 100644 --- a/packages/lines/src/line/material/LineMaterial.ts +++ b/packages/lines/src/line/material/LineMaterial.ts @@ -1,6 +1,6 @@ import { Material, Shader, Engine } from "@galacean/engine"; -import { LineSource } from "../../../libs"; +import { LineSource } from "../../../compiledShaders"; // @ts-ignore Shader.find("line") || Shader._createFromPrecompiled(LineSource); diff --git a/packages/outline/libs/OutlinePostprocess.shaderc b/packages/outline/compiledShaders/OutlinePostprocess.shaderc similarity index 100% rename from packages/outline/libs/OutlinePostprocess.shaderc rename to packages/outline/compiledShaders/OutlinePostprocess.shaderc diff --git a/packages/outline/libs/OutlineReplace.shaderc b/packages/outline/compiledShaders/OutlineReplace.shaderc similarity index 100% rename from packages/outline/libs/OutlineReplace.shaderc rename to packages/outline/compiledShaders/OutlineReplace.shaderc diff --git a/packages/outline/libs/index.ts b/packages/outline/compiledShaders/index.ts similarity index 100% rename from packages/outline/libs/index.ts rename to packages/outline/compiledShaders/index.ts diff --git a/packages/outline/package.json b/packages/outline/package.json index 2f8491e9..add9067a 100755 --- a/packages/outline/package.json +++ b/packages/outline/package.json @@ -16,7 +16,7 @@ "bugs": "https://github.com/galacean/engine-toolkit/issues", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index" + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index" }, "types": "types/src/index.d.ts", "files": [ diff --git a/packages/outline/src/OutlineManager.ts b/packages/outline/src/OutlineManager.ts index 4a0d3bd2..2af95827 100644 --- a/packages/outline/src/OutlineManager.ts +++ b/packages/outline/src/OutlineManager.ts @@ -24,7 +24,7 @@ import { dependentComponents } from "@galacean/engine"; -import { OutlinePostprocessSource, OutlineReplaceSource } from "../libs"; +import { OutlinePostprocessSource, OutlineReplaceSource } from "../compiledShaders"; // @ts-ignore Shader.find("outline-postprocess-shader") || Shader._createFromPrecompiled(OutlinePostprocessSource); diff --git a/packages/outline/src/index.ts b/packages/outline/src/index.ts index 94d5afbb..0c43a241 100644 --- a/packages/outline/src/index.ts +++ b/packages/outline/src/index.ts @@ -1,3 +1,3 @@ export { OutlineManager } from "./OutlineManager"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/packages/skeleton-viewer/libs/SkeletonViewer.shaderc b/packages/skeleton-viewer/compiledShaders/SkeletonViewer.shaderc similarity index 100% rename from packages/skeleton-viewer/libs/SkeletonViewer.shaderc rename to packages/skeleton-viewer/compiledShaders/SkeletonViewer.shaderc diff --git a/packages/skeleton-viewer/libs/index.ts b/packages/skeleton-viewer/compiledShaders/index.ts similarity index 100% rename from packages/skeleton-viewer/libs/index.ts rename to packages/skeleton-viewer/compiledShaders/index.ts diff --git a/packages/skeleton-viewer/package.json b/packages/skeleton-viewer/package.json index 3f82cc09..9e701382 100755 --- a/packages/skeleton-viewer/package.json +++ b/packages/skeleton-viewer/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "b:types": "tsc", - "precompile": "shader-compiler-precompile src libs --clean --emit-index" + "precompile": "shader-compiler-precompile src compiledShaders --clean --emit-index" }, "publishConfig": { "access": "public", diff --git a/packages/skeleton-viewer/src/SkeletonViewer.ts b/packages/skeleton-viewer/src/SkeletonViewer.ts index 0c60ef19..d71946d4 100644 --- a/packages/skeleton-viewer/src/SkeletonViewer.ts +++ b/packages/skeleton-viewer/src/SkeletonViewer.ts @@ -14,7 +14,7 @@ import { Vector3 } from "@galacean/engine"; -import { SkeletonViewerSource } from "../libs"; +import { SkeletonViewerSource } from "../compiledShaders"; // @ts-ignore Shader.find("skeleton-viewer") || Shader._createFromPrecompiled(SkeletonViewerSource); diff --git a/packages/skeleton-viewer/src/index.ts b/packages/skeleton-viewer/src/index.ts index 0efe9c23..d905c13a 100644 --- a/packages/skeleton-viewer/src/index.ts +++ b/packages/skeleton-viewer/src/index.ts @@ -1,3 +1,3 @@ export { SkeletonViewer } from "./SkeletonViewer"; -export * from "../libs"; +export * from "../compiledShaders"; diff --git a/rollup.config.mjs b/rollup.config.mjs index 4487a07a..408cb924 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -81,7 +81,7 @@ const shaderPlugins = pkgs filter: (id) => id.startsWith(p.location + path.sep) && /\.(shader|shaderc)$/.test(id), precompile: { input: path.join(p.location, "src"), - output: path.join(p.location, "libs"), + output: path.join(p.location, "compiledShaders"), clean: true, emitIndex: true } From e41d51ec71341fe18dc08099826a59271e2b089f Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 11 May 2026 16:04:45 +0800 Subject: [PATCH 20/27] fix(custom-material): align UsePass references with engine PascalCase shader names --- packages/custom-material/src/advanced-shader/eye/Eye.shader | 2 +- packages/custom-material/src/advanced-shader/hair/Hair.shader | 2 +- packages/custom-material/src/advanced-shader/sss/SSS.shader | 2 +- packages/custom-material/src/planar-shadow/PlanarShadow.shader | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/custom-material/src/advanced-shader/eye/Eye.shader b/packages/custom-material/src/advanced-shader/eye/Eye.shader index b2bfe416..b039d40e 100644 --- a/packages/custom-material/src/advanced-shader/eye/Eye.shader +++ b/packages/custom-material/src/advanced-shader/eye/Eye.shader @@ -41,7 +41,7 @@ Shader "DigitalHuman/Eye.gs" { } SubShader "Default" { - UsePass "pbr/Default/ShadowCaster" + UsePass "Pipeline/ShadowCaster/Default/ShadowCaster" Pass "Forward Pass" { Tags { pipelineStage = "Forward"} diff --git a/packages/custom-material/src/advanced-shader/hair/Hair.shader b/packages/custom-material/src/advanced-shader/hair/Hair.shader index 9f67b5e9..45bd3aea 100644 --- a/packages/custom-material/src/advanced-shader/hair/Hair.shader +++ b/packages/custom-material/src/advanced-shader/hair/Hair.shader @@ -61,7 +61,7 @@ Shader "DigitalHuman/Hair.gs" { SubShader "Default" { - UsePass "pbr/Default/ShadowCaster" + UsePass "Pipeline/ShadowCaster/Default/ShadowCaster" Pass "Forward Pass" { Tags { pipelineStage = "Forward"} diff --git a/packages/custom-material/src/advanced-shader/sss/SSS.shader b/packages/custom-material/src/advanced-shader/sss/SSS.shader index 95be9450..0b1a6df2 100644 --- a/packages/custom-material/src/advanced-shader/sss/SSS.shader +++ b/packages/custom-material/src/advanced-shader/sss/SSS.shader @@ -54,7 +54,7 @@ Shader "DigitalHuman/SSS.gs" { } SubShader "Default" { - UsePass "pbr/Default/ShadowCaster" + UsePass "Pipeline/ShadowCaster/Default/ShadowCaster" Pass "Forward Pass" { Tags { pipelineStage = "Forward"} diff --git a/packages/custom-material/src/planar-shadow/PlanarShadow.shader b/packages/custom-material/src/planar-shadow/PlanarShadow.shader index 346e2292..7bbec16c 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadow.shader +++ b/packages/custom-material/src/planar-shadow/PlanarShadow.shader @@ -2,7 +2,7 @@ Shader "PlanarShadow" { SubShader "Default" { - UsePass "pbr/Default/Forward" + UsePass "PBR/Default/Forward Pass" Pass "planarShadow" { VertexShader = vert; From 8d204f646d987c3171a5b6cd0278c9e4a0502ca7 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Wed, 13 May 2026 14:42:10 +0800 Subject: [PATCH 21/27] build: regenerate compiledShaders against current shader-compiler Engine moved shader-compiler bundler outputs out of dist/ (CDN sync was 405-rejecting Node-only files under dist/bundler/). Regenerate all toolkit .shaderc artifacts so they track the current shader compiler output. --- .../controls/compiledShaders/box-selection/BoxSelection.shaderc | 2 +- .../compiledShaders/advanced-shader/eye/Eye.shaderc | 2 +- .../compiledShaders/advanced-shader/hair/Hair.shaderc | 2 +- .../compiledShaders/advanced-shader/sss/SSS.shaderc | 2 +- .../custom-material/compiledShaders/bake-pbr/BakePBR.shaderc | 2 +- packages/custom-material/compiledShaders/grid/Grid.shaderc | 2 +- .../compiledShaders/plain-color/PlainColor.shaderc | 2 +- .../compiledShaders/planar-shadow/PlanarShadow.shaderc | 2 +- packages/custom-material/compiledShaders/water/Water.shaderc | 2 +- .../custom-material/compiledShaders/water/WaterFall.shaderc | 2 +- .../custom-material/compiledShaders/water/WaterRipple.shaderc | 2 +- .../compiledShaders/FramebufferPickerColor.shaderc | 2 +- packages/geometry-sketch/compiledShaders/material/TBN.shaderc | 2 +- .../geometry-sketch/compiledShaders/material/Wireframe.shaderc | 2 +- packages/gizmo/compiledShaders/icon/Icon.shaderc | 2 +- packages/outline/compiledShaders/OutlinePostprocess.shaderc | 2 +- packages/outline/compiledShaders/OutlineReplace.shaderc | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc b/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc index a3fafb1f..ff90651f 100644 --- a/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc +++ b/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc @@ -1 +1 @@ -{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file +{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/advanced-shader/eye/Eye.shaderc b/packages/custom-material/compiledShaders/advanced-shader/eye/Eye.shaderc index 2ba2857c..99226d30 100644 --- a/packages/custom-material/compiledShaders/advanced-shader/eye/Eye.shaderc +++ b/packages/custom-material/compiledShaders/advanced-shader/eye/Eye.shaderc @@ -1 +1 @@ -{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",534],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",282],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",144],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",150],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",156],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",162],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",168],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",220],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",182],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",180],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",190],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",194],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",198],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",202],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",206],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",210],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",214],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",218],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",262],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",228],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",236],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",244],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",252],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",250],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",256],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",260],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",268],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",280],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",318],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",292],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",298],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",304],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",310],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",316],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",380],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,326],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",334],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",332],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",342],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",340],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",354],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",352],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",350],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",366],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},364],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",362],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},374],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",372],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,378],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",488],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",390],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",394],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",398],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",414],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",408],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",412],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",422],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",420],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",434],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",428],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",446],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",440],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",444],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",462],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",452],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",460],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",458],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",470],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",486],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",492],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",496],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",500],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",504],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",508],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",512],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",516],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,520],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",528],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",526],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},532],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",641],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",268],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",106],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",112],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",118],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",124],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",130],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",206],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",144],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",142],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",152],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",156],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",160],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",164],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",168],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",172],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",176],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",192],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",196],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",200],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",204],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",248],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",214],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",222],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",220],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",230],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",228],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",238],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",236],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",242],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",246],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",254],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",258],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",266],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",304],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",278],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",284],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",290],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",296],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",302],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",310],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",561],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",326],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",322],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,324],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",330],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",334],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",350],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",340],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",344],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",348],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",358],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",356],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",370],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",364],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",368],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",382],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",376],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",380],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",398],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",388],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",396],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",394],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",402],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",406],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",410],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",414],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",418],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",422],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",426],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",430],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",434],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",438],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",442],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",446],[0," surfaceData.opacity = baseColor.a ; \n"],[5,448],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",452],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,454],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",458],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,463],[1,"HAS_DERIVATIVES",461],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,463],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",477],[0," \n"],[1,"NEED_VERTEX_TANGENT",469],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,471],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",475],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",481],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",485],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",503],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",491],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,493],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",497],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",501],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",511],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",509],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",525],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",517],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,519],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",523],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",537],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",531],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",535],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",553],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",543],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",551],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",549],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",557],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,559],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",565],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",569],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",573],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",577],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",581],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",585],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,587],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",591],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,593],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",597],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",601],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,603],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",607],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,609],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",613],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,615],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},619],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",623],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,625],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},635],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,631],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,633],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,639],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file +{"name":"DigitalHuman/Eye.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Pipeline/ShadowCaster/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",534],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",282],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",144],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",150],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",156],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",162],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",168],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",220],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",182],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",180],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",190],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",194],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",198],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",202],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",206],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",210],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",214],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",218],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",262],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",228],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",236],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",234],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",244],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",252],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",250],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",256],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",260],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",268],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",280],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",318],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",292],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",298],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",304],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",310],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",316],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",380],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,326],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",334],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",332],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",342],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",340],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",354],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",352],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",350],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",366],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},364],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",362],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},374],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",372],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,378],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",488],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",390],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",394],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",398],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",414],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",404],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",408],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",412],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",422],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",420],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",434],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",428],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",432],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",446],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",440],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",444],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",462],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",452],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",460],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",458],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",470],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",478],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",486],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",492],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",496],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",500],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",504],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",508],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = TEXCOORD_0 ;\n\n"],[1,"RENDERER_HAS_UV1",512],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",516],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,520],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",528],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",526],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},532],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",641],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,38],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",268],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",106],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",112],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",118],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",124],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",130],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",206],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",144],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",142],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",152],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",156],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",160],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",164],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",168],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",172],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",176],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",180],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",188],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",192],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",196],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",200],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",204],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",248],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",214],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",222],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",220],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",230],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",228],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",238],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",236],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",242],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",246],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",254],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",258],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",266],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",304],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",278],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",284],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",290],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",296],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",302],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",310],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",561],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",326],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",322],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,324],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",330],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",334],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",350],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",340],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",344],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",348],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",358],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",356],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",370],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",364],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",368],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",382],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",376],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",380],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",398],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",388],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",396],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",394],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",402],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",406],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",410],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",414],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",418],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",422],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",426],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",430],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",434],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",438],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",442],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",446],[0," surfaceData.opacity = baseColor.a ; \n"],[5,448],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",452],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,454],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",458],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,463],[1,"HAS_DERIVATIVES",461],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,463],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",477],[0," \n"],[1,"NEED_VERTEX_TANGENT",469],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,471],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",475],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",481],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",485],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",503],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",491],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,493],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",497],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",501],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",511],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",509],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",525],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",517],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,519],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",523],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",537],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",531],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",535],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",553],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",543],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",551],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",549],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",557],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,559],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nuniform float material_ScleraSize;\nuniform float material_IrisSize;\nuniform vec2 material_PupilSize;\nuniform float material_Limbal;\nuniform float material_Parallax;\nuniform float material_ScleraNormalStrength;\nuniform float material_IrisNormalStrength;\nuniform vec4 material_ScleraColor;\nuniform vec4 material_IrisColor;\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",565],[0,"\nuniform sampler2D material_ScleraNormal;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",569],[0,"\nuniform sampler2D material_ScleraTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",573],[0,"\nuniform sampler2D material_ScleraMask;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",577],[0,"\nuniform sampler2D material_IrisTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",581],[0,"\nuniform sampler2D material_IrisNormal;\n\n"],[6],[0,"\nvec2 parallaxOffset ( float heighttex, float height, vec3 viewDir ) { float heightTex = heighttex * height - height / 2.0 ;\nvec3 s = viewDir ;\ns.z += 0.42 ;\nreturn heightTex * ( s.xy / s.z ) ; }\nvec3 calculateEyeColor ( mat3 tbn, SurfaceData surfaceData ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_TEXTURE",585],[0," vec4 scleraColor = texture2D ( material_ScleraTexture , scleraUV ) ;\nscleraColor *= material_ScleraColor ; \n"],[5,587],[0," vec4 scleraColor = vec4 ( 1.0 ) ; \n"],[6],[0,"\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\nfloat irisSize = material_IrisSize * 0.6 ;\nvec2 pupilSize = mix ( vec2 ( mix ( 0.5 , 0.2 , irisSize / 5.0 ) ) , vec2 ( mix ( 1.2 , 0.75 , irisSize / 5.0 ) ) , material_PupilSize.xy ) ;\nvec2 parallaxUV = mix ( ( uv * 0.75 ) - ( ( 0.75 - 1.0 ) / 2.0 ) , ( uv * pupilSize ) - ( ( pupilSize - 1.0 ) / 2.0 ) , uv ) ;\nfloat heighttexture = 0.0 ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",591],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ;\nfloat uvmask = 1.0 - ( texture2D ( material_ScleraMask , uv ) ).b ;\nheighttexture = ( texture2D ( material_ScleraMask , parallaxUV ) ).b ; \n"],[5,593],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ;\nfloat uvmask = 1.0 ;\nheighttexture = 1.0 ; \n"],[6],[0,"\nvec3 vDir = surfaceData.viewDir ;\nvec3 viewDirInTBN = tbn * vDir ;\nvec2 offset = parallaxOffset(heighttexture, material_Parallax, viewDirInTBN) ;\nvec2 irisUV = ( uv * irisSize ) - ( ( irisSize - 1.0 ) / 2.0 ) ;\nvec2 pupilUV = irisUV * ( ( - 1.0 + ( uvmask * pupilSize ) ) ) - ( 0.5 * ( uvmask * pupilSize ) ) ;\nvec4 parallax = vec4 ( 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_IRIS_TEXTURE",597],[0," parallax = texture2D ( material_IrisTexture , pupilUV - offset ) ;\nparallax.rgb *= material_IrisColor.rgb ; \n"],[6],[0,"\nvec4 baseColor = mix ( scleraColor , parallax , irisMaskTex.r ) ;\nvec4 limbalstrength = ( 0.0 - ( material_Limbal * 10.0 ) ) * baseColor ;\nfloat limbalRadius = saturate(irisMaskTex.g * ( 1.0 - irisMaskTex.r )) ;\nbaseColor = mix ( baseColor , limbalstrength , limbalRadius ) ;\nreturn baseColor.rgb ; }\nvec3 calculateEyeNormal ( mat3 tbn, bool isFrontFacing ) { vec2 scleraUV = ( uv * material_ScleraSize ) - ( ( material_ScleraSize - 1.0 ) / 2.0 ) ;\nvec2 irisSizeUV = ( uv * material_IrisSize ) - ( ( material_IrisSize - 1.0 ) / 2.0 ) ;\n\n"],[1,"MATERIAL_HAS_SCLERA_MASK",601],[0," vec3 irisMaskTex = ( texture2D ( material_ScleraMask , irisSizeUV ) ).rgb ; \n"],[5,603],[0," vec3 irisMaskTex = vec3 ( 1.0 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SCLERA_NORMAL",607],[0," vec3 scleraNormal = getNormalByNormalTexture(tbn, material_ScleraNormal, material_ScleraNormalStrength, scleraUV, isFrontFacing) ; \n"],[5,609],[0," vec3 scleraNormal = tbn[2] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIS_NORMAL",613],[0," vec3 irisNormal = getNormalByNormalTexture(tbn, material_IrisNormal, material_IrisNormalStrength, irisSizeUV, isFrontFacing) ; \n"],[5,615],[0," vec3 irisNormal = tbn[2] ; \n"],[6],[0,"\nreturn mix ( scleraNormal , irisNormal , irisMaskTex.r ) ; }\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},619],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\n\n"],[1,"RENDERER_HAS_TANGENT",623],[0," mat3 tbn = mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) ; \n"],[5,625],[0," mat3 tbn = getTBNByDerivatives(aoUV, surfaceData.normal, positionWS, gl_FrontFacing) ; \n"],[6],[0,"\nsurfaceData.albedoColor = calculateEyeColor(tbn, surfaceData) ;\nsurfaceData.normal = calculateEyeNormal(tbn, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},635],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,631],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,633],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,639],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/advanced-shader/hair/Hair.shaderc b/packages/custom-material/compiledShaders/advanced-shader/hair/Hair.shaderc index e92093af..f8ae516a 100644 --- a/packages/custom-material/compiledShaders/advanced-shader/hair/Hair.shaderc +++ b/packages/custom-material/compiledShaders/advanced-shader/hair/Hair.shaderc @@ -1 +1 @@ -{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",576],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",188],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",186],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",192],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",340],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",202],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",208],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",214],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",220],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",226],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",278],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",240],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",238],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",248],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",252],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",256],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",260],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",276],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",320],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",294],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",292],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",302],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",300],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",310],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",314],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",326],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",330],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",334],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",338],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",376],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",350],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",356],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",362],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",368],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",374],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",442],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,384],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",392],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",390],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",396],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",404],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",402],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",416],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",414],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",412],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",428],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},426],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",424],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},436],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",434],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,440],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",550],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",452],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",456],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",460],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",476],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",470],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",484],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",496],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",490],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",494],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",508],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",506],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",524],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",514],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",522],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",528],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",536],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",540],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",544],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",548],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",554],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",558],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,562],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",570],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",568],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},574],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",663],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",174],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",120],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",124],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",128],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",132],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",136],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",140],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",144],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",148],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",152],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",156],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",160],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",172],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",178],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",350],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",188],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",194],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",200],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",206],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",212],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",288],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",226],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",224],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",234],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",238],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",242],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",246],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",250],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",254],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",258],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",286],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",330],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",296],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",304],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",302],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",312],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",310],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",320],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",324],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",328],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",336],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",340],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",344],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",348],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",386],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",360],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",366],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",372],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",378],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",384],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",392],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",643],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",408],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",404],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,406],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",412],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",416],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",432],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",422],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",426],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",430],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",440],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",438],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",452],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",446],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",450],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",464],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",458],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",462],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",480],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",470],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",478],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",476],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",484],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",488],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",492],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",496],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",500],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",504],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",508],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",512],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",516],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",520],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",524],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",528],[0," surfaceData.opacity = baseColor.a ; \n"],[5,530],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",534],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,536],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",540],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,545],[1,"HAS_DERIVATIVES",543],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,545],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",559],[0," \n"],[1,"NEED_VERTEX_TANGENT",551],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,553],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",557],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",563],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",567],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",585],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",573],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,575],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",579],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",583],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",593],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",591],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",607],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",599],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,601],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",605],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",619],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",613],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",617],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",635],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",625],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",633],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",631],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",639],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,641],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},647],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},657],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,653],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,655],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,661],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file +{"name":"DigitalHuman/Hair.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Pipeline/ShadowCaster/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",576],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",188],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",186],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",192],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",340],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",202],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",208],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",214],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",220],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",226],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",278],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",240],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",238],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",248],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",252],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",256],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",260],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",264],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",276],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",320],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",286],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",294],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",292],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",302],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",300],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",310],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",314],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",326],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",330],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",334],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",338],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",376],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",350],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",356],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",362],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",368],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",374],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",442],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,384],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",392],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",390],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",396],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",404],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",402],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",416],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",414],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",412],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",428],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},426],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",424],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},436],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",434],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,440],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",550],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",452],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",456],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",460],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",476],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",470],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",474],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",484],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",482],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",496],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",490],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",494],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",508],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",506],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",524],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",514],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",522],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",528],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",536],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",540],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",544],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",548],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",554],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",558],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,562],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",570],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",568],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},574],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",663],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,38],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobehair"],[0,"\n\n"],[2,"BSDF_INCLUDED",174],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",120],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",124],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",128],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",132],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",136],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",140],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",144],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",148],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",152],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",156],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",160],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",172],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_HAIRANISOTROPY_TEXTURE",178],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",350],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",188],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",194],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",200],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",206],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",212],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",288],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",226],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",224],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",234],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",238],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",242],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",246],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",250],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",254],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",258],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",286],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",330],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",296],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",304],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",302],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",312],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",310],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",320],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",318],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",324],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",328],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",336],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",340],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",344],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",348],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",386],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",360],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",366],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",372],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",378],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",384],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",392],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",643],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",408],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",404],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,406],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",412],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",416],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",432],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",422],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",426],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",430],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",440],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",438],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",452],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",446],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",450],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",464],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",458],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",462],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",480],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",470],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",478],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",476],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",484],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",488],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",492],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",496],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",500],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",504],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",508],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",512],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",516],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",520],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",524],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",528],[0," surfaceData.opacity = baseColor.a ; \n"],[5,530],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",534],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,536],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",540],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,545],[1,"HAS_DERIVATIVES",543],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,545],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",559],[0," \n"],[1,"NEED_VERTEX_TANGENT",551],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,553],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",557],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",563],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",567],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",585],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",573],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,575],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",579],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",583],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",593],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",591],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",607],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",599],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,601],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",605],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",619],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",613],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",617],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",635],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",625],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",633],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",631],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",639],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,641],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},647],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},657],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,653],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,655],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,661],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/advanced-shader/sss/SSS.shaderc b/packages/custom-material/compiledShaders/advanced-shader/sss/SSS.shaderc index 402d9ec8..d21d4eaa 100644 --- a/packages/custom-material/compiledShaders/advanced-shader/sss/SSS.shaderc +++ b/packages/custom-material/compiledShaders/advanced-shader/sss/SSS.shaderc @@ -1 +1 @@ -{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",582],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",188],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",178],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",182],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",186],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",194],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",198],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",346],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",208],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",214],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",220],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",226],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",232],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",284],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",246],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",244],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",254],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",258],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",262],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",266],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",270],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",274],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",278],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",282],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",326],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",292],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",300],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",298],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",308],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",306],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",316],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",314],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",320],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",324],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",332],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",336],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",340],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",344],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",382],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",356],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",362],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",368],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",374],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",380],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",448],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,390],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",398],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",396],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",402],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",410],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",408],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",422],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",420],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",418],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",434],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},432],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",430],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},442],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",440],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,446],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",556],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",458],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",462],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",466],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",482],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",476],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",480],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",490],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",488],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",502],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",496],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",500],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",514],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",508],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",512],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",530],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",520],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",528],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",526],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",534],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",538],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",542],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",546],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",550],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",554],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",560],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",564],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,568],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",576],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",574],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},580],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",669],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,38],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",174],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",120],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",124],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",128],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",132],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",136],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",140],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",144],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",148],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",152],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",156],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",160],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",164],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",168],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",172],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",180],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",184],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",356],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",194],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",200],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",206],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",212],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",218],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",294],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",232],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",230],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",240],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",244],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",248],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",252],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",256],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",260],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",264],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",268],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",272],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",276],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",280],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",284],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",288],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",292],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",336],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",302],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",310],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",308],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",318],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",316],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",326],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",324],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",330],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",334],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",342],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",346],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",350],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",354],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",392],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",366],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",372],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",378],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",384],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",390],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",398],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",649],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",414],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",410],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,412],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",418],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",422],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",438],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",428],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",432],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",436],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",446],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",444],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",458],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",452],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",456],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",470],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",464],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",468],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",486],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",476],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",484],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",482],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",490],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",494],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",498],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",502],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",506],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",510],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",514],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",518],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",522],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",526],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",530],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",534],[0," surfaceData.opacity = baseColor.a ; \n"],[5,536],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",540],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,542],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",546],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,551],[1,"HAS_DERIVATIVES",549],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,551],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",565],[0," \n"],[1,"NEED_VERTEX_TANGENT",557],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,559],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",563],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",569],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",573],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",591],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",579],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,581],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",585],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",589],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",599],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",597],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",613],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",605],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,607],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",611],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",625],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",619],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",623],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",641],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",631],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",639],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",637],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",645],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,647],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},653],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},663],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,659],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,661],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,667],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file +{"name":"DigitalHuman/SSS.gs","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Pipeline/ShadowCaster/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",618],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",46],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,44],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",104],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",76],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},58],[0,"\n"],[5,74],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",64],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",68],[0,"\n"],[6],[0,"\n"],[5,72],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",82],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",86],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",90],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",94],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",98],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",102],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",134],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",112],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",116],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,120],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",128],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",126],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},132],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",198],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",150],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",148],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",158],[0,"\n\n"],[6],[0,"\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",162],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",166],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",170],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",174],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",178],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,180],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",184],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",188],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",192],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",196],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",212],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",206],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",210],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",216],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",382],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",226],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",232],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",238],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",244],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",250],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",312],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",264],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",262],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",272],[0,"\n\n"],[6],[0,"\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",276],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",280],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",284],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",288],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",292],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,294],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",298],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",302],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",306],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",310],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",354],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",320],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",328],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",326],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",336],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",334],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",344],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",342],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",348],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",352],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",368],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",362],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",366],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",372],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",376],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",380],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",418],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",392],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",398],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",404],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",410],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",416],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",484],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,426],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",434],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",432],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",438],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",446],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",444],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",458],[0," calculateBlendShape ( attributes , position \n"],[1,"RENDERER_HAS_NORMAL",456],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",454],[0," , tangent \n"],[6],[0," \n"],[6],[0," ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",470],[0," mat4 skinMatrix = getSkinMatrix ( attributes ) ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},468],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",466],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},478],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",476],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,482],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",592],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",494],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",498],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",502],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",518],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",508],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",512],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",516],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",526],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",524],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",538],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",532],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",536],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",550],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",544],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",548],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",566],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",556],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",564],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",562],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",570],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",574],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",578],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",582],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",586],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",590],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",596],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",600],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,604],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",612],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"RENDERER_HAS_TANGENT",610],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},616],[0," shadowCoord = getShadowCoord ( vertexInputs.positionWS ) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\n }\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[7,"IS_METALLIC_WORKFLOW"],[0,"\n\n"],[2,"FORWARD_PASS_PBR_INCLUDED",705],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[2,"COMMON_INCLUDED",40],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",28],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,38],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",60],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,58],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,50],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",2,53],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,56],[3,"SCENE_FOG_MODE","==",3,56],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",66],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",96],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",74],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",78],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,82],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",90],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",88],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},94],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShadingSSS"],[0,"\n\n"],[2,"BSDF_INCLUDED",184],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",112],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",110],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",120],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",124],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",128],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",132],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",136],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",140],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",144],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",148],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",152],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",156],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",160],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",164],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,166],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",170],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",174],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",178],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",182],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",198],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",192],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",196],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CURVATEXTURE",202],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",392],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",212],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",218],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",224],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",230],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",236],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",322],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",250],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",248],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",258],[0,"\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",262],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",266],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",270],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",274],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",278],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",282],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",286],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",290],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",294],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",298],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",302],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,304],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",308],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",312],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",316],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",320],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",364],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",330],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",338],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",336],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",346],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",344],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",354],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",352],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",358],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",362],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",378],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",372],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",376],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",382],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",386],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",390],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",428],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",402],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",408],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",414],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",420],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",426],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",434],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",685],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",450],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",446],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,448],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",454],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",458],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",474],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",464],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",468],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",472],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",482],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",480],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",494],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",488],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",492],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",506],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",500],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",504],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",522],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",512],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",520],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",518],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",526],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",530],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",534],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",538],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",542],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",546],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",550],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",554],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",558],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",562],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",566],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",570],[0," surfaceData.opacity = baseColor.a ; \n"],[5,572],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",576],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,578],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",582],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,587],[1,"HAS_DERIVATIVES",585],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,587],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",601],[0," \n"],[1,"NEED_VERTEX_TANGENT",593],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,595],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",599],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",605],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",609],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",627],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",615],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,617],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",621],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",625],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",635],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",633],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",649],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",641],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,643],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",647],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",661],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",655],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",659],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",677],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",667],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",675],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",673],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",681],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,683],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\nvoid main() { BRDFData brdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},689],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\nsurfaceData.f0 = 0.04 ;\ninitBRDFData ( surfaceData , brdfData ) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},699],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,695],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,697],[0," vec3 shadowCoord = getShadowCoord ( positionWS ) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap ( positionWS , shadowCoord ) ; \n"],[6],[0,"\nevaluateDirectRadiance ( varyings , surfaceData , brdfData , shadowAttenuation , totalDiffuseColor , totalSpecularColor ) ;\nevaluateIBL ( varyings , surfaceData , brdfData , totalDiffuseColor , totalSpecularColor ) ;\nvec4 color = vec4 ( totalDiffuseColor + totalSpecularColor , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,703],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }\n\n"],[6]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/bake-pbr/BakePBR.shaderc b/packages/custom-material/compiledShaders/bake-pbr/BakePBR.shaderc index 9f1b0261..f50b5b49 100644 --- a/packages/custom-material/compiledShaders/bake-pbr/BakePBR.shaderc +++ b/packages/custom-material/compiledShaders/bake-pbr/BakePBR.shaderc @@ -1 +1 @@ -{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",714],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}}},10],[0,"\n\n"],[7,"NEED_VERTEX_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},16],[0,"\n\n"],[7,"NEED_TANGENT_SPACE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"COMMON_INCLUDED",46],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",40],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,44],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",56],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,54],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",62],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",120],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",94],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",92],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,90],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},86],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",80],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",84],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,88],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",98],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",102],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",106],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",110],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",114],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",118],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",142],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",140],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",130],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,132],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",136],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,138],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",220],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",218],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",152],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,166],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},156],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,164],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,162],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",174],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",172],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",186],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},180],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},184],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,216],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," \n"],[1,"RENDERER_HAS_NORMAL",192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,214],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},210],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},204],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},208],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,212],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",300],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},230],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",258],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,236],[0," mediump int cascadeIndex = 0 ; \n"],[5,238],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,256],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,246],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,250],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,254],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",298],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",268],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,282],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",274],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,278],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,286],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,296],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",294],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",330],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",308],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",312],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,316],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",324],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",322],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},328],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",478],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",340],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",346],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",352],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",358],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",364],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",416],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",378],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",376],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",386],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",390],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",394],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",398],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",402],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",406],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",410],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",414],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",458],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",432],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",430],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",440],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",438],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",448],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",446],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",452],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",456],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",464],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",468],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",476],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",514],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",488],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",494],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",500],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",506],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",512],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",580],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,522],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",530],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",528],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",534],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",542],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",540],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",554],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",552],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",550],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",566],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},564],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",562],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},574],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",572],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,578],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",688],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",590],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",594],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",614],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",604],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",608],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",612],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",622],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",620],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",634],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",628],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",632],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",646],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",640],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",644],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",662],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",660],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",658],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",666],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",670],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",674],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",678],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",682],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",686],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",692],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",696],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,700],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",708],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"NEED_VERTEX_TANGENT",706],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},712],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",718],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",874],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}}},10],[0,"\n\n"],[7,"NEED_VERTEX_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},16],[0,"\n\n"],[7,"NEED_TANGENT_SPACE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"COMMON_INCLUDED",50],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",38],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",44],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,48],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",70],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,68],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,60],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,66],[3,"SCENE_FOG_MODE","==",2,63],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,66],[3,"SCENE_FOG_MODE","==",3,66],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",76],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",82],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",98],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",96],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",92],[0,"\n\n"],[5,94],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",126],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",124],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",108],[0,"\n\n"],[5,122],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},112],[0,"\n\n"],[5,120],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},116],[0,"\n\n"],[5,118],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",218],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},136],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",164],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,142],[0," mediump int cascadeIndex = 0 ; \n"],[5,144],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",148],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,162],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,152],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,156],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,160],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",216],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",174],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod(textureName, coord3 , 0.0)"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,188],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",180],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,184],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,192],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",200],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,206],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,210],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,214],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",248],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",226],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",230],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,234],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",242],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",240],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},246],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",539],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",258],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",264],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",270],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",276],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",282],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",429],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",296],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",294],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",304],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",308],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",312],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",316],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",320],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",324],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",328],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",332],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",336],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",340],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",344],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,346],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",350],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",354],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",358],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",362],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",366],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,368],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",372],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",382],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",378],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,380],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",397],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,388],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,391],[3,"REFRACTION_MODE","==",1,391],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",395],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",407],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",403],[0," return 1.0 ; \n"],[5,405],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",411],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",415],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",419],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",423],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",427],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",477],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",437],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",441],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,443],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",451],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",449],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",459],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",457],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",467],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",465],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",471],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",475],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",491],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",485],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",489],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",495],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",499],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",503],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",517],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",509],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,511],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",515],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",527],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",523],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,525],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",537],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",533],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,535],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",615],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",549],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",555],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",561],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",567],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",599],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",575],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,577],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",581],[0," return vec3 ( 0 ) ; \n"],[5,593],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",585],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,587],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",591],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},597],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",603],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,605],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",609],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",613],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",621],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",872],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",637],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",633],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,635],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",641],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",645],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",661],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",651],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",655],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",659],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",669],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",667],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",681],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",675],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",679],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",693],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",687],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",691],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",709],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",699],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",707],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",705],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",713],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",717],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",721],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",725],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",729],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",733],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",737],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",741],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",745],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",749],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",753],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",757],[0," surfaceData.opacity = baseColor.a ; \n"],[5,759],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",763],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,765],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",769],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,774],[1,"HAS_DERIVATIVES",772],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,774],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",788],[0," \n"],[1,"NEED_VERTEX_TANGENT",780],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,782],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",786],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",792],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",796],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",814],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",802],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,804],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",808],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",812],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",822],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",820],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",836],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",828],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,830],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",834],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",848],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",842],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",846],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",864],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",854],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",862],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",860],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",868],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,870],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",878],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},882],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},892],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,888],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,890],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",900],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",898],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",904],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,908],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file +{"name":"bake-pbr","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Utility/ShadowMap/Default/ShadowCaster","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Utility/DepthOnly/Default/DepthOnly","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"Forward Pass","isUsePass":false,"tags":{"pipelineStage":"Forward"},"renderStates":{"constantMap":{},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","11":"depthWriteEnabled","25":"rasterStateCullMode","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",714],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}}},10],[0,"\n\n"],[7,"NEED_VERTEX_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},16],[0,"\n\n"],[7,"NEED_TANGENT_SPACE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"COMMON_INCLUDED",46],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",40],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,44],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",56],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,54],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",62],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_ModelMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",120],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",94],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",92],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},74],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,90],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},86],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",80],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",84],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,88],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",98],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",102],[0,"attribute vec2 TEXCOORD_1;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",106],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",110],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",114],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",118],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",142],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",140],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",130],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,132],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",136],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,138],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",220],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",218],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",152],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,166],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},156],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,164],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,162],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",174],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",172],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",186],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},180],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},184],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,216],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},198],[0," \n"],[1,"RENDERER_HAS_NORMAL",192],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",196],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,214],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},210],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},204],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},208],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,212],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",300],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},230],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",258],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,236],[0," mediump int cascadeIndex = 0 ; \n"],[5,238],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",242],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,256],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,246],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,250],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,254],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",298],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",268],[0,"\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod ( textureName , coord3 , 0.0 )"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,282],[0,"\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",274],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,278],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,286],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,296],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",294],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",330],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",308],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",312],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,316],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",324],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",322],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},328],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",478],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",340],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",346],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",352],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",358],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",364],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",416],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",378],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",376],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",386],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",390],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",394],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",398],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",402],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",406],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",410],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",414],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",458],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\n\n"],[2,"GRAPHICS_API_WEBGL2",424],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",432],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",430],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",440],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",438],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",448],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",446],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SH",452],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",456],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",464],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",468],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",472],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",476],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",514],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",488],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",494],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",500],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",506],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",512],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",580],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\nstruct VertexInputs { vec4 positionOS ; vec3 positionWS ; \n"],[3,"SCENE_FOG_MODE","!=",0,522],[0," vec3 positionVS ; \n"],[6],[0," \n"],[1,"RENDERER_HAS_NORMAL",530],[0," vec3 normalWS ; \n"],[1,"NEED_VERTEX_TANGENT",528],[0," vec3 tangentWS ; vec3 bitangentWS ; \n"],[6],[0," \n"],[6],[0," } ;\nuniform vec4 material_TilingOffset;\nvec2 getUV0 ( ) { vec2 uv0 = vec2 ( 0 ) ;\n\n"],[1,"RENDERER_HAS_UV",534],[0," uv0 = TEXCOORD_0 ; \n"],[6],[0,"\nreturn uv0 * material_TilingOffset.xy + material_TilingOffset.zw ; }\nVertexInputs getVertexInputs ( ) { VertexInputs inputs ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",542],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",540],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",554],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",552],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",550],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",566],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},564],[0," mat3 skinNormalMatrix = INVERSE_MAT(mat3 ( skinMatrix )) ;\nnormal = normal * skinNormalMatrix ;\n\n"],[1,"NEED_VERTEX_TANGENT",562],[0," tangent.xyz = tangent.xyz * skinNormalMatrix ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"not","c":{"t":"def","m":"MATERIAL_OMIT_NORMAL"}}},574],[0," inputs.normalWS = normalize ( mat3 ( renderer_NormalMat ) * normal ) ;\n\n"],[1,"NEED_VERTEX_TANGENT",572],[0," vec3 tangentWS = normalize ( mat3 ( renderer_NormalMat ) * tangent.xyz ) ;\nvec3 bitangentWS = cross ( inputs.normalWS , tangentWS ) * tangent.w ;\ninputs.tangentWS = tangentWS ;\ninputs.bitangentWS = bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\ninputs.positionOS = position ;\nvec4 positionWS = renderer_ModelMat * position ;\ninputs.positionWS = positionWS.xyz / positionWS.w ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,578],[0," vec4 positionVS = renderer_MVMat * position ;\ninputs.positionVS = positionVS.xyz / positionVS.w ; \n"],[6],[0,"\nreturn inputs ; }\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",688],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",590],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",594],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",598],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",614],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",604],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",608],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",612],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",622],[0,"\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",620],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",634],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",628],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",632],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",646],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",640],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",644],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",662],[0,"\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",652],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",660],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",658],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",666],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",670],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",674],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",678],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",682],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",686],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid PBRVertex( ) { \nuv = getUV0() ;\n\n"],[1,"RENDERER_HAS_UV1",692],[0," uv1 = TEXCOORD_1 ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",696],[0," vertexColor = COLOR_0 ; \n"],[6],[0,"\nVertexInputs vertexInputs = getVertexInputs() ;\npositionWS = vertexInputs.positionWS ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,700],[0," positionVS = vertexInputs.positionVS ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",708],[0," normalWS = vertexInputs.normalWS ;\n\n"],[1,"NEED_VERTEX_TANGENT",706],[0," tangentWS = vertexInputs.tangentWS ;\nbitangentWS = vertexInputs.bitangentWS ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},712],[0," shadowCoord = getShadowCoord(vertexInputs.positionWS) ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * vertexInputs.positionOS ;\npositionCS = gl_Position ;\n }\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",718],[0,"\n\n"],[6],[0,"\nvoid main() { PBRVertex(); }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"FORWARD_PASS_PBR_INCLUDED",874],[0,"\n\n"],[7,"FORWARD_PASS_PBR_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}}},10],[0,"\n\n"],[7,"NEED_VERTEX_TANGENT"],[0,"\n\n"],[6],[0,"\n\n"],[4,{"t":"or","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_NORMALTEXTURE"},"r":{"t":"def","m":"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE"}},"r":{"t":"def","m":"MATERIAL_ENABLE_ANISOTROPY"}},16],[0,"\n\n"],[7,"NEED_TANGENT_SPACE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"COMMON_INCLUDED",50],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nfloat pow2 ( float x ) { return x * x ; }\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\nvec4 texture2DSRGB ( sampler2D tex, vec2 uv ) { vec4 color = texture2D ( tex , uv ) ;\n\n"],[1,"ENGINE_NO_SRGB",38],[0," color = sRGBToLinear(color) ; \n"],[6],[0,"\nreturn color ; }\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",44],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,48],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"FOG_INCLUDED",70],[0,"\n\n"],[7,"FOG_INCLUDED"],[0,"\n\n"],[3,"SCENE_FOG_MODE","!=",0,68],[0,"\nuniform vec4 scene_FogColor;\nuniform vec4 scene_FogParams;\nvec4 fog ( vec4 color, vec3 positionVS ) { float fogDepth = length ( positionVS ) ;\n\n"],[3,"SCENE_FOG_MODE","==",1,60],[0," float fogIntensity = clamp ( fogDepth * scene_FogParams.x + scene_FogParams.y , 0.0 , 1.0 ) ; \n"],[5,66],[3,"SCENE_FOG_MODE","==",2,63],[0," float fogIntensity = clamp ( exp2 ( - fogDepth * scene_FogParams.z ) , 0.0 , 1.0 ) ; \n"],[5,66],[3,"SCENE_FOG_MODE","==",3,66],[0," float factor = fogDepth * scene_FogParams.w ;\nfloat fogIntensity = clamp ( exp2 ( - factor * factor ) , 0.0 , 1.0 ) ; \n"],[6],[0,"\ncolor.rgb = mix ( scene_FogColor.rgb , color.rgb , fogIntensity ) ;\nreturn color ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",76],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec3 camera_Position;\nuniform vec3 camera_Forward;\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",82],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",98],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",96],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",92],[0,"\n\n"],[5,94],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",126],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",124],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",108],[0,"\n\n"],[5,122],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},112],[0,"\n\n"],[5,120],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},116],[0,"\n\n"],[5,118],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"SHADOW_INCLUDED",218],[0,"\n\n"],[7,"SHADOW_INCLUDED"],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_SHADOW_TYPE"},"r":{"t":"def","m":"RENDERER_IS_RECEIVE_SHADOWS"}},136],[0,"\n\n"],[7,"NEED_CALCULATE_SHADOWS"],[0,"\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",164],[0,"\nuniform mat4 scene_ShadowMatrices [ SCENE_SHADOW_CASCADED_COUNT + 1 ];\nuniform vec4 scene_ShadowSplitSpheres [ 4 ];\nmediump int computeCascadeIndex ( vec3 positionWS ) { vec3 fromCenter0 = positionWS - scene_ShadowSplitSpheres[0].xyz ;\nvec3 fromCenter1 = positionWS - scene_ShadowSplitSpheres[1].xyz ;\nvec3 fromCenter2 = positionWS - scene_ShadowSplitSpheres[2].xyz ;\nvec3 fromCenter3 = positionWS - scene_ShadowSplitSpheres[3].xyz ;\nmediump vec4 comparison = vec4 ( ( dot ( fromCenter0 , fromCenter0 ) < scene_ShadowSplitSpheres[0].w ) , ( dot ( fromCenter1 , fromCenter1 ) < scene_ShadowSplitSpheres[1].w ) , ( dot ( fromCenter2 , fromCenter2 ) < scene_ShadowSplitSpheres[2].w ) , ( dot ( fromCenter3 , fromCenter3 ) < scene_ShadowSplitSpheres[3].w ) ) ;\ncomparison.yzw = clamp ( comparison.yzw - comparison.xyz , 0.0 , 1.0 ) ;\nmediump vec4 indexCoefficient = vec4 ( 4.0 , 3.0 , 2.0 , 1.0 ) ;\nmediump int index = 4 - int ( dot ( comparison , indexCoefficient ) ) ;\nreturn index ; }\nvec3 getShadowCoord ( vec3 positionWS ) { \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,142],[0," mediump int cascadeIndex = 0 ; \n"],[5,144],[0," mediump int cascadeIndex = computeCascadeIndex(positionWS) ; \n"],[6],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",148],[0," mat4 shadowMatrix = scene_ShadowMatrices[cascadeIndex] ; \n"],[5,162],[0," mat4 shadowMatrix ;\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",4,152],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else if ( cascadeIndex == 2 ) { shadowMatrix = scene_ShadowMatrices[2] ; } else if ( cascadeIndex == 3 ) { shadowMatrix = scene_ShadowMatrices[3] ; } else { shadowMatrix = scene_ShadowMatrices[4] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",2,156],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else if ( cascadeIndex == 1 ) { shadowMatrix = scene_ShadowMatrices[1] ; } else { shadowMatrix = scene_ShadowMatrices[2] ; } \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,160],[0," if ( cascadeIndex == 0 ) { shadowMatrix = scene_ShadowMatrices[0] ; } else { shadowMatrix = scene_ShadowMatrices[1] ; } \n"],[6],[0," \n"],[6],[0,"\nvec4 shadowCoord = shadowMatrix * vec4 ( positionWS , 1.0 ) ;\nreturn shadowCoord.xyz ; }\n\n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",216],[0,"\nuniform vec4 scene_ShadowInfo;\nuniform vec4 scene_ShadowMapSize;\n\n"],[1,"GRAPHICS_API_WEBGL2",174],[0,"\nuniform mediump sampler2DShadow scene_ShadowMap;\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureLod ( textureName , coord3 , 0.0 )"],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2DShadow shadowMap"],[0,"\n\n"],[5,188],[0,"\nuniform sampler2D scene_ShadowMap;\n\n"],[1,"ENGINE_NO_DEPTH_TEXTURE",180],[0,"\nconst vec4 bitShift = vec4 ( 1.0 , 1.0 / 256.0 , 1.0 / ( 256.0 * 256.0 ) , 1.0 / ( 256.0 * 256.0 * 256.0 ) );\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { vec4 rgbaDepth = texture2D ( scene_ShadowMap , shadowCoord.xy ) ;\nfloat unpackDepth = dot ( rgbaDepth , bitShift ) ;\nreturn unpackDepth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[5,184],[0,"\nfloat textureShadowMapDowngrade ( sampler2D scene_ShadowMap, vec3 shadowCoord ) { float depth = texture2D ( scene_ShadowMap , shadowCoord.xy ).r ;\nreturn depth < shadowCoord.z ? 0.0 : 1.0 ; }\n\n"],[9,"SAMPLE_TEXTURE2D_SHADOW",["textureName","coord3"],"textureShadowMapDowngrade(textureName, coord3)"],[0,"\n\n"],[6],[0,"\n\n"],[9,"TEXTURE2D_SHADOW_PARAM",["shadowMap"],"mediump sampler2D shadowMap"],[0,"\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,192],[0,"\nfloat sampleShadowMapFiltered4 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize ) { float attenuation ;\nvec4 attenuation4 ;\nvec2 offset = shadowMapSize.xy / 2.0 ;\nvec3 shadowCoord0 = shadowCoord + vec3 ( - offset , 0.0 ) ;\nvec3 shadowCoord1 = shadowCoord + vec3 ( offset.x , - offset.y , 0.0 ) ;\nvec3 shadowCoord2 = shadowCoord + vec3 ( - offset.x , offset.y , 0.0 ) ;\nvec3 shadowCoord3 = shadowCoord + vec3 ( offset , 0.0 ) ;\nattenuation4.x = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord0) ;\nattenuation4.y = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord1) ;\nattenuation4.z = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord2) ;\nattenuation4.w = SAMPLE_TEXTURE2D_SHADOW(shadowMap, shadowCoord3) ;\nattenuation = dot ( attenuation4 , vec4 ( 0.25 ) ) ;\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,202],[0,"\n\n"],[2,"SHADOW_SAMPLE_TENT_INCLUDED",200],[0,"\n\n"],[7,"SHADOW_SAMPLE_TENT_INCLUDED"],[0,"\nfloat sampleShadowGetIRTriangleTexelArea ( float triangleHeight ) { return triangleHeight - 0.5 ; }\nvoid sampleShadowGetTexelAreasTent3x3 ( float offset, out vec4 computedArea, out vec4 computedAreaUncut ) { float a = offset + 0.5 ;\nfloat offsetSquaredHalved = a * a * 0.5 ;\ncomputedAreaUncut.x = computedArea.x = offsetSquaredHalved - offset ;\ncomputedAreaUncut.w = computedArea.w = offsetSquaredHalved ;\ncomputedAreaUncut.y = sampleShadowGetIRTriangleTexelArea(1.5 - offset) ;\nfloat clampedOffsetLeft = min ( offset , 0.0 ) ;\nfloat areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft ;\ncomputedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle ;\ncomputedAreaUncut.z = sampleShadowGetIRTriangleTexelArea(1.5 + offset) ;\nfloat clampedOffsetRight = max ( offset , 0.0 ) ;\nfloat areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight ;\ncomputedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle ; }\nvoid sampleShadowGetTexelWeightsTent5x5 ( float offset, out vec3 texelsWeightsA, out vec3 texelsWeightsB ) { vec4 areaFrom3texelTriangle ;\nvec4 areaUncutFrom3texelTriangle ;\nsampleShadowGetTexelAreasTent3x3(offset, areaFrom3texelTriangle, areaUncutFrom3texelTriangle) ;\ntexelsWeightsA.x = 0.16 * ( areaFrom3texelTriangle.x ) ;\ntexelsWeightsA.y = 0.16 * ( areaUncutFrom3texelTriangle.y ) ;\ntexelsWeightsA.z = 0.16 * ( areaFrom3texelTriangle.y + 1.0 ) ;\ntexelsWeightsB.x = 0.16 * ( areaFrom3texelTriangle.z + 1.0 ) ;\ntexelsWeightsB.y = 0.16 * ( areaUncutFrom3texelTriangle.z ) ;\ntexelsWeightsB.z = 0.16 * ( areaFrom3texelTriangle.w ) ; }\nvoid sampleShadowComputeSamplesTent5x5 ( vec4 shadowMapTextureTexelSize, vec2 coord, out float fetchesWeights [ 9 ], out vec2 fetchesUV [ 9 ] ) { vec2 tentCenterInTexelSpace = coord.xy * shadowMapTextureTexelSize.zw ;\nvec2 centerOfFetchesInTexelSpace = floor ( tentCenterInTexelSpace + 0.5 ) ;\nvec2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace ;\nvec3 texelsWeightsUA , texelsWeightsUB ;\nvec3 texelsWeightsVA , texelsWeightsVB ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsUA, texelsWeightsUB) ;\nsampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsVA, texelsWeightsVB) ;\nvec3 fetchesWeightsU = vec3 ( texelsWeightsUA.xz , texelsWeightsUB.y ) + vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) ;\nvec3 fetchesWeightsV = vec3 ( texelsWeightsVA.xz , texelsWeightsVB.y ) + vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) ;\nvec3 fetchesOffsetsU = vec3 ( texelsWeightsUA.y , texelsWeightsUB.xz ) / fetchesWeightsU.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nvec3 fetchesOffsetsV = vec3 ( texelsWeightsVA.y , texelsWeightsVB.xz ) / fetchesWeightsV.xyz + vec3 ( - 2.5 , - 0.5 , 1.5 ) ;\nfetchesOffsetsU *= shadowMapTextureTexelSize.xxx ;\nfetchesOffsetsV *= shadowMapTextureTexelSize.yyy ;\nvec2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * shadowMapTextureTexelSize.xy ;\nfetchesUV[0] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.x ) ;\nfetchesUV[1] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.x ) ;\nfetchesUV[2] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.x ) ;\nfetchesUV[3] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.y ) ;\nfetchesUV[4] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.y ) ;\nfetchesUV[5] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.y ) ;\nfetchesUV[6] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.x , fetchesOffsetsV.z ) ;\nfetchesUV[7] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.y , fetchesOffsetsV.z ) ;\nfetchesUV[8] = bilinearFetchOrigin + vec2 ( fetchesOffsetsU.z , fetchesOffsetsV.z ) ;\nfetchesWeights[0] = fetchesWeightsU.x * fetchesWeightsV.x ;\nfetchesWeights[1] = fetchesWeightsU.y * fetchesWeightsV.x ;\nfetchesWeights[2] = fetchesWeightsU.z * fetchesWeightsV.x ;\nfetchesWeights[3] = fetchesWeightsU.x * fetchesWeightsV.y ;\nfetchesWeights[4] = fetchesWeightsU.y * fetchesWeightsV.y ;\nfetchesWeights[5] = fetchesWeightsU.z * fetchesWeightsV.y ;\nfetchesWeights[6] = fetchesWeightsU.x * fetchesWeightsV.z ;\nfetchesWeights[7] = fetchesWeightsU.y * fetchesWeightsV.z ;\nfetchesWeights[8] = fetchesWeightsU.z * fetchesWeightsV.z ; }\n\n"],[6],[0,"\nfloat sampleShadowMapFiltered9 ( TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowmapSize ) { float attenuation ;\nfloat fetchesWeights [ 9 ] ;\nvec2 fetchesUV [ 9 ] ;\nsampleShadowComputeSamplesTent5x5(shadowmapSize, shadowCoord.xy, fetchesWeights, fetchesUV) ;\nattenuation = fetchesWeights[0] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[0].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[1] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[1].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[2] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[2].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[3] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[3].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[4] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[4].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[5] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[5].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[6] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[6].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[7] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[7].xy , shadowCoord.z )) ;\nattenuation += fetchesWeights[8] * SAMPLE_TEXTURE2D_SHADOW(shadowMap, vec3 ( fetchesUV[8].xy , shadowCoord.z )) ;\nreturn attenuation ; }\n\n"],[6],[0,"\nfloat getShadowFade ( vec3 positionWS ) { vec3 camToPixel = positionWS - camera_Position ;\nfloat distanceCamToPixel2 = dot ( camToPixel , camToPixel ) ;\nreturn saturate(distanceCamToPixel2 * scene_ShadowInfo.z + scene_ShadowInfo.w) ; }\nfloat sampleShadowMap ( vec3 positionWS, vec3 shadowCoord ) { float attenuation = 1.0 ;\nif ( shadowCoord.z > 0.0 && shadowCoord.z < 1.0 ) { \n"],[3,"SCENE_SHADOW_TYPE","==",1,206],[0," attenuation = SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap, shadowCoord) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",2,210],[0," attenuation = sampleShadowMapFiltered4(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\n\n"],[3,"SCENE_SHADOW_TYPE","==",3,214],[0," attenuation = sampleShadowMapFiltered9(scene_ShadowMap, shadowCoord, scene_ShadowMapSize) ; \n"],[6],[0,"\nfloat shadowFade = getShadowFade(positionWS) ;\nattenuation = mix ( 1.0 , mix ( attenuation , 1.0 , shadowFade ) , scene_ShadowInfo.x ) ; }\nreturn attenuation ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"VARYINGS_PBR_INCLUDED",248],[0,"\n\n"],[7,"VARYINGS_PBR_INCLUDED"],[0,"\nvarying vec2 uv;\n\n"],[1,"RENDERER_HAS_UV1",226],[0,"varying vec2 uv1;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",230],[0,"varying vec4 vertexColor;\n\n"],[6],[0,"varying vec3 positionWS;\n\n"],[3,"SCENE_FOG_MODE","!=",0,234],[0,"varying vec3 positionVS;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",242],[0,"varying vec3 normalWS;\n\n"],[1,"NEED_VERTEX_TANGENT",240],[0,"varying vec3 tangentWS;\nvarying vec3 bitangentWS;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"NEED_CALCULATE_SHADOWS"},"r":{"t":"cmp","m":"SCENE_SHADOW_CASCADED_COUNT","op":"==","v":1}},246],[0,"varying vec3 shadowCoord;\n\n"],[6],[0,"varying vec4 positionCS;\n\n\n"],[6],[0,"\n\n"],[2,"LIGHT_DIRECT_PBR_INCLUDED",539],[0,"\n\n"],[7,"LIGHT_DIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_SURFACE_SHADING",258],[0,"\n\n"],[8,"FUNCTION_SURFACE_SHADING","surfaceShading"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_LOBE",264],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_LOBE","diffuseLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_LOBE",270],[0,"\n\n"],[8,"FUNCTION_SPECULAR_LOBE","specularLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_LOBE",276],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_LOBE","clearCoatLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_LOBE",282],[0,"\n\n"],[8,"FUNCTION_SHEEN_LOBE","sheenLobe"],[0,"\n\n"],[6],[0,"\n\n"],[2,"BSDF_INCLUDED",429],[0,"\n\n"],[7,"BSDF_INCLUDED"],[0,"\n\n"],[2,"REFRACTION_INCLUDED",296],[0,"\n\n"],[7,"REFRACTION_INCLUDED"],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",294],[0,"\nstruct RefractionModelResult { float transmissionLength ; vec3 positionExit ; } ;\nvoid refractionModelSphere ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R1 = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = dot ( - normalWS , R1 ) * thickness ;\nvec3 P1 = positionWS + R1 * dist ;\nray.transmissionLength = dist ;\nray.positionExit = P1 ; }\nvoid refractionModelPlanar ( vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray ) { vec3 R = refract ( V , normalWS , 1.0 / ior ) ;\nfloat dist = thickness / max ( dot ( - normalWS , R ) , 1e-5f ) ;\nray.transmissionLength = dist ;\nray.positionExit = vec3 ( positionWS + R * dist ) ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[8,"MIN_PERCEPTUAL_ROUGHNESS","0.045"],[0,"\n\n"],[8,"MIN_ROUGHNESS","0.002025"],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",304],[0,"\nuniform sampler2D scene_PrefilteredDFG;\n\n"],[6],[0,"\nstruct SurfaceData { vec3 albedoColor ; vec3 emissiveColor ; float metallic ; float roughness ; float ambientOcclusion ; float opacity ; float IOR ; vec3 position ; vec4 positionCS ; vec3 normal ; \n"],[1,"NEED_TANGENT_SPACE",308],[0," vec3 tangent ; vec3 bitangent ; \n"],[6],[0," vec3 viewDir ; float dotNV ; float specularIntensity ; vec3 specularColor ; \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",312],[0," float anisotropy ; vec3 anisotropicT ; vec3 anisotropicB ; vec3 anisotropicN ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",316],[0," float clearCoat ; float clearCoatRoughness ; vec3 clearCoatNormal ; float clearCoatDotNV ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",320],[0," float iridescenceIOR ; float iridescenceFactor ; float iridescenceThickness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",324],[0," float sheenRoughness ; vec3 sheenColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_TRANSMISSION",328],[0," vec3 absorptionCoefficient ; float transmission ; float thickness ; \n"],[6],[0," } ;\nstruct BSDFData { vec3 diffuseColor ; float roughness ; vec3 envSpecularDFG ; float diffuseAO ; vec3 specularF0 ; vec3 resolvedSpecularF0 ; float specularF90 ; vec3 energyCompensation ; \n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",332],[0," vec3 clearCoatSpecularColor ; float clearCoatRoughness ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",336],[0," vec3 iridescenceSpecularColor ; \n"],[6],[0," \n"],[1,"MATERIAL_ENABLE_SHEEN",340],[0," float sheenRoughness ; float sheenScaling ; float approxIBLSheenDG ; \n"],[6],[0," } ;\nfloat getAARoughnessFactor ( vec3 normal ) { \n"],[1,"HAS_DERIVATIVES",344],[0," vec3 dxy = max ( abs ( dFdx ( normal ) ) , abs ( dFdy ( normal ) ) ) ;\nreturn max ( max ( dxy.x , dxy.y ) , dxy.z ) ; \n"],[5,346],[0," return 0.0 ; \n"],[6],[0," }\nfloat F_Schlick ( float f0, float f90, float dotLH ) { return f0 + ( f90 - f0 ) * ( pow ( 1.0 - dotLH , 5.0 ) ) ; }\nvec3 F_Schlick ( vec3 f0, float f90, float dotLH ) { float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;\nreturn ( f90 - f0 ) * fresnel + f0 ; }\nfloat G_GGX_SmithCorrelated ( float alpha, float dotNL, float dotNV ) { float a2 = pow2(alpha) ;\nfloat gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNV) ) ;\nfloat gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2(dotNL) ) ;\nreturn 0.5 / max ( gv + gl , EPSILON ) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",350],[0,"\nfloat G_GGX_SmithCorrelated_Anisotropic ( float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL ) { float lambdaV = NoL * length ( vec3 ( at * ToV , ab * BoV , NoV ) ) ;\nfloat lambdaL = NoV * length ( vec3 ( at * ToL , ab * BoL , NoL ) ) ;\nreturn 0.5 / max ( lambdaV + lambdaL , EPSILON ) ; }\n\n"],[6],[0,"\nfloat D_GGX ( float alpha, float dotNH ) { float a2 = pow2(alpha) ;\nfloat denom = pow2(dotNH) * ( a2 - 1.0 ) + 1.0 ;\nreturn RECIPROCAL_PI * a2 / pow2(denom) ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",354],[0,"\nfloat D_GGX_Anisotropic ( float at, float ab, float ToH, float BoH, float NoH ) { float a2 = at * ab ;\nhighp vec3 d = vec3 ( ab * ToH , at * BoH , a2 * NoH ) ;\nhighp float d2 = dot ( d , d ) ;\nfloat b2 = a2 / d2 ;\nreturn a2 * b2 * b2 * RECIPROCAL_PI ; }\n\n"],[6],[0,"\nfloat DG_GGX ( float alpha, float dotNV, float dotNL, float dotNH ) { float D = D_GGX(alpha, dotNH) ;\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV) ;\nreturn G * D ; }\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",358],[0,"\nfloat DG_GGX_anisotropic ( vec3 h, vec3 l, SurfaceData surfaceData, float alpha, float dotNV, float dotNL, float dotNH ) { vec3 t = surfaceData.anisotropicT ;\nvec3 b = surfaceData.anisotropicB ;\nvec3 v = surfaceData.viewDir ;\nfloat dotTV = dot ( t , v ) ;\nfloat dotBV = dot ( b , v ) ;\nfloat dotTL = dot ( t , l ) ;\nfloat dotBL = dot ( b , l ) ;\nfloat dotTH = dot ( t , h ) ;\nfloat dotBH = dot ( b , h ) ;\nfloat at = max ( alpha * ( 1.0 + surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat ab = max ( alpha * ( 1.0 - surfaceData.anisotropy ) , MIN_ROUGHNESS ) ;\nfloat D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH) ;\nfloat G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL) ;\nreturn G * D ; }\n\n"],[6],[0,"\nvec3 BRDF_Specular_GGX ( vec3 incidentDirection, SurfaceData surfaceData, BSDFData bsdfData, vec3 normal, vec3 specularColor, float roughness ) { float alpha = pow2(roughness) ;\nvec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( normal , incidentDirection )) ;\nfloat dotNV = saturate(dot ( normal , surfaceData.viewDir )) ;\nfloat dotNH = saturate(dot ( normal , halfDir )) ;\nfloat dotLH = saturate(dot ( incidentDirection , halfDir )) ;\nvec3 F = F_Schlick(specularColor, bsdfData.specularF90, dotLH) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",362],[0," F = mix ( F , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",366],[0," float GD = DG_GGX_anisotropic(halfDir, incidentDirection, surfaceData, alpha, dotNV, dotNL, dotNH) ; \n"],[5,368],[0," float GD = DG_GGX(alpha, dotNV, dotNL, dotNH) ; \n"],[6],[0,"\nreturn F * GD ; }\nvec3 BRDF_Diffuse_Lambert ( vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor ; }\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",372],[0,"\nvec3 iorToFresnel0 ( vec3 transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , vec3 ( 2.0 ) ) ; }\nfloat iorToFresnel0 ( float transmittedIOR, float incidentIOR ) { return pow ( ( transmittedIOR - incidentIOR ) / ( transmittedIOR + incidentIOR ) , 2.0 ) ; }\nvec3 fresnelToIOR ( vec3 f0 ) { vec3 sqrtF0 = sqrt ( f0 ) ;\nreturn ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ; }\nvec3 evalSensitivity ( float opd, vec3 shift ) { float phase = 2.0 * PI * opd * 1.0e-9 ;\nconst vec3 val = vec3 ( 5.4856e-13 , 4.4201e-13 , 5.2481e-13 ) ;\nconst vec3 pos = vec3 ( 1.6810e+06 , 1.7953e+06 , 2.2084e+06 ) ;\nconst vec3 var = vec3 ( 4.3278e+09 , 9.3046e+09 , 6.6121e+09 ) ;\nvec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - var * pow2(phase) ) ;\nxyz.x += 9.7470e-14 * sqrt ( 2.0 * PI * 4.5282e+09 ) * cos ( 2.2399e+06 * phase + shift[0] ) * exp ( - 4.5282e+09 * pow2(phase) ) ;\nxyz /= 1.0685e-7 ;\nconst mat3 XYZ_TO_RGB = mat3 ( 3.2404542 , - 0.9692660 , 0.0556434 , - 1.5371385 , 1.8760108 , - 0.2040259 , - 0.4985314 , 0.0415560 , 1.0572252 ) ;\nvec3 rgb = XYZ_TO_RGB * xyz ;\nreturn rgb ; }\nvec3 evalIridescenceSpecular ( float outsideIOR, float dotNV, float thinIOR, vec3 baseF0, float baseF90, float iridescenceThickness ) { vec3 iridescence = vec3 ( 1.0 ) ;\nfloat iridescenceIOR = mix ( outsideIOR , thinIOR , smoothstep ( 0.0 , 0.03 , iridescenceThickness ) ) ;\nfloat sinTheta2Sq = pow ( outsideIOR / iridescenceIOR , 2.0 ) * ( 1.0 - pow ( dotNV , 2.0 ) ) ;\nfloat cosTheta2Sq = 1.0 - sinTheta2Sq ;\nif ( cosTheta2Sq < 0.0 ) { return iridescence ; }\nfloat cosTheta2 = sqrt ( cosTheta2Sq ) ;\nfloat f0 = iorToFresnel0(iridescenceIOR, outsideIOR) ;\nfloat reflectance = F_Schlick(f0, baseF90, dotNV) ;\nfloat t121 = 1.0 - reflectance ;\nfloat phi12 = 0.0 ;\nfloat phi21 = PI - phi12 ;\nvec3 baseIOR = fresnelToIOR(clamp ( baseF0 , 0.0 , 0.9999 )) ;\nvec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR) ;\nvec3 r23 = F_Schlick(r1, baseF90, cosTheta2) ;\nvec3 phi23 = vec3 ( 0.0 ) ;\nif ( baseIOR[0] < iridescenceIOR ) { phi23[0] = PI ; }\nif ( baseIOR[1] < iridescenceIOR ) { phi23[1] = PI ; }\nif ( baseIOR[2] < iridescenceIOR ) { phi23[2] = PI ; }\nfloat opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2 ;\nvec3 phi = vec3 ( phi21 ) + phi23 ;\nvec3 r123 = clamp ( reflectance * r23 , 1e-5 , 0.9999 ) ;\nvec3 sr123 = sqrt ( r123 ) ;\nvec3 rs = pow2(t121) * r23 / ( vec3 ( 1.0 ) - r123 ) ;\nvec3 c0 = reflectance + rs ;\niridescence = c0 ;\nvec3 cm = rs - t121 ;\nfor ( int m = 1 ; m <= 2 ; ++ m ) { cm *= sr123 ;\nvec3 sm = 2.0 * evalSensitivity(float ( m ) * opd, float ( m ) * phi) ;\niridescence += cm * sm ; }\nreturn iridescence = max ( iridescence , vec3 ( 0.0 ) ) ; }\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",382],[0,"\nfloat D_Charlie ( float roughness, float dotNH ) { float invAlpha = 1.0 / roughness ;\nfloat cos2h = dotNH * dotNH ;\nfloat sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;\nreturn ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ; }\nfloat V_Neubelt ( float NoV, float NoL ) { return saturate(1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) )) ; }\nvec3 sheenBRDF ( vec3 incidentDirection, SurfaceData surfaceData, vec3 sheenColor, float sheenRoughness ) { vec3 halfDir = normalize ( incidentDirection + surfaceData.viewDir ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nfloat dotNH = saturate(dot ( surfaceData.normal , halfDir )) ;\nfloat D = D_Charlie(sheenRoughness, dotNH) ;\nfloat V = V_Neubelt(surfaceData.dotNV, dotNL) ;\nvec3 F = sheenColor ;\nreturn D * V * F ; }\nfloat prefilteredSheenDFG ( float dotNV, float sheenRoughness ) { \n"],[1,"HAS_TEX_LOD",378],[0," return texture2DLodEXT ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[5,380],[0," return texture2D ( scene_PrefilteredDFG , vec2 ( dotNV , sheenRoughness ) , 0.0 ).b ; \n"],[6],[0," }\n\n"],[6],[0,"\nvec2 envDFGApprox ( float roughness, float dotNV ) { const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;\nconst vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;\nvec4 r = roughness * c0 + c1 ;\nfloat a004 = min ( r.x * r.x , exp2 ( - 9.28 * dotNV ) ) * r.x + r.y ;\nreturn vec2 ( - 1.04 , 1.04 ) * a004 + r.zw ; }\nvec3 envBRDFApprox ( vec3 f0, float f90, float roughness, float dotNV ) { vec2 AB = envDFGApprox(roughness, dotNV) ;\nreturn f0 * AB.x + f90 * AB.y ; }\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",397],[0,"\nuniform sampler2D camera_OpaqueTexture;\nvec3 evaluateTransmission ( SurfaceData surfaceData, BSDFData bsdfData ) { RefractionModelResult ray ;\n\n"],[3,"REFRACTION_MODE","==",0,388],[0," refractionModelSphere(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[5,391],[3,"REFRACTION_MODE","==",1,391],[0," refractionModelPlanar(- surfaceData.viewDir, surfaceData.position, surfaceData.normal, surfaceData.IOR, surfaceData.thickness, ray) ; \n"],[6],[0,"\nvec3 refractedRayExit = ray.positionExit ;\nvec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4 ( refractedRayExit , 1.0 ) ;\nvec2 refractionCoords = ( samplingPositionNDC.xy / samplingPositionNDC.w ) * 0.5 + 0.5 ;\nvec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb ;\nrefractionTransmitted *= bsdfData.diffuseColor ;\nrefractionTransmitted *= ( 1.0 - max ( max ( bsdfData.envSpecularDFG.r , bsdfData.envSpecularDFG.g ) , bsdfData.envSpecularDFG.b ) ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS",395],[0," vec3 transmittance = min ( vec3 ( 1.0 ) , exp ( - surfaceData.absorptionCoefficient * ray.transmissionLength ) ) ;\nrefractionTransmitted *= transmittance ; \n"],[6],[0,"\nreturn refractionTransmitted ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",407],[0,"\nuniform sampler2D camera_AOTexture;\nfloat evaluateAmbientOcclusion ( vec2 uv ) { \n"],[1,"MATERIAL_IS_TRANSPARENT",403],[0," return 1.0 ; \n"],[5,405],[0," return texture2D ( camera_AOTexture , uv ).r ; \n"],[6],[0," }\n\n"],[6],[0,"\nvoid initBSDFData ( SurfaceData surfaceData, out BSDFData bsdfData ) { vec3 albedoColor = surfaceData.albedoColor ;\nfloat metallic = surfaceData.metallic ;\nfloat roughness = surfaceData.roughness ;\nvec3 dielectricBaseF0 = vec3 ( pow2(( surfaceData.IOR - 1.0 ) / ( surfaceData.IOR + 1.0 )) ) ;\nvec3 dielectricF0 = min ( dielectricBaseF0 * surfaceData.specularColor , vec3 ( 1.0 ) ) * surfaceData.specularIntensity ;\nfloat dielectricF90 = surfaceData.specularIntensity ;\nbsdfData.specularF0 = mix ( dielectricF0 , albedoColor , metallic ) ;\nbsdfData.specularF90 = mix ( dielectricF90 , 1.0 , metallic ) ;\nbsdfData.diffuseColor = albedoColor * ( 1.0 - metallic ) * ( 1.0 - max ( max ( dielectricF0.r , dielectricF0.g ) , dielectricF0.b ) ) ;\nbsdfData.roughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( roughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",411],[0," float topIOR = 1.0 ;\nbsdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, bsdfData.specularF0, bsdfData.specularF90, surfaceData.iridescenceThickness) ; \n"],[6],[0,"\nbsdfData.resolvedSpecularF0 = bsdfData.specularF0 ;\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",415],[0," bsdfData.resolvedSpecularF0 = mix ( bsdfData.resolvedSpecularF0 , bsdfData.iridescenceSpecularColor , surfaceData.iridescenceFactor ) ; \n"],[6],[0,"\nvec2 dfg = envDFGApprox(bsdfData.roughness, surfaceData.dotNV) ;\nbsdfData.envSpecularDFG = bsdfData.resolvedSpecularF0 * dfg.x + bsdfData.specularF90 * dfg.y ;\nbsdfData.energyCompensation = 1.0 + bsdfData.resolvedSpecularF0 * ( 1.0 / max ( dfg.x + dfg.y , EPSILON ) - 1.0 ) ;\nbsdfData.diffuseAO = surfaceData.ambientOcclusion ;\n\n"],[1,"SCENE_ENABLE_AMBIENT_OCCLUSION",419],[0," float ambientAO = evaluateAmbientOcclusion(( surfaceData.positionCS.xy / surfaceData.positionCS.w ) * 0.5 + 0.5) ;\nbsdfData.diffuseAO = min ( bsdfData.diffuseAO , ambientAO ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",423],[0," bsdfData.clearCoatRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.clearCoatRoughness + getAARoughnessFactor(surfaceData.clearCoatNormal) , 1.0 ) ) ;\nbsdfData.clearCoatSpecularColor = vec3 ( 0.04 ) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",427],[0," bsdfData.sheenRoughness = max ( MIN_PERCEPTUAL_ROUGHNESS , min ( surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal) , 1.0 ) ) ;\nbsdfData.approxIBLSheenDG = prefilteredSheenDFG(surfaceData.dotNV, bsdfData.sheenRoughness) ;\nbsdfData.sheenScaling = 1.0 - bsdfData.approxIBLSheenDG * max ( max ( surfaceData.sheenColor.r , surfaceData.sheenColor.g ) , surfaceData.sheenColor.b ) ; \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INCLUDED",477],[0,"\n\n"],[7,"LIGHT_INCLUDED"],[0,"\nuniform ivec4 renderer_Layer;\n\n"],[2,"GRAPHICS_API_WEBGL2",437],[0,"\nbool isBitSet ( float value, float mask, float bitIndex ) { return mod ( floor ( value / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 && mod ( floor ( mask / pow ( 2.0 , bitIndex ) ) , 2.0 ) == 1.0 ; }\n\n"],[6],[0,"\nbool isRendererCulledByLight ( ivec2 rendererLayer, ivec2 lightCullingMask ) { \n"],[1,"GRAPHICS_API_WEBGL2",441],[0," return ! ( ( rendererLayer.x & lightCullingMask.x ) != 0 || ( rendererLayer.y & lightCullingMask.y ) != 0 ) ; \n"],[5,443],[0," for ( int i = 0 ; i < 16 ; i ++ ) { if ( isBitSet(float ( rendererLayer.x ), float ( lightCullingMask.x ), float ( i )) || isBitSet(float ( rendererLayer.y ), float ( lightCullingMask.y ), float ( i )) ) { return false ; } }\nreturn true ; \n"],[6],[0," }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",451],[0,"\nstruct DirectLight { vec3 color ; vec3 direction ; } ;\nuniform ivec2 scene_DirectLightCullingMask [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightColor [ SCENE_DIRECT_LIGHT_COUNT ];\nuniform vec3 scene_DirectLightDirection [ SCENE_DIRECT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",449],[0,"\nDirectLight getDirectLight ( int index ) { DirectLight light ;\nlight.color = scene_DirectLightColor[index] ;\nlight.direction = scene_DirectLightDirection[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",459],[0,"\nstruct PointLight { vec3 color ; vec3 position ; float distance ; } ;\nuniform ivec2 scene_PointLightCullingMask [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightColor [ SCENE_POINT_LIGHT_COUNT ];\nuniform vec3 scene_PointLightPosition [ SCENE_POINT_LIGHT_COUNT ];\nuniform float scene_PointLightDistance [ SCENE_POINT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",457],[0,"\nPointLight getPointLight ( int index ) { PointLight light ;\nlight.color = scene_PointLightColor[index] ;\nlight.position = scene_PointLightPosition[index] ;\nlight.distance = scene_PointLightDistance[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",467],[0,"\nstruct SpotLight { vec3 color ; vec3 position ; vec3 direction ; float distance ; float angleCos ; float penumbraCos ; } ;\nuniform ivec2 scene_SpotLightCullingMask [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightColor [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightPosition [ SCENE_SPOT_LIGHT_COUNT ];\nuniform vec3 scene_SpotLightDirection [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightDistance [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightAngleCos [ SCENE_SPOT_LIGHT_COUNT ];\nuniform float scene_SpotLightPenumbraCos [ SCENE_SPOT_LIGHT_COUNT ];\n\n"],[1,"GRAPHICS_API_WEBGL2",465],[0,"\nSpotLight getSpotLight ( int index ) { SpotLight light ;\nlight.color = scene_SpotLightColor[index] ;\nlight.position = scene_SpotLightPosition[index] ;\nlight.direction = scene_SpotLightDirection[index] ;\nlight.distance = scene_SpotLightDistance[index] ;\nlight.angleCos = scene_SpotLightAngleCos[index] ;\nlight.penumbraCos = scene_SpotLightPenumbraCos[index] ;\nreturn light ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nstruct EnvMapLight { vec3 diffuse ; float mipMapLevel ; float diffuseIntensity ; float specularIntensity ; } ;\nuniform EnvMapLight scene_EnvMapLight;\n\n"],[1,"SCENE_USE_SH",471],[0,"\nuniform vec3 scene_EnvSH [ 9 ];\n\n"],[6],[0,"\n\n"],[1,"SCENE_USE_SPECULAR_ENV",475],[0,"\nuniform samplerCube scene_EnvSpecularSampler;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"REFLECTION_LOBE_INCLUDED",491],[0,"\n\n"],[7,"REFLECTION_LOBE_INCLUDED"],[0,"\nvoid diffuseLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 attenuationIrradiance, inout vec3 diffuseColor ) { diffuseColor += attenuationIrradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nvoid specularLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 specularColor ) { specularColor += attenuationIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.normal, bsdfData.specularF0, bsdfData.roughness) * bsdfData.energyCompensation ; }\nvoid sheenLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",485],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nspecularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, bsdfData.sheenRoughness) ; \n"],[6],[0," }\nfloat clearCoatLobe ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 color, inout vec3 specularColor ) { float attenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",489],[0," float clearCoatDotNL = saturate(dot ( surfaceData.clearCoatNormal , incidentDirection )) ;\nvec3 clearCoatIrradiance = clearCoatDotNL * color ;\nspecularColor += surfaceData.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX(incidentDirection, surfaceData, bsdfData, surfaceData.clearCoatNormal, bsdfData.clearCoatSpecularColor, bsdfData.clearCoatRoughness) ;\nattenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn attenuation ; }\n\n"],[6],[0,"\nvoid surfaceShading ( SurfaceData surfaceData, BSDFData bsdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nfloat dotNL = saturate(dot ( surfaceData.normal , incidentDirection )) ;\nvec3 irradiance = dotNL * lightColor * PI ;\nfloat attenuation = FUNCTION_CLEAR_COAT_LOBE(surfaceData, bsdfData, incidentDirection, lightColor, specularColor) ;\nvec3 attenuationIrradiance = attenuation * irradiance ;\nFUNCTION_DIFFUSE_LOBE(surfaceData, bsdfData, attenuationIrradiance, diffuseColor) ;\nFUNCTION_SPECULAR_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, specularColor) ;\nFUNCTION_SHEEN_LOBE(surfaceData, bsdfData, incidentDirection, attenuationIrradiance, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[1,"SCENE_DIRECT_LIGHT_COUNT",495],[0,"\nvoid addDirectionalDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, DirectLight directionalLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lightColor = directionalLight.color ;\nvec3 direction = - directionalLight.direction ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",499],[0,"\nvoid addPointDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, PointLight pointLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = pointLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nvec3 lightColor = pointLight.color ;\nlightColor *= clamp ( 1.0 - pow ( lightDistance / pointLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",503],[0,"\nvoid addSpotDirectLightRadiance ( SurfaceData surfaceData, BSDFData bsdfData, SpotLight spotLight, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 lVector = spotLight.position - surfaceData.position ;\nvec3 direction = normalize ( lVector ) ;\nfloat lightDistance = length ( lVector ) ;\nfloat angleCos = dot ( direction , - spotLight.direction ) ;\nfloat spotEffect = smoothstep ( spotLight.penumbraCos , spotLight.angleCos , angleCos ) ;\nfloat decayEffect = clamp ( 1.0 - pow ( lightDistance / spotLight.distance , 4.0 ) , 0.0 , 1.0 ) ;\nvec3 lightColor = spotLight.color ;\nlightColor *= spotEffect * decayEffect ;\nFUNCTION_SURFACE_SHADING(surfaceData, bsdfData, direction, lightColor, totalDiffuseColor, totalSpecularColor) ; }\n\n"],[6],[0,"\nvoid evaluateDirectRadiance ( SurfaceData surfaceData, BSDFData bsdfData, float shadowAttenuation, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { \n"],[1,"SCENE_DIRECT_LIGHT_COUNT",517],[0," for ( int i = 0 ; i < SCENE_DIRECT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",509],[0," DirectLight directionalLight = getDirectLight(i) ; \n"],[5,511],[0," DirectLight directionalLight ;\ndirectionalLight.color = scene_DirectLightColor[i] ;\ndirectionalLight.direction = scene_DirectLightDirection[i] ; \n"],[6],[0,"\n\n"],[1,"NEED_CALCULATE_SHADOWS",515],[0," if ( i == 0 ) { directionalLight.color *= shadowAttenuation ; } \n"],[6],[0,"\naddDirectionalDirectLightRadiance(surfaceData, bsdfData, directionalLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_POINT_LIGHT_COUNT",527],[0," for ( int i = 0 ; i < SCENE_POINT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",523],[0," PointLight pointLight = getPointLight(i) ; \n"],[5,525],[0," PointLight pointLight ;\npointLight.color = scene_PointLightColor[i] ;\npointLight.position = scene_PointLightPosition[i] ;\npointLight.distance = scene_PointLightDistance[i] ; \n"],[6],[0,"\naddPointDirectLightRadiance(surfaceData, bsdfData, pointLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0,"\n\n"],[1,"SCENE_SPOT_LIGHT_COUNT",537],[0," for ( int i = 0 ; i < SCENE_SPOT_LIGHT_COUNT ; i ++ ) { if ( ! isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i]) ) { \n"],[1,"GRAPHICS_API_WEBGL2",533],[0," SpotLight spotLight = getSpotLight(i) ; \n"],[5,535],[0," SpotLight spotLight ;\nspotLight.color = scene_SpotLightColor[i] ;\nspotLight.position = scene_SpotLightPosition[i] ;\nspotLight.direction = scene_SpotLightDirection[i] ;\nspotLight.distance = scene_SpotLightDistance[i] ;\nspotLight.angleCos = scene_SpotLightAngleCos[i] ;\nspotLight.penumbraCos = scene_SpotLightPenumbraCos[i] ; \n"],[6],[0,"\naddSpotDirectLightRadiance(surfaceData, bsdfData, spotLight, totalDiffuseColor, totalSpecularColor) ; } } \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_PBR_INCLUDED",615],[0,"\n\n"],[7,"LIGHT_INDIRECT_PBR_INCLUDED"],[0,"\n\n"],[2,"FUNCTION_DIFFUSE_IBL",549],[0,"\n\n"],[8,"FUNCTION_DIFFUSE_IBL","evaluateDiffuseIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SPECULAR_IBL",555],[0,"\n\n"],[8,"FUNCTION_SPECULAR_IBL","evaluateSpecularIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_CLEAR_COAT_IBL",561],[0,"\n\n"],[8,"FUNCTION_CLEAR_COAT_IBL","evaluateClearCoatIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"FUNCTION_SHEEN_IBL",567],[0,"\n\n"],[8,"FUNCTION_SHEEN_IBL","evaluateSheenIBL"],[0,"\n\n"],[6],[0,"\n\n"],[2,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED",599],[0,"\n\n"],[7,"LIGHT_INDIRECT_FUNCTIONS_INCLUDED"],[0,"\nvec3 getReflectedVector ( SurfaceData surfaceData, vec3 n ) { \n"],[1,"MATERIAL_ENABLE_ANISOTROPY",575],[0," vec3 r = reflect ( - surfaceData.viewDir , surfaceData.anisotropicN ) ; \n"],[5,577],[0," vec3 r = reflect ( - surfaceData.viewDir , n ) ; \n"],[6],[0,"\nreturn r ; }\nfloat getSpecularMIPLevel ( float roughness, int maxMIPLevel ) { return roughness * float ( maxMIPLevel ) ; }\nvec3 getLightProbeRadiance ( SurfaceData surfaceData, vec3 normal, float roughness ) { \n"],[2,"SCENE_USE_SPECULAR_ENV",581],[0," return vec3 ( 0 ) ; \n"],[5,593],[0," vec3 reflectVec = getReflectedVector(surfaceData, normal) ;\nfloat specularMIPLevel = getSpecularMIPLevel(roughness, int ( scene_EnvMapLight.mipMapLevel )) ;\n\n"],[1,"HAS_TEX_LOD",585],[0," vec4 envMapColor = textureCubeLodEXT ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[5,587],[0," vec4 envMapColor = textureCube ( scene_EnvSpecularSampler , reflectVec , specularMIPLevel ) ; \n"],[6],[0,"\n\n"],[1,"ENGINE_NO_SRGB",591],[0," envMapColor = sRGBToLinear(envMapColor) ; \n"],[6],[0,"\nreturn envMapColor.rgb * scene_EnvMapLight.specularIntensity ; \n"],[6],[0," }\nfloat evaluateSpecularOcclusion ( float dotNV, float diffuseAO, float roughness ) { float specularAOFactor = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"or","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"SCENE_ENABLE_AMBIENT_OCCLUSION"}},"r":{"t":"def","m":"SCENE_USE_SPECULAR_ENV"}},597],[0," specularAOFactor = saturate(pow ( dotNV + diffuseAO , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + diffuseAO) ; \n"],[6],[0,"\nreturn specularAOFactor ; }\n\n"],[6],[0,"\nvec3 getLightProbeIrradiance ( vec3 sh [ 9 ], vec3 normal ) { vec3 result = sh[0] + sh[1] * ( normal.y ) + sh[2] * ( normal.z ) + sh[3] * ( normal.x ) + sh[4] * ( normal.y * normal.x ) + sh[5] * ( normal.y * normal.z ) + sh[6] * ( 3.0 * normal.z * normal.z - 1.0 ) + sh[7] * ( normal.z * normal.x ) + sh[8] * ( normal.x * normal.x - normal.y * normal.y ) ;\nreturn max ( result , vec3 ( 0.0 ) ) ; }\nvoid evaluateDiffuseIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 diffuseColor ) { \n"],[1,"SCENE_USE_SH",603],[0," vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, surfaceData.normal) ;\nirradiance *= scene_EnvMapLight.diffuseIntensity ; \n"],[5,605],[0," vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity ;\nirradiance *= PI ; \n"],[6],[0,"\ndiffuseColor += bsdfData.diffuseAO * irradiance * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; }\nfloat evaluateClearCoatIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 specularColor ) { float radianceAttenuation = 1.0 ;\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",609],[0," vec3 clearCoatRadiance = getLightProbeRadiance(surfaceData, surfaceData.clearCoatNormal, bsdfData.clearCoatRoughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.clearCoatRoughness) ;\nspecularColor += specularAO * clearCoatRadiance * surfaceData.clearCoat * envBRDFApprox(bsdfData.clearCoatSpecularColor, 1.0, bsdfData.clearCoatRoughness, surfaceData.clearCoatDotNV) ;\nradianceAttenuation -= surfaceData.clearCoat * F_Schlick(0.04, 1.0, surfaceData.clearCoatDotNV) ; \n"],[6],[0,"\nreturn radianceAttenuation ; }\nvoid evaluateSpecularIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 outSpecularColor ) { vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, bsdfData.roughness) ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.roughness) ;\noutSpecularColor += specularAO * radianceAttenuation * radiance * envBRDFApprox(bsdfData.resolvedSpecularF0, bsdfData.specularF90, bsdfData.roughness, surfaceData.dotNV) * bsdfData.energyCompensation ; }\nvoid evaluateSheenIBL ( SurfaceData surfaceData, BSDFData bsdfData, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor ) { \n"],[1,"MATERIAL_ENABLE_SHEEN",613],[0," diffuseColor *= bsdfData.sheenScaling ;\nspecularColor *= bsdfData.sheenScaling ;\nfloat specularAO = evaluateSpecularOcclusion(surfaceData.dotNV, bsdfData.diffuseAO, bsdfData.sheenRoughness) ;\nvec3 reflectance = specularAO * radianceAttenuation * bsdfData.approxIBLSheenDG * surfaceData.sheenColor ;\nspecularColor += reflectance ; \n"],[6],[0," }\nvoid evaluateIBL ( SurfaceData surfaceData, BSDFData bsdfData, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor ) { vec3 diffuseColor = vec3 ( 0 ) ;\nvec3 specularColor = vec3 ( 0 ) ;\nFUNCTION_DIFFUSE_IBL(surfaceData, bsdfData, diffuseColor) ;\nfloat radianceAttenuation = FUNCTION_CLEAR_COAT_IBL(surfaceData, bsdfData, specularColor) ;\nFUNCTION_SPECULAR_IBL(surfaceData, bsdfData, radianceAttenuation, specularColor) ;\nFUNCTION_SHEEN_IBL(surfaceData, bsdfData, radianceAttenuation, diffuseColor, specularColor) ;\ntotalDiffuseColor += diffuseColor ;\ntotalSpecularColor += specularColor ; }\n\n"],[6],[0,"\n\n"],[2,"VERTEX_INCLUDE",621],[0,"\n\n"],[7,"VERTEX_INCLUDE"],[0,"\n\n"],[6],[0,"\n\n"],[2,"MATERIAL_INPUT_PBR_INCLUDED",872],[0,"\n\n"],[7,"MATERIAL_INPUT_PBR_INCLUDED"],[0,"\n\n"],[2,"NORMAL_INCLUDED",637],[0,"\n\n"],[7,"NORMAL_INCLUDED"],[0,"\nvec3 getNormalByNormalTexture ( mat3 tbn, sampler2D normalTexture, float normalIntensity, vec2 uv, bool isFrontFacing ) { vec3 normal = ( texture2D ( normalTexture , uv ) ).rgb ;\nnormal = normalize ( tbn * ( ( 2.0 * normal - 1.0 ) * vec3 ( normalIntensity , normalIntensity , 1.0 ) ) ) ;\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nreturn normal ; }\nmat3 getTBNByDerivatives ( vec2 uv, vec3 normal, vec3 position, bool isFrontFacing ) { \n"],[1,"HAS_DERIVATIVES",633],[0," uv = isFrontFacing ? uv : - uv ;\nvec3 dp1 = dFdx ( position ) ;\nvec3 dp2 = dFdy ( position ) ;\nvec2 duv1 = dFdx ( uv ) ;\nvec2 duv2 = dFdy ( uv ) ;\nvec3 dp2perp = cross ( dp2 , normal ) ;\nvec3 dp1perp = cross ( normal , dp1 ) ;\nvec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x ;\nvec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y ;\nfloat denom = max ( dot ( tangent , tangent ) , dot ( bitangent , bitangent ) ) ;\nfloat invmax = ( denom == 0.0 ) ? 0.0 : camera_ProjectionParams.x / sqrt ( denom ) ;\nreturn mat3 ( tangent * invmax , bitangent * invmax , normal ) ; \n"],[5,635],[0," return mat3 ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , normal ) ; \n"],[6],[0," }\n\n"],[6],[0,"\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\nuniform float material_SpecularIntensity;\nuniform vec3 material_SpecularColor;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",641],[0,"\nuniform sampler2D material_SpecularIntensityTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",645],[0,"\nuniform sampler2D material_SpecularColorTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",661],[0,"\nuniform float material_ClearCoat;\nuniform float material_ClearCoatRoughness;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",651],[0,"\nuniform sampler2D material_ClearCoatTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",655],[0,"\nuniform sampler2D material_ClearCoatRoughnessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",659],[0,"\nuniform sampler2D material_ClearCoatNormalTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",669],[0,"\nuniform vec3 material_AnisotropyInfo;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",667],[0,"\nuniform sampler2D material_AnisotropyTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",681],[0,"\nuniform vec4 material_IridescenceInfo;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",675],[0,"\nuniform sampler2D material_IridescenceThicknessTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",679],[0,"\nuniform sampler2D material_IridescenceTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",693],[0,"\nuniform float material_SheenRoughness;\nuniform vec3 material_SheenColor;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",687],[0,"\nuniform sampler2D material_SheenTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",691],[0,"\nuniform sampler2D material_SheenRoughnessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",709],[0,"\nuniform float material_Transmission;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",699],[0,"\nuniform sampler2D material_TransmissionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",707],[0,"\nuniform vec3 material_AttenuationColor;\nuniform float material_AttenuationDistance;\nuniform float material_Thickness;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",705],[0,"\nuniform sampler2D material_ThicknessTexture;\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",713],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",717],[0,"\nuniform sampler2D material_NormalTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",721],[0,"\nuniform sampler2D material_EmissiveTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",725],[0,"\nuniform sampler2D material_RoughnessMetallicTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",729],[0,"\nuniform sampler2D material_OcclusionTexture;\n\n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",733],[0,"\nvec3 getAnisotropicBentNormal ( SurfaceData surfaceData ) { vec3 anisotropyDirection = ( surfaceData.anisotropy >= 0.0 ) ? surfaceData.anisotropicB : surfaceData.anisotropicT ;\nvec3 anisotropicTangent = cross ( anisotropyDirection , surfaceData.viewDir ) ;\nvec3 anisotropicNormal = cross ( anisotropicTangent , anisotropyDirection ) ;\nvec3 bentNormal = normalize ( mix ( surfaceData.normal , anisotropicNormal , abs ( surfaceData.anisotropy ) * saturate(5.0 * surfaceData.roughness) ) ) ;\nreturn bentNormal ; }\n\n"],[6],[0,"\nSurfaceData getSurfaceData ( vec2 aoUV, bool isFrontFacing ) { SurfaceData surfaceData ;\nvec2 uv = uv ;\nvec4 baseColor = material_BaseColor ;\nfloat metallic = material_Metal ;\nfloat roughness = material_Roughness ;\nvec3 emissiveRadiance = material_EmissiveColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",737],[0," baseColor *= texture2DSRGB(material_BaseTexture, uv) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",741],[0," baseColor *= vertexColor ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",745],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE",749],[0," vec4 metalRoughMapColor = texture2D ( material_RoughnessMetallicTexture , uv ) ;\nroughness *= metalRoughMapColor.g ;\nmetallic *= metalRoughMapColor.b ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_EMISSIVETEXTURE",753],[0," emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.albedoColor = baseColor.rgb ;\nsurfaceData.emissiveColor = emissiveRadiance ;\nsurfaceData.metallic = metallic ;\nsurfaceData.roughness = roughness ;\nsurfaceData.IOR = material_IOR ;\n\n"],[1,"MATERIAL_IS_TRANSPARENT",757],[0," surfaceData.opacity = baseColor.a ; \n"],[5,759],[0," surfaceData.opacity = 1.0 ; \n"],[6],[0,"\nsurfaceData.position = positionWS ;\nsurfaceData.positionCS = positionCS ;\n\n"],[1,"CAMERA_ORTHOGRAPHIC",763],[0," surfaceData.viewDir = - camera_Forward ; \n"],[5,765],[0," surfaceData.viewDir = normalize ( camera_Position - positionWS ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_NORMAL",769],[0," vec3 normal = normalize ( normalWS ) ; \n"],[5,774],[1,"HAS_DERIVATIVES",772],[0," vec3 pos_dx = dFdx ( positionWS ) ;\nvec3 pos_dy = dFdy ( positionWS ) ;\nvec3 normal = normalize ( cross ( pos_dx , pos_dy ) ) ;\nnormal *= camera_ProjectionParams.x ; \n"],[5,774],[0," vec3 normal = vec3 ( 0 , 0 , 1 ) ; \n"],[6],[0,"\nnormal *= float ( isFrontFacing ) * 2.0 - 1.0 ;\nsurfaceData.normal = normal ;\n\n"],[1,"NEED_TANGENT_SPACE",788],[0," \n"],[1,"NEED_VERTEX_TANGENT",780],[0," surfaceData.tangent = tangentWS ;\nsurfaceData.bitangent = bitangentWS ;\nmat3 tbn = mat3 ( tangentWS , bitangentWS , normalWS ) ; \n"],[5,782],[0," mat3 tbn = getTBNByDerivatives(uv, normal, positionWS, isFrontFacing) ;\nsurfaceData.tangent = tbn[0] ;\nsurfaceData.bitangent = tbn[1] ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_NORMALTEXTURE",786],[0," surfaceData.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[6],[0," \n"],[6],[0,"\nsurfaceData.dotNV = saturate(dot ( surfaceData.normal , surfaceData.viewDir )) ;\nsurfaceData.specularIntensity = material_SpecularIntensity ;\nsurfaceData.specularColor = material_SpecularColor ;\n\n"],[1,"MATERIAL_HAS_SPECULAR_TEXTURE",792],[0," surfaceData.specularIntensity *= texture2D ( material_SpecularIntensityTexture , uv ).a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE",796],[0," surfaceData.specularColor *= texture2D ( material_SpecularColorTexture , uv ).rgb ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_CLEAR_COAT",814],[0," \n"],[1,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE",802],[0," surfaceData.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, uv, isFrontFacing) ; \n"],[5,804],[0," surfaceData.clearCoatNormal = normal ; \n"],[6],[0,"\nsurfaceData.clearCoatDotNV = saturate(dot ( surfaceData.clearCoatNormal , surfaceData.viewDir )) ;\nsurfaceData.clearCoat = material_ClearCoat ;\nsurfaceData.clearCoatRoughness = material_ClearCoatRoughness ;\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_TEXTURE",808],[0," surfaceData.clearCoat *= ( texture2D ( material_ClearCoatTexture , uv ) ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE",812],[0," surfaceData.clearCoatRoughness *= ( texture2D ( material_ClearCoatRoughnessTexture , uv ) ).g ; \n"],[6],[0,"\nsurfaceData.clearCoat = saturate(surfaceData.clearCoat) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_ANISOTROPY",822],[0," float anisotropy = material_AnisotropyInfo.z ;\nvec3 anisotropicDirection = vec3 ( material_AnisotropyInfo.xy , 0.0 ) ;\n\n"],[1,"MATERIAL_HAS_ANISOTROPY_TEXTURE",820],[0," vec3 anisotropyTextureInfo = ( texture2D ( material_AnisotropyTexture , uv ) ).rgb ;\nanisotropy *= anisotropyTextureInfo.b ;\nanisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0 ; \n"],[6],[0,"\nsurfaceData.anisotropy = anisotropy ;\nsurfaceData.anisotropicT = normalize ( mat3 ( surfaceData.tangent , surfaceData.bitangent , surfaceData.normal ) * anisotropicDirection ) ;\nsurfaceData.anisotropicB = normalize ( cross ( surfaceData.normal , surfaceData.anisotropicT ) ) ;\nsurfaceData.anisotropicN = getAnisotropicBentNormal(surfaceData) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_IRIDESCENCE",836],[0," surfaceData.iridescenceFactor = material_IridescenceInfo.x ;\nsurfaceData.iridescenceIOR = material_IridescenceInfo.y ;\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE",828],[0," float iridescenceThicknessWeight = texture2D ( material_IridescenceThicknessTexture , uv ).g ;\nsurfaceData.iridescenceThickness = mix ( material_IridescenceInfo.z , material_IridescenceInfo.w , iridescenceThicknessWeight ) ; \n"],[5,830],[0," surfaceData.iridescenceThickness = material_IridescenceInfo.w ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_IRIDESCENCE_TEXTURE",834],[0," surfaceData.iridescenceFactor *= texture2D ( material_IridescenceTexture , uv ).r ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_SHEEN",848],[0," vec3 sheenColor = material_SheenColor ;\n\n"],[1,"MATERIAL_HAS_SHEEN_TEXTURE",842],[0," sheenColor *= texture2DSRGB(material_SheenTexture, uv).rgb ; \n"],[6],[0,"\nsurfaceData.sheenColor = sheenColor ;\nsurfaceData.sheenRoughness = material_SheenRoughness ;\n\n"],[1,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE",846],[0," surfaceData.sheenRoughness *= texture2D ( material_SheenRoughnessTexture , uv ).a ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",864],[0," surfaceData.transmission = material_Transmission ;\n\n"],[1,"MATERIAL_HAS_TRANSMISSION_TEXTURE",854],[0," surfaceData.transmission *= texture2D ( material_TransmissionTexture , uv ).r ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_THICKNESS",862],[0," surfaceData.absorptionCoefficient = - log ( material_AttenuationColor + HALF_EPS ) / max ( HALF_EPS , material_AttenuationDistance ) ;\nsurfaceData.thickness = max ( material_Thickness , 0.0001 ) ;\n\n"],[1,"MATERIAL_HAS_THICKNESS_TEXTURE",860],[0," surfaceData.thickness *= texture2D ( material_ThicknessTexture , uv ).g ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"MATERIAL_HAS_OCCLUSION_TEXTURE",868],[0," surfaceData.ambientOcclusion = ( ( texture2D ( material_OcclusionTexture , aoUV ) ).r - 1.0 ) * material_OcclusionIntensity + 1.0 ; \n"],[5,870],[0," surfaceData.ambientOcclusion = 1.0 ; \n"],[6],[0,"\nreturn surfaceData ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[1,"LIGHTMAP_TEXTURE",878],[0,"\nuniform sampler2D u_lightMapTexture;\nuniform float u_lightMapIntensity;\n\n"],[6],[0,"\nvoid main() { BSDFData bsdfData ;\nvec2 aoUV = uv ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"MATERIAL_HAS_OCCLUSION_TEXTURE"},"r":{"t":"def","m":"RENDERER_HAS_UV1"}},882],[0," if ( material_OcclusionTextureCoord == 1.0 ) { aoUV = uv1 ; } \n"],[6],[0,"\nSurfaceData surfaceData = getSurfaceData(aoUV, gl_FrontFacing) ;\ninitBSDFData(surfaceData, bsdfData) ;\nvec3 totalDiffuseColor = vec3 ( 0 , 0 , 0 ) ;\nvec3 totalSpecularColor = vec3 ( 0 , 0 , 0 ) ;\nfloat shadowAttenuation = 1.0 ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SCENE_DIRECT_LIGHT_COUNT"},"r":{"t":"def","m":"NEED_CALCULATE_SHADOWS"}},892],[0," \n"],[3,"SCENE_SHADOW_CASCADED_COUNT","==",1,888],[0," vec3 shadowCoord = shadowCoord ; \n"],[5,890],[0," vec3 shadowCoord = getShadowCoord(positionWS) ; \n"],[6],[0,"\nshadowAttenuation *= sampleShadowMap(positionWS, shadowCoord) ; \n"],[6],[0,"\nevaluateDirectRadiance(surfaceData, bsdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor) ;\nevaluateIBL(surfaceData, bsdfData, totalDiffuseColor, totalSpecularColor) ;\n\n"],[1,"LIGHTMAP_TEXTURE",900],[0," vec2 lightMapUV = uv ;\n\n"],[1,"RENDERER_HAS_UV1",898],[0," lightMapUV = uv1 ; \n"],[6],[0,"\ntotalDiffuseColor += texture2D ( u_lightMapTexture , lightMapUV ).rgb * u_lightMapIntensity * BRDF_Diffuse_Lambert(bsdfData.diffuseColor) ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_ENABLE_TRANSMISSION",904],[0," vec3 refractionTransmitted = evaluateTransmission(surfaceData, bsdfData) ;\ntotalDiffuseColor = mix ( totalDiffuseColor , refractionTransmitted , surfaceData.transmission ) ; \n"],[6],[0,"\nvec4 color = vec4 ( ( totalDiffuseColor + totalSpecularColor ).rgb , surfaceData.opacity ) ;\ncolor.rgb += surfaceData.emissiveColor ;\n\n"],[3,"SCENE_FOG_MODE","!=",0,908],[0," color = fog(color, positionVS) ; \n"],[6],[0,"\ngl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/grid/Grid.shaderc b/packages/custom-material/compiledShaders/grid/Grid.shaderc index a5f01ede..a6e93001 100644 --- a/packages/custom-material/compiledShaders/grid/Grid.shaderc +++ b/packages/custom-material/compiledShaders/grid/Grid.shaderc @@ -1 +1 @@ -{"name":"grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewInvMat;\nattribute vec4 POSITION_FLIP;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nbool flipY = camera_ProjectionParams.x < 0.0 ;\nfloat x = flipY ? POSITION_FLIP.z : POSITION_FLIP.x ;\nfloat y = flipY ? POSITION_FLIP.w : POSITION_FLIP.y ;\nnearPoint = UnprojectPoint(x, y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( x , y , 0.0 , 1.0 ) ;\n }\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ProjMat;\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n"],[6],[0,"\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) color.z = 1.0 ;\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) color.x = 1.0 ;\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ;\ngl_FragColor = sRGBToLinear(gl_FragColor) ; }"]]}]}]} \ No newline at end of file +{"name":"grid","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nuniform vec4 camera_ProjectionParams;\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_ViewInvMat;\nattribute vec4 POSITION_FLIP;\n\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\nvec3 UnprojectPoint ( float x, float y, float z, mat4 viewInvMat, mat4 projInvMat ) { vec4 unprojectedPoint = viewInvMat * projInvMat * vec4 ( x , y , z , 1.0 ) ;\nreturn unprojectedPoint.xyz / unprojectedPoint.w ; }\nvoid main() { \nfloat tol = 0.0001 ;\nmat4 viewInvMat = camera_ViewInvMat ;\nif ( abs ( viewInvMat[3][1] ) < tol ) { viewInvMat[3][1] = tol ; }\nmat4 projInvMat = INVERSE_MAT(camera_ProjMat) ;\nbool flipY = camera_ProjectionParams.x < 0.0 ;\nfloat x = flipY ? POSITION_FLIP.z : POSITION_FLIP.x ;\nfloat y = flipY ? POSITION_FLIP.w : POSITION_FLIP.y ;\nnearPoint = UnprojectPoint(x, y, - 1.0, viewInvMat, projInvMat) ;\nfarPoint = UnprojectPoint(x, y, 1.0, viewInvMat, projInvMat) ;\ngl_Position = vec4 ( x , y , 0.0 , 1.0 ) ;\n }\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ProjMat;\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\nfloat sRGBToLinear ( float value ) { float linearRGBLo = value / 12.92 ;\nfloat linearRGBHi = pow ( ( value + 0.055 ) / 1.055 , 2.4 ) ;\nfloat linearRGB = ( value <= 0.04045 ) ? linearRGBLo : linearRGBHi ;\nreturn linearRGB ; }\nvec4 sRGBToLinear ( vec4 value ) { return vec4 ( sRGBToLinear(value.r) , sRGBToLinear(value.g) , sRGBToLinear(value.b) , value.a ) ; }\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 nearPoint;\nvarying vec3 farPoint;\n\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n"],[6],[0,"\nuniform float u_far;\nuniform float u_near;\nuniform float u_primaryScale;\nuniform float u_secondaryScale;\nuniform float u_gridIntensity;\nuniform float u_axisIntensity;\nuniform float u_flipProgress;\nuniform float u_fade;\nvec4 grid ( vec3 fragPos3D, float scale, float fade ) { vec2 coord = mix ( fragPos3D.xz , fragPos3D.xy , u_flipProgress ) * scale ;\nvec2 derivative = fwidth ( coord ) ;\nvec2 grid = abs ( fract ( coord - 0.5 ) - 0.5 ) / derivative ;\nfloat line = min ( grid.x , grid.y ) ;\nfloat minimumz = min ( derivative.y , 1.0 ) ;\nfloat minimumx = min ( derivative.x , 1.0 ) ;\nvec4 color = vec4 ( u_gridIntensity , u_gridIntensity , u_gridIntensity , fade * ( 1.0 - min ( line , 1.0 ) ) ) ;\nif ( fragPos3D.x > - u_axisIntensity * minimumx && fragPos3D.x < u_axisIntensity * minimumx ) color.z = 1.0 ;\nfloat xy = mix ( fragPos3D.z , fragPos3D.y , u_flipProgress ) ;\nif ( xy > - u_axisIntensity * minimumz && xy < u_axisIntensity * minimumz ) color.x = 1.0 ;\nreturn color ; }\nfloat computeDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nreturn ( clip_space_pos.z / clip_space_pos.w ) * 0.5 + 0.5 ; }\nfloat computeLinearDepth ( vec3 pos ) { vec4 clip_space_pos = camera_ProjMat * camera_ViewMat * vec4 ( pos.xyz , 1.0 ) ;\nfloat clip_space_depth = clip_space_pos.z / clip_space_pos.w ;\nfloat linearDepth = ( 2.0 * u_near * u_far ) / ( u_far + u_near - clip_space_depth * ( u_far - u_near ) ) ;\nreturn linearDepth / u_far ; }\nvoid main() { float ty = - nearPoint.y / ( farPoint.y - nearPoint.y ) ;\nfloat tz = - nearPoint.z / ( farPoint.z - nearPoint.z ) ;\nfloat t = mix ( ty , tz , u_flipProgress ) ;\nvec3 fragPos3D = nearPoint + t * ( farPoint - nearPoint ) ;\ngl_FragDepth = computeDepth(fragPos3D) ;\nfloat linearDepth = computeLinearDepth(fragPos3D) ;\nfloat fading = max ( 0.0 , ( 0.5 - linearDepth ) ) ;\ngl_FragColor = ( grid(fragPos3D, u_primaryScale, u_fade) + grid(fragPos3D, u_secondaryScale, 1.0 - u_fade) ) ;\ngl_FragColor.a *= fading ;\ngl_FragColor = sRGBToLinear(gl_FragColor) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/plain-color/PlainColor.shaderc b/packages/custom-material/compiledShaders/plain-color/PlainColor.shaderc index c348e416..1a85206f 100644 --- a/packages/custom-material/compiledShaders/plain-color/PlainColor.shaderc +++ b/packages/custom-material/compiledShaders/plain-color/PlainColor.shaderc @@ -1 +1 @@ -{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"25":0},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","10":"depthEnabled","11":"depthWriteEnabled","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file +{"name":"plain-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"25":0},"variableMap":{"0":"blendEnabled","3":"sourceColorBlendFactor","4":"sourceAlphaBlendFactor","5":"destinationColorBlendFactor","6":"destinationAlphaBlendFactor","10":"depthEnabled","11":"depthWriteEnabled","28":"renderQueueType"}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",90],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/planar-shadow/PlanarShadow.shaderc b/packages/custom-material/compiledShaders/planar-shadow/PlanarShadow.shaderc index 9cd66162..1c86d658 100644 --- a/packages/custom-material/compiledShaders/planar-shadow/PlanarShadow.shaderc +++ b/packages/custom-material/compiledShaders/planar-shadow/PlanarShadow.shaderc @@ -1 +1 @@ -{"name":"PlanarShadow","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"pbr/Default/Forward","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"planarShadow","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"11":true,"13":true,"14":0,"17":2,"18":2,"19":6,"20":6,"21":0,"22":0,"23":0,"24":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform vec3 u_lightDir;\nuniform float u_planarHeight;\nuniform vec4 u_planarShadowColor;\nuniform float u_planarShadowFalloff;\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_VPMat;\n\n"],[1,"RENDERER_HAS_SKIN",11],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,9],[1,"RENDERER_BLENDSHAPE_COUNT",9],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\n\n"],[6],[0,"\nvec3 ShadowProjectPos ( vec4 vertPos ) { vec3 shadowPos ;\nvec3 worldPos = ( renderer_ModelMat * vertPos ).xyz ;\nshadowPos.y = min ( worldPos.y , u_planarHeight ) ;\nshadowPos.xz = worldPos.xz - u_lightDir.xz * max ( 0.0 , worldPos.y - u_planarHeight ) / u_lightDir.y ;\nreturn shadowPos ; }\nattribute vec4 POSITION;\nattribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\nvarying vec4 color;\n\nvoid main() { \nvec4 position = vec4 ( POSITION.xyz , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_SKIN",21],[0," \n"],[1,"RENDERER_USE_JOINT_TEXTURE",17],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,19],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec3 shadowPos = ShadowProjectPos(position) ;\ngl_Position = camera_VPMat * vec4 ( shadowPos , 1.0 ) ;\nvec3 center = vec3 ( renderer_ModelMat[3].x , u_planarHeight , renderer_ModelMat[3].z ) ;\nfloat falloff = 0.5 - clamp ( distance ( shadowPos , center ) * u_planarShadowFalloff , 0.0 , 1.0 ) ;\ncolor = u_planarShadowColor ;\ncolor.a *= falloff ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[1,"RENDERER_HAS_SKIN",11],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\n\n"],[5,9],[1,"RENDERER_BLENDSHAPE_COUNT",9],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 color;\n\nvoid main() { gl_FragColor = color ; }"]]}]}]} \ No newline at end of file +{"name":"PlanarShadow","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"PBR/Default/Forward Pass","isUsePass":true,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}}},{"name":"planarShadow","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"11":true,"13":true,"14":0,"17":2,"18":2,"19":6,"20":6,"21":0,"22":0,"23":0,"24":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform vec3 u_lightDir;\nuniform float u_planarHeight;\nuniform vec4 u_planarShadowColor;\nuniform float u_planarShadowFalloff;\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_VPMat;\n\n"],[1,"RENDERER_HAS_SKIN",11],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,9],[1,"RENDERER_BLENDSHAPE_COUNT",9],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\n\n"],[6],[0,"\nvec3 ShadowProjectPos ( vec4 vertPos ) { vec3 shadowPos ;\nvec3 worldPos = ( renderer_ModelMat * vertPos ).xyz ;\nshadowPos.y = min ( worldPos.y , u_planarHeight ) ;\nshadowPos.xz = worldPos.xz - u_lightDir.xz * max ( 0.0 , worldPos.y - u_planarHeight ) / u_lightDir.y ;\nreturn shadowPos ; }\nattribute vec4 POSITION;\nattribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\nvarying vec4 color;\n\nvoid main() { \nvec4 position = vec4 ( POSITION.xyz , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_SKIN",21],[0," \n"],[1,"RENDERER_USE_JOINT_TEXTURE",17],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,19],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec3 shadowPos = ShadowProjectPos(position) ;\ngl_Position = camera_VPMat * vec4 ( shadowPos , 1.0 ) ;\nvec3 center = vec3 ( renderer_ModelMat[3].x , u_planarHeight , renderer_ModelMat[3].z ) ;\nfloat falloff = 0.5 - clamp ( distance ( shadowPos , center ) * u_planarShadowFalloff , 0.0 , 1.0 ) ;\ncolor = u_planarShadowColor ;\ncolor.a *= falloff ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[1,"RENDERER_HAS_SKIN",11],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",6],[0,"\n\n"],[5,9],[1,"RENDERER_BLENDSHAPE_COUNT",9],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 color;\n\nvoid main() { gl_FragColor = color ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/water/Water.shaderc b/packages/custom-material/compiledShaders/water/Water.shaderc index 128892f2..52c31e15 100644 --- a/packages/custom-material/compiledShaders/water/Water.shaderc +++ b/packages/custom-material/compiledShaders/water/Water.shaderc @@ -1 +1 @@ -{"name":"water","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * sin ( u_time ) , u_water_speed.y * cos ( u_time ) ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_edgeTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 edgeTex = texture2D ( u_edgeTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat edge = pow ( ( v_color.r + edgeTex.r ) * v_color.r , 2.0 ) ;\nedge = saturate(1.0 - smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edge )) ;\nvec4 finalCol = mix ( waterTex , u_edgeColor , edge ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file +{"name":"water","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * sin ( u_time ) , u_water_speed.y * cos ( u_time ) ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,94],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec4 v_color;\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_edgeTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 edgeTex = texture2D ( u_edgeTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat edge = pow ( ( v_color.r + edgeTex.r ) * v_color.r , 2.0 ) ;\nedge = saturate(1.0 - smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edge )) ;\nvec4 finalCol = mix ( waterTex , u_edgeColor , edge ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/water/WaterFall.shaderc b/packages/custom-material/compiledShaders/water/WaterFall.shaderc index 362e5f65..35e66c8c 100644 --- a/packages/custom-material/compiledShaders/water/WaterFall.shaderc +++ b/packages/custom-material/compiledShaders/water/WaterFall.shaderc @@ -1 +1 @@ -{"name":"water-fall","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_waterfall_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * u_time , u_water_speed.y * u_time ) ;\nwaterfallTexCoords = TEXCOORD_0 + vec2 ( u_waterfall_speed.x * u_time , u_waterfall_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_waterfallTex;\nuniform sampler2D u_edgeNoiseTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 waterfallTex = texture2D ( u_waterfallTex , waterfallTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 streamEdge = texture2D ( u_edgeNoiseTex , waterTexCoords ) ;\nvec4 fallEdge = texture2D ( u_edgeNoiseTex , waterfallTexCoords ) ;\nfloat edgeShape = mix ( fallEdge.r , streamEdge.r , v_color.r ) ;\nedgeShape = saturate(edgeShape * v_color.g) ;\nedgeShape = saturate(smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edgeShape )) ;\nvec4 waterAll = mix ( waterfallTex , waterTex , v_color.r ) ;\nvec4 finalCol = mix ( waterAll , u_edgeColor , edgeShape ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file +{"name":"water-fall","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_water_speed;\nuniform vec2 u_waterfall_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_water_speed.x * u_time , u_water_speed.y * u_time ) ;\nwaterfallTexCoords = TEXCOORD_0 + vec2 ( u_waterfall_speed.x * u_time , u_waterfall_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,94],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 waterfallTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_waterTex;\nuniform sampler2D u_waterfallTex;\nuniform sampler2D u_edgeNoiseTex;\nuniform vec4 u_edgeColor;\nuniform vec2 u_edgeParam;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_waterTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 waterfallTex = texture2D ( u_waterfallTex , waterfallTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nvec4 streamEdge = texture2D ( u_edgeNoiseTex , waterTexCoords ) ;\nvec4 fallEdge = texture2D ( u_edgeNoiseTex , waterfallTexCoords ) ;\nfloat edgeShape = mix ( fallEdge.r , streamEdge.r , v_color.r ) ;\nedgeShape = saturate(edgeShape * v_color.g) ;\nedgeShape = saturate(smoothstep ( u_edgeParam.x - u_edgeParam.y , u_edgeParam.x + u_edgeParam.y , edgeShape )) ;\nvec4 waterAll = mix ( waterfallTex , waterTex , v_color.r ) ;\nvec4 finalCol = mix ( waterAll , u_edgeColor , edgeShape ) ;\ngl_FragColor = finalCol ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/compiledShaders/water/WaterRipple.shaderc b/packages/custom-material/compiledShaders/water/WaterRipple.shaderc index 18566e23..f7bff082 100644 --- a/packages/custom-material/compiledShaders/water/WaterRipple.shaderc +++ b/packages/custom-material/compiledShaders/water/WaterRipple.shaderc @@ -1 +1 @@ -{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,94],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file +{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,94],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/framebuffer-picker/compiledShaders/FramebufferPickerColor.shaderc b/packages/framebuffer-picker/compiledShaders/FramebufferPickerColor.shaderc index 3fe70137..fddfa1df 100644 --- a/packages/framebuffer-picker/compiledShaders/FramebufferPickerColor.shaderc +++ b/packages/framebuffer-picker/compiledShaders/FramebufferPickerColor.shaderc @@ -1 +1 @@ -{"name":"framebuffer-picker-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec3 u_pickColor;\nvoid main() { gl_FragColor = vec4 ( u_pickColor , 1.0 ) ; }"]]}]}]} \ No newline at end of file +{"name":"framebuffer-picker-color","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { vec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec3 u_pickColor;\nvoid main() { gl_FragColor = vec4 ( u_pickColor , 1.0 ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/geometry-sketch/compiledShaders/material/TBN.shaderc b/packages/geometry-sketch/compiledShaders/material/TBN.shaderc index 5cecec02..434816f9 100644 --- a/packages/geometry-sketch/compiledShaders/material/TBN.shaderc +++ b/packages/geometry-sketch/compiledShaders/material/TBN.shaderc @@ -1 +1 @@ -{"name":"tbnShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float u_lineScale;\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform mat4 u_worldNormal;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { int pointIndex = gl_VertexID / 2 ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},156],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\ngl_Position.xyz += normalize ( normalW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},160],[0," if ( gl_VertexID % 2 == 1 ) { vec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\ngl_Position.xyz += normalize ( tangentW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"SHOW_BITANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},164],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\nvec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\nvec3 bitangentW = cross ( normalW , tangentW ) * tangent.w ;\ngl_Position.xyz += normalize ( bitangentW ) * u_lineScale ; } \n"],[6],[0,"\ngl_Position = camera_VPMat * gl_Position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { gl_FragColor = material_BaseColor ; }"]]}]}]} \ No newline at end of file +{"name":"tbnShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform float u_lineScale;\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform mat4 u_worldNormal;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { int pointIndex = gl_VertexID / 2 ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},156],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\ngl_Position.xyz += normalize ( normalW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"SHOW_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},160],[0," if ( gl_VertexID % 2 == 1 ) { vec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\ngl_Position.xyz += normalize ( tangentW ) * u_lineScale ; } \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"and","l":{"t":"def","m":"SHOW_BITANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},164],[0," if ( gl_VertexID % 2 == 1 ) { vec3 normalW = normalize ( mat3 ( u_worldNormal ) * normal.xyz ) ;\nvec3 tangentW = normalize ( mat3 ( u_worldNormal ) * tangent.xyz ) ;\nvec3 bitangentW = cross ( normalW , tangentW ) * tangent.w ;\ngl_Position.xyz += normalize ( bitangentW ) * u_lineScale ; } \n"],[6],[0,"\ngl_Position = camera_VPMat * gl_Position ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 material_BaseColor;\nvoid main() { gl_FragColor = material_BaseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc b/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc index 97b67197..01e70c02 100644 --- a/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc +++ b/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc @@ -1 +1 @@ -{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file +{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file diff --git a/packages/gizmo/compiledShaders/icon/Icon.shaderc b/packages/gizmo/compiledShaders/icon/Icon.shaderc index c0096bbc..aaedd808 100644 --- a/packages/gizmo/compiledShaders/icon/Icon.shaderc +++ b/packages/gizmo/compiledShaders/icon/Icon.shaderc @@ -1 +1 @@ -{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"10":false,"25":0},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file +{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"10":false,"25":0},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/compiledShaders/OutlinePostprocess.shaderc b/packages/outline/compiledShaders/OutlinePostprocess.shaderc index 22194ebb..67df026e 100644 --- a/packages/outline/compiledShaders/OutlinePostprocess.shaderc +++ b/packages/outline/compiledShaders/OutlinePostprocess.shaderc @@ -1 +1 @@ -{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,34],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file +{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,90],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/compiledShaders/OutlineReplace.shaderc b/packages/outline/compiledShaders/OutlineReplace.shaderc index 13b40492..200fce24 100644 --- a/packages/outline/compiledShaders/OutlineReplace.shaderc +++ b/packages/outline/compiledShaders/OutlineReplace.shaderc @@ -1 +1 @@ -{"name":"outline-replace-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { Varyings v ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ;\nreturn v ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp( a, 0.0, 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse(mat)"],[0,"\n\n"],[5,28],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 camera_OutlineReplaceColor;\nvoid main() { gl_FragColor = camera_OutlineReplaceColor ; }"]]}]}]} \ No newline at end of file +{"name":"outline-replace-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",136],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",134],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\nuniform mediump sampler2DArray renderer_BlendShapeTexture;\nuniform ivec3 renderer_BlendShapeTextureInfo;\nuniform float renderer_BlendShapeWeights [ RENDERER_BLENDSHAPE_COUNT ];\nvec3 getBlendShapeVertexElement ( int blendShapeIndex, int vertexElementIndex ) { int y = vertexElementIndex / renderer_BlendShapeTextureInfo.y ;\nint x = vertexElementIndex - y * renderer_BlendShapeTextureInfo.y ;\nivec3 uv = ivec3 ( x , y , blendShapeIndex ) ;\nreturn ( texelFetch ( renderer_BlendShapeTexture , uv , 0 ) ).xyz ; }\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\nuniform float renderer_BlendShapeWeights [ 2 ];\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\nuniform float renderer_BlendShapeWeights [ 4 ];\n\n"],[5,78],[0,"\nuniform float renderer_BlendShapeWeights [ 8 ];\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid calculateBlendShape ( inout vec4 position\n"],[1,"RENDERER_HAS_NORMAL",90],[0," , inout vec3 normal \n"],[1,"RENDERER_HAS_TANGENT",88],[0," , inout vec4 tangent \n"],[6],[0," \n"],[6],[0," ) { \n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",102],[0," int vertexOffset = gl_VertexID * renderer_BlendShapeTextureInfo.x ;\nfor ( int i = 0 ; i < RENDERER_BLENDSHAPE_COUNT ; i ++ ) { int vertexElementOffset = vertexOffset ;\nfloat weight = renderer_BlendShapeWeights[i] ;\nif ( weight != 0.0 ) { position.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"}},96],[0," vertexElementOffset += 1 ;\nnormal += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},100],[0," vertexElementOffset += 1 ;\ntangent.xyz += getBlendShapeVertexElement(i, vertexElementOffset) * weight ; \n"],[6],[0," } } \n"],[5,132],[0," position.xyz += POSITION_BS0 * renderer_BlendShapeWeights[0] ;\nposition.xyz += POSITION_BS1 * renderer_BlendShapeWeights[1] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},114],[0," \n"],[1,"RENDERER_HAS_NORMAL",108],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",112],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ; \n"],[6],[0," \n"],[5,130],[0," \n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},126],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_HAS_NORMAL"}},120],[0," normal += NORMAL_BS0 * renderer_BlendShapeWeights[0] ;\nnormal += NORMAL_BS1 * renderer_BlendShapeWeights[1] ;\nnormal += NORMAL_BS2 * renderer_BlendShapeWeights[2] ;\nnormal += NORMAL_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"},"r":{"t":"def","m":"RENDERER_HAS_TANGENT"}},124],[0," tangent.xyz += TANGENT_BS0 * renderer_BlendShapeWeights[0] ;\ntangent.xyz += TANGENT_BS1 * renderer_BlendShapeWeights[1] ;\ntangent.xyz += TANGENT_BS2 * renderer_BlendShapeWeights[2] ;\ntangent.xyz += TANGENT_BS3 * renderer_BlendShapeWeights[3] ; \n"],[6],[0," \n"],[5,128],[0," position.xyz += POSITION_BS2 * renderer_BlendShapeWeights[2] ;\nposition.xyz += POSITION_BS3 * renderer_BlendShapeWeights[3] ;\nposition.xyz += POSITION_BS4 * renderer_BlendShapeWeights[4] ;\nposition.xyz += POSITION_BS5 * renderer_BlendShapeWeights[5] ;\nposition.xyz += POSITION_BS6 * renderer_BlendShapeWeights[6] ;\nposition.xyz += POSITION_BS7 * renderer_BlendShapeWeights[7] ; \n"],[6],[0," \n"],[6],[0," \n"],[6],[0," }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",194],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",168],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",166],[0,"attribute vec3 POSITION_BS0;\nattribute vec3 POSITION_BS1;\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},148],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\n\n"],[5,164],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},160],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\n\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",154],[0,"attribute vec3 NORMAL_BS0;\nattribute vec3 NORMAL_BS1;\nattribute vec3 NORMAL_BS2;\nattribute vec3 NORMAL_BS3;\n\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",158],[0,"attribute vec3 TANGENT_BS0;\nattribute vec3 TANGENT_BS1;\nattribute vec3 TANGENT_BS2;\nattribute vec3 TANGENT_BS3;\n\n"],[6],[0,"\n"],[5,162],[0,"attribute vec3 POSITION_BS2;\nattribute vec3 POSITION_BS3;\nattribute vec3 POSITION_BS4;\nattribute vec3 POSITION_BS5;\nattribute vec3 POSITION_BS6;\nattribute vec3 POSITION_BS7;\n\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",172],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",176],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",180],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",184],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",188],[0,"attribute vec3 NORMAL;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",192],[0,"attribute vec4 TANGENT;\n\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { Varyings v ;\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",202],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",200],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",214],[0," calculateBlendShape(position\n"],[1,"RENDERER_HAS_NORMAL",212],[0," , normal \n"],[1,"RENDERER_HAS_TANGENT",210],[0," , tangent \n"],[6],[0," \n"],[6],[0,") ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",218],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = renderer_MVPMat * position ;\nreturn v ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec4 camera_OutlineReplaceColor;\nvoid main() { gl_FragColor = camera_OutlineReplaceColor ; }"]]}]}]} \ No newline at end of file From 25c992d8a263886db08cad74e8253f605b54727c Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Wed, 13 May 2026 19:30:53 +0800 Subject: [PATCH 22/27] fix(toolkit): restore Pass-level render state for alpha-blended materials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ShaderLab migration left several toolkit shaders with no Pass-level BlendState / DepthState / RenderQueueType declarations. Their materials relied on `material.isTransparent = true` (BaseMaterial setter), which now only writes shader vars like `blendEnabled` — vars that don't exist in these shaders' Pass declarations. The Pass falls back to opaque defaults, producing silent visual regressions: - outline/OutlinePostprocess: fullscreen quad overwrote scene with black (vec4(0) for non-edge pixels with no blend) - gizmo/icon/Icon: icon billboards rendered as opaque rectangles - controls/BoxSelection: selection overlay opaque - custom-material/WaterRipple: water surface opaque - geometry-sketch/Wireframe: wireframe overlay opaque Pin the blend / depth / queue state in the shader Pass itself, mirroring the editor-side fix for the same OutlinePostprocess shader. Skeleton viewer left alone — its material never sets isTransparent, the existing const state matches intent. Regenerates corresponding .shaderc artifacts. --- .../box-selection/BoxSelection.shaderc | 2 +- .../src/box-selection/BoxSelection.shader | 14 +++++++++++++ .../compiledShaders/water/WaterRipple.shaderc | 2 +- .../src/water/WaterRipple.shader | 14 +++++++++++++ .../material/Wireframe.shaderc | 2 +- .../src/material/Wireframe.shader | 14 +++++++++++++ .../gizmo/compiledShaders/icon/Icon.shaderc | 2 +- packages/gizmo/src/icon/Icon.shader | 10 ++++++++++ .../OutlinePostprocess.shaderc | 2 +- .../outline/src/OutlinePostprocess.shader | 20 +++++++++++++++++++ 10 files changed, 77 insertions(+), 5 deletions(-) diff --git a/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc b/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc index ff90651f..e2fd90ef 100644 --- a/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc +++ b/packages/controls/compiledShaders/box-selection/BoxSelection.shaderc @@ -1 +1 @@ -{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file +{"name":"box","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"10":false,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",94],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",68],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",66],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},48],[0,"\n"],[5,64],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},60],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",54],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",58],[0,"\n"],[6],[0,"\n"],[5,62],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",72],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",80],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",84],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",88],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",92],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvoid main() { gl_Position = vec4 ( POSITION , 1.0 ) ; }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",42],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nuniform vec2 u_min;\nuniform vec2 u_max;\nuniform vec4 u_boxColor;\nuniform vec4 u_borderColor;\nuniform float u_width;\nvoid main() { float vColor = step ( u_min.x + u_width , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x - u_width ) * step ( u_min.y + u_width , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y - u_width ) ;\nfloat vBorder = step ( u_min.x , gl_FragCoord.x ) * step ( gl_FragCoord.x , u_max.x ) * step ( u_min.y , gl_FragCoord.y ) * step ( gl_FragCoord.y , u_max.y ) ;\ngl_FragColor = u_boxColor * vColor + ( 1. - vColor ) * vBorder * u_borderColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/controls/src/box-selection/BoxSelection.shader b/packages/controls/src/box-selection/BoxSelection.shader index 0de67295..daf6592a 100644 --- a/packages/controls/src/box-selection/BoxSelection.shader +++ b/packages/controls/src/box-selection/BoxSelection.shader @@ -1,6 +1,20 @@ Shader "box" { SubShader "Default" { Pass "Forward" { + DepthState = { + Enabled = false; + } + + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.One; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/custom-material/compiledShaders/water/WaterRipple.shaderc b/packages/custom-material/compiledShaders/water/WaterRipple.shaderc index f7bff082..5814649a 100644 --- a/packages/custom-material/compiledShaders/water/WaterRipple.shaderc +++ b/packages/custom-material/compiledShaders/water/WaterRipple.shaderc @@ -1 +1 @@ -{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,94],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file +{"name":"water-ripple","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"11":false,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"uniform mat4 renderer_MVPMat;\nuniform float u_time;\nuniform vec2 u_foam_speed;\nuniform vec2 u_distorsion_speed;\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"attribute vec4 COLOR_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\nvoid main() { \ngl_Position = renderer_MVPMat * vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," waterTexCoords = TEXCOORD_0 + vec2 ( u_foam_speed.x * u_time , u_foam_speed.y * u_time ) ;\nnormalTexCoords = TEXCOORD_0 + vec2 ( u_distorsion_speed.x * cos ( u_time ) , u_distorsion_speed.y * sin ( u_time ) ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",66],[0," v_color = COLOR_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",96],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",90],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,94],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 waterTexCoords;\nvarying vec2 normalTexCoords;\nvarying vec4 v_color;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform sampler2D material_NormalTexture;\nuniform sampler2D u_foamTex;\nuniform vec3 u_foamColor;\nuniform vec2 u_foam_param;\nuniform float u_distorsion_amount;\nvoid main() { vec4 normalTex = texture2D ( material_NormalTexture , normalTexCoords ) * 2.0 - 1.0 ;\nvec4 waterTex = texture2D ( u_foamTex , waterTexCoords + ( normalTex.rg * u_distorsion_amount ) ) ;\nfloat alphaComp = v_color.r * waterTex.r * u_foam_param.x ;\nfloat alpha = pow ( alphaComp , 2.0 ) ;\nalpha = smoothstep ( 0.5 - u_foam_param.y , 0.5 + u_foam_param.y , alpha ) ;\nalpha = saturate(alpha) ;\ngl_FragColor = vec4 ( u_foamColor.rgb , alpha ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/custom-material/src/water/WaterRipple.shader b/packages/custom-material/src/water/WaterRipple.shader index fec6d943..c0c56815 100644 --- a/packages/custom-material/src/water/WaterRipple.shader +++ b/packages/custom-material/src/water/WaterRipple.shader @@ -1,6 +1,20 @@ Shader "water-ripple" { SubShader "Default" { Pass "Forward" { + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.One; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + } + + DepthState = { + WriteEnabled = false; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc b/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc index 01e70c02..de9fcf01 100644 --- a/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc +++ b/packages/geometry-sketch/compiledShaders/material/Wireframe.shaderc @@ -1 +1 @@ -{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file +{"name":"wireframeShader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"11":false,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 camera_VPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform mat4 camera_VPMat;\nuniform mat4 u_worldMatrix;\nuniform sampler2D u_verticesSampler;\nuniform float u_verticesTextureWidth;\nuniform float u_verticesTextureHeight;\nuniform sampler2D u_indicesSampler;\nuniform float u_indicesTextureWidth;\nuniform float u_indicesTextureHeight;\nvec4 getVertexElement ( float row, float col ) { return texture2D ( u_verticesSampler , vec2 ( ( col + 0.5 ) / u_verticesTextureWidth , ( row + 0.5 ) / u_verticesTextureHeight ) ) ; }\nvec3 getIndicesElement ( float row, float col ) { return texture2D ( u_indicesSampler , vec2 ( ( col + 0.5 ) / u_indicesTextureWidth , ( row + 0.5 ) / u_indicesTextureHeight ) ).xyz ; }\nvec2 getVec2 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nreturn vec2 ( x , y ) ; }\nvec3 getVec3 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nreturn vec3 ( x , y , z ) ; }\nvec4 getVec4 ( inout vec4 [ ELEMENT_COUNT ] rows, inout int row_index, inout int value_index ) { row_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat x = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat y = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat z = rows[row_index][value_index] ;\nrow_index += ( value_index + 1 ) / 4 ;\nvalue_index = ( value_index + 1 ) % 4 ;\nfloat w = rows[row_index][value_index] ;\nreturn vec4 ( x , y , z , w ) ; }\n\n"],[2,"ATTRIBUTES_INCLUDED",116],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",90],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",88],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n"],[5,86],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},82],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",76],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",80],[0,"\n"],[6],[0,"\n"],[5,84],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",94],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",98],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",102],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",106],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",110],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",114],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nvoid main() { \nint indicesIndex = gl_VertexID / 3 ;\nint indicesRow = indicesIndex / int ( u_indicesTextureWidth ) ;\nint indicesCol = indicesIndex % int ( u_indicesTextureWidth ) ;\nvec3 triangleIndices = getIndicesElement(float ( indicesRow ), float ( indicesCol )) ;\nint subIndex = gl_VertexID % 3 ;\nv_baryCenter = vec3 ( 0.0 ) ;\nv_baryCenter[subIndex] = 1.0 ;\nint pointIndex = int ( triangleIndices[subIndex] ) ;\nint row = pointIndex * ELEMENT_COUNT / int ( u_verticesTextureWidth ) ;\nint col = pointIndex * ELEMENT_COUNT % int ( u_verticesTextureWidth ) ;\nvec4 rows [ ELEMENT_COUNT ] ;\nfor ( int i = 0 ; i < ELEMENT_COUNT ; i ++ ) { rows[i] = getVertexElement(float ( row ), float ( col + i )) ; }\nvec3 POSITION = vec3 ( rows[0].x , rows[0].y , rows[0].z ) ;\nint row_index = 0 ;\nint value_index = 2 ;\n\n"],[1,"RENDERER_HAS_NORMAL",120],[0," vec3 NORMAL = getVec3(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_VERTEXCOLOR",124],[0," vec4 COLOR_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_WEIGHT",128],[0," vec4 WEIGHTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_JOINT",132],[0," vec4 JOINTS_0 = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_TANGENT",136],[0," vec4 TANGENT = getVec4(rows, row_index, value_index) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_UV",140],[0," vec2 TEXCOORD_0 = getVec2(rows, row_index, value_index) ; \n"],[6],[0,"\nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_NORMAL",148],[0," vec3 normal = vec3 ( NORMAL ) ;\n\n"],[1,"RENDERER_HAS_TANGENT",146],[0," vec4 tangent = vec4 ( TANGENT ) ; \n"],[6],[0," \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\ngl_Position = u_worldMatrix * position ;\ngl_Position = camera_VPMat * gl_Position ;\n }"]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec3 v_baryCenter;\n\nuniform vec4 material_BaseColor;\nfloat edgeFactor ( vec3 baryCenter ) { vec3 d = fwidth ( baryCenter ) ;\nvec3 a3 = smoothstep ( vec3 ( 0.0 ) , d * 1.5 , baryCenter ) ;\nreturn min ( min ( a3.x , a3.y ) , a3.z ) ; }\nvoid main() { if ( gl_FrontFacing ) { gl_FragColor = vec4 ( material_BaseColor.xyz , 1.0 - edgeFactor(v_baryCenter) ) ; } else { gl_FragColor = vec4 ( material_BaseColor.xyz , ( 1.0 - edgeFactor(v_baryCenter) ) * 0.3 ) ; } }"]]}]}]} \ No newline at end of file diff --git a/packages/geometry-sketch/src/material/Wireframe.shader b/packages/geometry-sketch/src/material/Wireframe.shader index 90894554..2c2f1732 100644 --- a/packages/geometry-sketch/src/material/Wireframe.shader +++ b/packages/geometry-sketch/src/material/Wireframe.shader @@ -1,6 +1,20 @@ Shader "wireframeShader" { SubShader "Default" { Pass "Forward" { + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.One; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + } + + DepthState = { + WriteEnabled = false; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/gizmo/compiledShaders/icon/Icon.shaderc b/packages/gizmo/compiledShaders/icon/Icon.shaderc index aaedd808..88ac0ffe 100644 --- a/packages/gizmo/compiledShaders/icon/Icon.shaderc +++ b/packages/gizmo/compiledShaders/icon/Icon.shaderc @@ -1 +1 @@ -{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"10":false,"25":0},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file +{"name":"icon","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"10":false,"25":0,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\nuniform mat4 renderer_MVPMat;\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",58],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",56],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\nuniform sampler2D renderer_JointSampler;\nuniform float renderer_JointCount;\nmat4 getJointMatrix ( sampler2D smp, float index ) { float base = index / renderer_JointCount ;\nfloat hf = 0.5 / renderer_JointCount ;\nfloat v = base + hf ;\nvec4 m0 = texture2D ( smp , vec2 ( 0.125 , v ) ) ;\nvec4 m1 = texture2D ( smp , vec2 ( 0.375 , v ) ) ;\nvec4 m2 = texture2D ( smp , vec2 ( 0.625 , v ) ) ;\nvec4 m3 = texture2D ( smp , vec2 ( 0.875 , v ) ) ;\nreturn mat4 ( m0 , m1 , m2 , m3 ) ; }\n\n"],[5,48],[0,"\nuniform mat4 renderer_JointMatrix [ RENDERER_JOINTS_NUM ];\n\n"],[6],[0,"\nmat4 getSkinMatrix ( ) { \n"],[1,"RENDERER_USE_JOINT_TEXTURE",52],[0," mat4 skinMatrix = WEIGHTS_0.x * getJointMatrix(renderer_JointSampler, JOINTS_0.x) + WEIGHTS_0.y * getJointMatrix(renderer_JointSampler, JOINTS_0.y) + WEIGHTS_0.z * getJointMatrix(renderer_JointSampler, JOINTS_0.z) + WEIGHTS_0.w * getJointMatrix(renderer_JointSampler, JOINTS_0.w) ; \n"],[5,54],[0," mat4 skinMatrix = WEIGHTS_0.x * renderer_JointMatrix[int ( JOINTS_0.x )] + WEIGHTS_0.y * renderer_JointMatrix[int ( JOINTS_0.y )] + WEIGHTS_0.z * renderer_JointMatrix[int ( JOINTS_0.z )] + WEIGHTS_0.w * renderer_JointMatrix[int ( JOINTS_0.w )] ; \n"],[6],[0,"\nreturn skinMatrix ; }\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",86],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",84],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",68],[0,"\n\n"],[5,82],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},72],[0,"\n\n"],[5,80],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},76],[0,"\n\n"],[5,78],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec2 u_size;\nuniform vec4 u_pixelViewport;\n\n"],[2,"ATTRIBUTES_INCLUDED",144],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",118],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",116],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},98],[0,"\n"],[5,114],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},110],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",104],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",108],[0,"\n"],[6],[0,"\n"],[5,112],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",122],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",126],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",130],[0,"attribute vec4 JOINTS_0;\nattribute vec4 WEIGHTS_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",134],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",138],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",142],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \nvec4 position = vec4 ( POSITION , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",148],[0," calculateBlendShape ( attr , position ) ; \n"],[6],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",152],[0," mat4 skinMatrix = getSkinMatrix() ;\nposition = skinMatrix * position ; \n"],[6],[0,"\nvec4 translation = renderer_MVPMat[3] ;\ntranslation = translation / translation.w ;\nfloat xFactor = u_size.x / u_pixelViewport.z * 2.0 ;\nfloat yFactor = u_size.y / u_pixelViewport.w * 2.0 ;\ngl_Position = vec4 ( translation.x + xFactor * position.x , translation.y + yFactor * position.y , translation.z , 1 ) ;\n\n"],[1,"RENDERER_HAS_UV",156],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",160],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"COMMON_INCLUDED",30],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",24],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,28],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"TRANSFORM_INCLUDED",36],[0,"\n\n"],[7,"TRANSFORM_INCLUDED"],[0,"\n\n"],[6],[0,"\n\n"],[2,"SKIN_INCLUDED",52],[0,"\n\n"],[7,"SKIN_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_SKIN",50],[0,"\n\n"],[1,"RENDERER_USE_JOINT_TEXTURE",46],[0,"\n\n"],[5,48],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"BLENDSHAPE_INCLUDED",80],[0,"\n\n"],[7,"BLENDSHAPE_INCLUDED"],[0,"\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",78],[0,"\n\n"],[1,"RENDERER_BLENDSHAPE_USE_TEXTURE",62],[0,"\n\n"],[5,76],[0,"\n\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},66],[0,"\n\n"],[5,74],[0,"\n\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},70],[0,"\n\n"],[5,72],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\n\n"],[2,"ATTRIBUTES_INCLUDED",86],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nuniform vec4 material_BaseColor;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",90],[0,"\nuniform sampler2D material_BaseTexture;\n\n"],[6],[0,"\nvoid main() { vec4 baseColor = material_BaseColor ;\n\n"],[1,"MATERIAL_HAS_BASETEXTURE",94],[0," vec4 textureColor = texture2D ( material_BaseTexture , v_uv ) ;\nbaseColor.a *= textureColor.a ; \n"],[6],[0,"\n\n"],[1,"MATERIAL_IS_ALPHA_CUTOFF",98],[0," if ( baseColor.a < material_AlphaCutoff ) { discard ; } \n"],[6],[0,"\ngl_FragColor = baseColor ; }"]]}]}]} \ No newline at end of file diff --git a/packages/gizmo/src/icon/Icon.shader b/packages/gizmo/src/icon/Icon.shader index 12d8d114..186cf7e2 100644 --- a/packages/gizmo/src/icon/Icon.shader +++ b/packages/gizmo/src/icon/Icon.shader @@ -9,6 +9,16 @@ Shader "icon" { CullMode = CullMode.Off; } + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.One; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; diff --git a/packages/outline/compiledShaders/OutlinePostprocess.shaderc b/packages/outline/compiledShaders/OutlinePostprocess.shaderc index 67df026e..ddbf2697 100644 --- a/packages/outline/compiledShaders/OutlinePostprocess.shaderc +++ b/packages/outline/compiledShaders/OutlinePostprocess.shaderc @@ -1 +1 @@ -{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,90],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file +{"name":"outline-postprocess-shader","platformTarget":0,"subShaders":[{"name":"Default","tags":{},"passes":[{"name":"Forward","isUsePass":false,"tags":{},"renderStates":{"constantMap":{"0":true,"3":6,"4":1,"5":7,"6":7,"10":false,"11":false,"28":2},"variableMap":{}},"vertexShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",58],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\nattribute vec3 POSITION;\n\n"],[1,"RENDERER_HAS_BLENDSHAPE",32],[0,"\n"],[2,"RENDERER_BLENDSHAPE_USE_TEXTURE",30],[0,"\n"],[4,{"t":"and","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},12],[0,"\n"],[5,28],[0,"\n"],[4,{"t":"or","l":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_NORMAL"},"r":{"t":"def","m":"RENDERER_BLENDSHAPE_HAS_TANGENT"}},24],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_NORMAL",18],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_BLENDSHAPE_HAS_TANGENT",22],[0,"\n"],[6],[0,"\n"],[5,26],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV",36],[0,"attribute vec2 TEXCOORD_0;\n\n"],[6],[0,"\n"],[1,"RENDERER_HAS_UV1",40],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_SKIN",44],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_ENABLE_VERTEXCOLOR",48],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_NORMAL",52],[0,"\n"],[6],[0,"\n"],[1,"RENDERER_HAS_TANGENT",56],[0,"\n"],[6],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\nvoid main() { \ngl_Position = vec4 ( POSITION.xzy , 1.0 ) ;\n\n"],[1,"RENDERER_HAS_UV",62],[0," v_uv = TEXCOORD_0 ; \n"],[6],[0,"\n }\n\n"],[2,"COMMON_INCLUDED",92],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",86],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,90],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6]],"fragmentShaderInstructions":[[0,"\n"],[2,"ATTRIBUTES_INCLUDED",6],[0,"\n\n"],[7,"ATTRIBUTES_INCLUDED"],[0,"\n\n"],[6],[0,"\nvarying vec2 v_uv;\n\n\n"],[2,"COMMON_INCLUDED",36],[0,"\n\n"],[7,"COMMON_INCLUDED"],[0,"\n\n"],[8,"PI","3.14159265359"],[0,"\n\n"],[8,"RECIPROCAL_PI","0.31830988618"],[0,"\n\n"],[8,"EPSILON","1e-6"],[0,"\n\n"],[8,"LOG2","1.442695"],[0,"\n\n"],[8,"HALF_MIN","6.103515625e-5"],[0,"\n\n"],[8,"HALF_EPS","4.8828125e-4"],[0,"\n\n"],[9,"saturate",["a"],"clamp ( a , 0.0 , 1.0 )"],[0,"\n\n"],[1,"GRAPHICS_API_WEBGL2",30],[0,"\n\n"],[9,"INVERSE_MAT",["mat"],"inverse ( mat )"],[0,"\n\n"],[5,34],[0,"\nmat2 inverseMat ( mat2 m ) { return mat2 ( m[1][1] , - m[0][1] , - m[1][0] , m[0][0] ) / ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) ; }\nmat3 inverseMat ( mat3 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] ;\nfloat a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] ;\nfloat a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] ;\nfloat b01 = a22 * a11 - a12 * a21 ;\nfloat b11 = - a22 * a10 + a12 * a20 ;\nfloat b21 = a21 * a10 - a11 * a20 ;\nfloat det = a00 * b01 + a01 * b11 + a02 * b21 ;\nreturn mat3 ( b01 , ( - a22 * a01 + a02 * a21 ) , ( a12 * a01 - a02 * a11 ) , b11 , ( a22 * a00 - a02 * a20 ) , ( - a12 * a00 + a02 * a10 ) , b21 , ( - a21 * a00 + a01 * a20 ) , ( a11 * a00 - a01 * a10 ) ) / det ; }\nmat4 inverseMat ( mat4 m ) { float a00 = m[0][0] , a01 = m[0][1] , a02 = m[0][2] , a03 = m[0][3] , a10 = m[1][0] , a11 = m[1][1] , a12 = m[1][2] , a13 = m[1][3] , a20 = m[2][0] , a21 = m[2][1] , a22 = m[2][2] , a23 = m[2][3] , a30 = m[3][0] , a31 = m[3][1] , a32 = m[3][2] , a33 = m[3][3] , b00 = a00 * a11 - a01 * a10 , b01 = a00 * a12 - a02 * a10 , b02 = a00 * a13 - a03 * a10 , b03 = a01 * a12 - a02 * a11 , b04 = a01 * a13 - a03 * a11 , b05 = a02 * a13 - a03 * a12 , b06 = a20 * a31 - a21 * a30 , b07 = a20 * a32 - a22 * a30 , b08 = a20 * a33 - a23 * a30 , b09 = a21 * a32 - a22 * a31 , b10 = a21 * a33 - a23 * a31 , b11 = a22 * a33 - a23 * a32 , det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06 ;\nreturn mat4 ( a11 * b11 - a12 * b10 + a13 * b09 , a02 * b10 - a01 * b11 - a03 * b09 , a31 * b05 - a32 * b04 + a33 * b03 , a22 * b04 - a21 * b05 - a23 * b03 , a12 * b08 - a10 * b11 - a13 * b07 , a00 * b11 - a02 * b08 + a03 * b07 , a32 * b02 - a30 * b05 - a33 * b01 , a20 * b05 - a22 * b02 + a23 * b01 , a10 * b10 - a11 * b08 + a13 * b06 , a01 * b08 - a00 * b10 - a03 * b06 , a30 * b04 - a31 * b02 + a33 * b00 , a21 * b02 - a20 * b04 - a23 * b00 , a11 * b07 - a10 * b09 - a12 * b06 , a00 * b09 - a01 * b07 + a02 * b06 , a31 * b01 - a30 * b03 - a32 * b00 , a20 * b03 - a21 * b01 + a22 * b00 ) / det ; }\n\n"],[9,"INVERSE_MAT",["mat"],"inverseMat(mat)"],[0,"\n\n"],[6],[0,"\n\n"],[6],[0,"\nuniform vec3 material_OutlineColor;\nuniform sampler2D material_OutlineTexture;\nuniform vec2 material_TexSize;\nfloat luminance ( vec4 color ) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b ; }\nfloat sobel ( vec2 uv ) { float Gx [ 9 ] ;\nGx[0] = - 1.0 ;\nGx[1] = 0.0 ;\nGx[2] = 1.0 ;\nGx[3] = - 2.0 ;\nGx[4] = 0.0 ;\nGx[5] = 2.0 ;\nGx[6] = - 1.0 ;\nGx[7] = 0.0 ;\nGx[8] = 1.0 ;\nfloat Gy [ 9 ] ;\nGy[0] = - 1.0 ;\nGy[1] = - 2.0 ;\nGy[2] = - 1.0 ;\nGy[3] = 0.0 ;\nGy[4] = 0.0 ;\nGy[5] = 0.0 ;\nGy[6] = 1.0 ;\nGy[7] = 2.0 ;\nGy[8] = 1.0 ;\nfloat texColor ;\nfloat edgeX = 0.0 ;\nfloat edgeY = 0.0 ;\nvec2 sampleUV [ 9 ] ;\nsampleUV[0] = uv + material_TexSize.xy * vec2 ( - 1 , - 1 ) ;\nsampleUV[1] = uv + material_TexSize.xy * vec2 ( 0 , - 1 ) ;\nsampleUV[2] = uv + material_TexSize.xy * vec2 ( 1 , - 1 ) ;\nsampleUV[3] = uv + material_TexSize.xy * vec2 ( - 1 , 0 ) ;\nsampleUV[4] = uv + material_TexSize.xy * vec2 ( 0 , 0 ) ;\nsampleUV[5] = uv + material_TexSize.xy * vec2 ( 1 , 0 ) ;\nsampleUV[6] = uv + material_TexSize.xy * vec2 ( - 1 , 1 ) ;\nsampleUV[7] = uv + material_TexSize.xy * vec2 ( 0 , 1 ) ;\nsampleUV[8] = uv + material_TexSize.xy * vec2 ( 1 , 1 ) ;\nfor ( int i = 0 ; i < 9 ; i ++ ) { texColor = luminance(texture2D ( material_OutlineTexture , sampleUV[i] )) ;\nedgeX += texColor * Gx[i] ;\nedgeY += texColor * Gy[i] ; }\nreturn abs ( edgeX ) + abs ( edgeY ) ; }\nvoid main() { float sobelFactor = step ( 1.0 , sobel(v_uv) ) ;\ngl_FragColor = mix ( vec4 ( 0 ) , vec4 ( material_OutlineColor , 1.0 ) , sobelFactor ) ; }"]]}]}]} \ No newline at end of file diff --git a/packages/outline/src/OutlinePostprocess.shader b/packages/outline/src/OutlinePostprocess.shader index d9408d6f..b9157cd1 100644 --- a/packages/outline/src/OutlinePostprocess.shader +++ b/packages/outline/src/OutlinePostprocess.shader @@ -1,6 +1,26 @@ Shader "outline-postprocess-shader" { SubShader "Default" { Pass "Forward" { + // Fullscreen-quad postprocess that blends the sobel outline onto the + // existing framebuffer. The new ShaderLab pipeline does not surface + // `material.isTransparent = true` to the Pass when render state is + // undeclared — default opaque overwrites the scene with the `vec4(0)` + // returned for non-edge pixels. + DepthState = { + Enabled = false; + WriteEnabled = false; + } + + BlendState = { + Enabled = true; + SourceColorBlendFactor = BlendFactor.SourceAlpha; + DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha; + SourceAlphaBlendFactor = BlendFactor.One; + DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha; + } + + RenderQueueType = Transparent; + VertexShader = vert; FragmentShader = frag; From 0cb6e132428c631bb73cb24f0491f5068424bdb3 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Wed, 13 May 2026 19:37:59 +0800 Subject: [PATCH 23/27] docs(outline): trim verbose comment on OutlinePostprocess Pass state --- packages/outline/src/OutlinePostprocess.shader | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/outline/src/OutlinePostprocess.shader b/packages/outline/src/OutlinePostprocess.shader index b9157cd1..5ac952f1 100644 --- a/packages/outline/src/OutlinePostprocess.shader +++ b/packages/outline/src/OutlinePostprocess.shader @@ -1,11 +1,6 @@ Shader "outline-postprocess-shader" { SubShader "Default" { Pass "Forward" { - // Fullscreen-quad postprocess that blends the sobel outline onto the - // existing framebuffer. The new ShaderLab pipeline does not surface - // `material.isTransparent = true` to the Pass when render state is - // undeclared — default opaque overwrites the scene with the `vec4(0)` - // returned for non-edge pixels. DepthState = { Enabled = false; WriteEnabled = false; From 6dd8a36603c23243db5234eb49f70305efbea68f Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Thu, 14 May 2026 16:57:13 +0800 Subject: [PATCH 24/27] refactor(custom-material): resolve PBR forward pass by name in PlanarShadow `passes[2]` is a magic index that breaks the moment PBR's pass list is reordered (e.g. another `UsePass` is inserted before the forward pass). Look up the pass by `name === "Forward Pass"` instead, and fail loudly if the expected pass is missing. --- .../src/planar-shadow/PlanarShadowShaderFactory.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts index ecb8a2bf..d6010ec3 100644 --- a/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts +++ b/packages/custom-material/src/planar-shadow/PlanarShadowShaderFactory.ts @@ -14,7 +14,13 @@ export class PlanarShadowShaderFactory { private static _ensureCombinedShader(): void { if (Shader.find("planarShadowShader")) return; const planarShadowPass = Shader.find("PlanarShadowOnly").subShaders[0].passes[0]; - Shader.create("planarShadowShader", [Shader.find("PBR").subShaders[0].passes[2], planarShadowPass]); + // Resolve PBR's forward pass by name so this survives any future reordering + // of PBR's pass list (UsePass entries / pipeline injections). + const pbrForwardPass = Shader.find("PBR").subShaders[0].passes.find((p) => p.name === "Forward Pass"); + if (!pbrForwardPass) { + throw new Error('Planar shadow combined shader requires PBR "Forward Pass", but it was not found.'); + } + Shader.create("planarShadowShader", [pbrForwardPass, planarShadowPass]); } /** From 408bcb88197e86d52ffa2601c12c5d029e529873 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Thu, 14 May 2026 18:24:55 +0800 Subject: [PATCH 25/27] build: pin engine-shader-compiler to 2.0.0-alpha.33 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `>=2.0.0-0` made pnpm pick npm's `latest` dist-tag, which is currently 2.0.0-alpha.31 — engine-shader-compiler's `latest` tag lags behind its `alpha` tag (the 2.x prerelease line). Pin to the exact version that matches editor / engine to avoid drifting under another tag bump. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 357e2206..f6056d24 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "release": "bumpp -r" }, "devDependencies": { - "@galacean/engine-shader-compiler": ">=2.0.0-0", + "@galacean/engine-shader-compiler": "2.0.0-alpha.33", "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", "@rollup/plugin-commonjs": "^25.0.0", From 46613c03a8aff559306b8402309f2ac8b121b76c Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Thu, 14 May 2026 19:24:53 +0800 Subject: [PATCH 26/27] ci: upgrade nodejs.yml to Node 22 / pnpm 9 / latest actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node 16 was EOL on 2023-09-11. The bundler/cli.js shipped by @galacean/engine-shader-compiler@2.0.0-alpha.33 uses ESM (`import { ... } from 'node:util'`) but its package.json lacks `"type": "module"`, so Node 22+ auto-detects ESM while Node 16 throws "Cannot use import statement outside a module" during `pnpm b:all` → `precompile`. release.yml already uses `>=22.6.0`; aligning nodejs.yml. Also bumps adjacent stale actions (checkout v2 → v4, setup-node v1 → v4, pnpm/action-setup v2.0.1 → v4 with pnpm 9 to match packageManager). --- .github/workflows/nodejs.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b9b93fe5..d6174c84 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -9,20 +9,20 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [22.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.0.1 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: - version: 7 + version: 9 run_install: false - name: Get pnpm store directory From 1d1147a07c1e0d8e602979a9753b7e66f76f6479 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Thu, 14 May 2026 19:26:34 +0800 Subject: [PATCH 27/27] ci: let pnpm/action-setup read version from packageManager field pnpm/action-setup@v4 rejects the combination of explicit `version:` input and a `packageManager` field in package.json (ERR_PNPM_BAD_PM_VERSION on conflict). package.json already pins `packageManager: pnpm@9.3.0`, so drop the action input and let it source the version from there. --- .github/workflows/nodejs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d6174c84..2fc2fb26 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -22,7 +22,6 @@ jobs: name: Install pnpm id: pnpm-install with: - version: 9 run_install: false - name: Get pnpm store directory