@onerjs/core 8.56.1 → 8.56.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/arcRotateCamera.pure.js +24 -0
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/constants.d.ts +5 -0
- package/Engines/constants.js +5 -0
- package/Engines/constants.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.d.ts +4 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +12 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js +2 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +21 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +45 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.d.ts +1 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +18 -3
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +5 -21
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.d.ts +10 -0
- package/Materials/Node/nodeMaterial.pure.js +11 -0
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -0
- package/Materials/Node/nodeMaterialBuildState.js +7 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.d.ts +3 -0
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +3 -0
- package/Materials/Textures/textureProcessor.d.ts +29 -6
- package/Materials/Textures/textureProcessor.js +22 -16
- package/Materials/Textures/textureProcessor.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +19 -0
- package/Materials/materialHelper.geometryrendering.js +29 -1
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/prepass.defines.d.ts +3 -0
- package/Materials/prepass.defines.js +3 -0
- package/Materials/prepass.defines.js.map +1 -1
- package/Materials/standardMaterial.pure.d.ts +3 -0
- package/Maths/math.vector.pure.d.ts +1 -5
- package/Maths/math.vector.pure.js.map +1 -1
- package/Misc/filesInput.d.ts +15 -0
- package/Misc/filesInput.js +156 -74
- package/Misc/filesInput.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.d.ts +30 -0
- package/Rendering/geometryBufferRenderer.pure.js +84 -0
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Shaders/ShadersInclude/objectIdFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/objectIdFunctions.js +22 -0
- package/Shaders/ShadersInclude/objectIdFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js +3 -0
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/prePassDeclaration.d.ts +1 -0
- package/Shaders/ShadersInclude/prePassDeclaration.js +5 -0
- package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/Shaders/default.fragment.js +5 -1
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/geometry.fragment.js +9 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/openpbr.fragment.js +2 -1
- package/Shaders/openpbr.fragment.js.map +1 -1
- package/Shaders/pbr.fragment.js +2 -1
- package/Shaders/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/objectIdFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/objectIdFunctions.js +22 -0
- package/ShadersWGSL/ShadersInclude/objectIdFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +3 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +5 -0
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +5 -1
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +9 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.fragment.js +2 -1
- package/ShadersWGSL/openpbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +2 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../../Engines/shaderStore.js";
|
|
3
|
+
const name = "objectIdFunctions";
|
|
4
|
+
const shader = `highp vec4 encodeObjectId(highp float objectId) {
|
|
5
|
+
#ifdef PREPASS_OBJECT_ID_R8
|
|
6
|
+
return vec4(objectId/255.0,0.0,0.0,1.0);
|
|
7
|
+
#else
|
|
8
|
+
highp float id=floor(objectId);highp vec3 encodedId=vec3(
|
|
9
|
+
floor(mod(id,16777216.0)/65536.0),
|
|
10
|
+
floor(mod(id,65536.0)/256.0),
|
|
11
|
+
mod(id,256.0)
|
|
12
|
+
)/255.0;return vec4(encodedId,step(0.5,id));
|
|
13
|
+
#endif
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
// Sideeffect
|
|
17
|
+
if (!ShaderStore.IncludesShadersStore[name]) {
|
|
18
|
+
ShaderStore.IncludesShadersStore[name] = shader;
|
|
19
|
+
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const objectIdFunctions = { name, shader };
|
|
22
|
+
//# sourceMappingURL=objectIdFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectIdFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/objectIdFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;CAWd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"objectIdFunctions\";\nconst shader = `highp vec4 encodeObjectId(highp float objectId) {\n#ifdef PREPASS_OBJECT_ID_R8\nreturn vec4(objectId/255.0,0.0,0.0,1.0);\n#else\nhighp float id=floor(objectId);highp vec3 encodedId=vec3(\nfloor(mod(id,16777216.0)/65536.0),\nfloor(mod(id,65536.0)/256.0),\nmod(id,256.0)\n)/255.0;return vec4(encodedId,step(0.5,id));\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const objectIdFunctions = { name, shader };\n"]}
|
|
@@ -6,6 +6,9 @@ float writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;
|
|
|
6
6
|
#ifdef PREPASS_POSITION
|
|
7
7
|
gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
|
|
8
8
|
#endif
|
|
9
|
+
#ifdef PREPASS_OBJECT_ID
|
|
10
|
+
gl_FragData[PREPASS_OBJECT_ID_INDEX]=encodeObjectId(objectId)*writeGeometryInfo;
|
|
11
|
+
#endif
|
|
9
12
|
#ifdef PREPASS_LOCAL_POSITION
|
|
10
13
|
gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
|
|
11
14
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openpbrBlockPrePass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/openpbrBlockPrePass.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"openpbrBlockPrePass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/openpbrBlockPrePass.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"openpbrBlockPrePass\";\nconst shader = `#if SCENE_MRT_COUNT>0\nfloat writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_OBJECT_ID\ngl_FragData[PREPASS_OBJECT_ID_INDEX]=encodeObjectId(objectId)*writeGeometryInfo;\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(base_color,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvec3 sqAlbedo=sqrt(base_color);\n#endif\n#ifdef PREPASS_IRRADIANCE\nvec3 irradiance=total_direct_diffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=slab_diffuse_ibl;\n#endif\n#endif\n#ifdef SCATTERING\nfloat scatter_mask=min(subsurface_weight+transmission_weight,1.0);\n#else\nfloat scatter_mask=0.0;\n#endif\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(irradiance,writeGeometryInfo*scatter_mask);\n#endif\n#if defined(PREPASS_COLOR)\ngl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb,finalColor.a);\n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const openpbrBlockPrePass = { name, shader };\n"]}
|
|
@@ -6,6 +6,9 @@ float writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;
|
|
|
6
6
|
#ifdef PREPASS_POSITION
|
|
7
7
|
gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
|
|
8
8
|
#endif
|
|
9
|
+
#ifdef PREPASS_OBJECT_ID
|
|
10
|
+
gl_FragData[PREPASS_OBJECT_ID_INDEX]=encodeObjectId(objectId)*writeGeometryInfo;
|
|
11
|
+
#endif
|
|
9
12
|
#ifdef PREPASS_LOCAL_POSITION
|
|
10
13
|
gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
|
|
11
14
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrBlockPrePass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrBlockPrePass.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"pbrBlockPrePass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrBlockPrePass.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"pbrBlockPrePass\";\nconst shader = `#if SCENE_MRT_COUNT>0\nfloat writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_OBJECT_ID\ngl_FragData[PREPASS_OBJECT_ID_INDEX]=encodeObjectId(objectId)*writeGeometryInfo;\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(surfaceAlbedo,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvec3 sqAlbedo=sqrt(surfaceAlbedo); \n#endif\n#ifdef PREPASS_IRRADIANCE_LEGACY\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\n#ifdef SS_SCATTERING\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb-irradiance,finalColor.a); \n#endif\nirradiance/=sqAlbedo;\n#else\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=finalColor; \n#endif\nfloat scatteringDiffusionProfile=255.;\n#endif\ngl_FragData[PREPASS_IRRADIANCE_LEGACY_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); \n#else\n#ifdef PREPASS_IRRADIANCE\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(irradiance,writeGeometryInfo);\n#endif\n#if defined(PREPASS_COLOR)\ngl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb,finalColor.a);\n#endif\n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const pbrBlockPrePass = { name, shader };\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "../../Engines/shaderStore.js";
|
|
3
|
+
import "./objectIdFunctions.js";
|
|
3
4
|
const name = "prePassDeclaration";
|
|
4
5
|
const shader = `#ifdef PREPASS
|
|
5
6
|
#extension GL_EXT_draw_buffers : require
|
|
@@ -16,6 +17,10 @@ varying highp float vNormViewDepth;
|
|
|
16
17
|
#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)
|
|
17
18
|
varying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;
|
|
18
19
|
#endif
|
|
20
|
+
#ifdef PREPASS_OBJECT_ID
|
|
21
|
+
uniform highp float objectId;
|
|
22
|
+
#include<objectIdFunctions>
|
|
23
|
+
#endif
|
|
19
24
|
#endif
|
|
20
25
|
`;
|
|
21
26
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prePassDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/prePassDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"prePassDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/prePassDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,qBAAqB,CAAC;AAC7B,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;CAoBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nimport \"./objectIdFunctions\";\nconst name = \"prePassDeclaration\";\nconst shader = `#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out highp vec4 glFragData[{X}];highp vec4 gl_FragColor;\n#ifdef PREPASS_LOCAL_POSITION\nvarying highp vec3 vPosition;\n#endif\n#ifdef PREPASS_DEPTH\nvarying highp vec3 vViewPos;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvarying highp float vNormViewDepth;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)\nvarying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;\n#endif\n#ifdef PREPASS_OBJECT_ID\nuniform highp float objectId;\n#include<objectIdFunctions>\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const prePassDeclaration = { name, shader };\n"]}
|
|
@@ -5,6 +5,7 @@ import { defaultFragmentDeclaration } from "./ShadersInclude/defaultFragmentDecl
|
|
|
5
5
|
import { sceneUboDeclaration } from "./ShadersInclude/sceneUboDeclaration.js";
|
|
6
6
|
import { meshUboDeclaration } from "./ShadersInclude/meshUboDeclaration.js";
|
|
7
7
|
import { defaultUboDeclaration } from "./ShadersInclude/defaultUboDeclaration.js";
|
|
8
|
+
import { objectIdFunctions } from "./ShadersInclude/objectIdFunctions.js";
|
|
8
9
|
import { prePassDeclaration } from "./ShadersInclude/prePassDeclaration.js";
|
|
9
10
|
import { oitDeclaration } from "./ShadersInclude/oitDeclaration.js";
|
|
10
11
|
import { mainUVVaryingDeclaration } from "./ShadersInclude/mainUVVaryingDeclaration.js";
|
|
@@ -331,6 +332,9 @@ gl_FragData[PREPASS_COLOR_INDEX]=color;
|
|
|
331
332
|
#ifdef PREPASS_POSITION
|
|
332
333
|
gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
|
|
333
334
|
#endif
|
|
335
|
+
#ifdef PREPASS_OBJECT_ID
|
|
336
|
+
gl_FragData[PREPASS_OBJECT_ID_INDEX]=encodeObjectId(objectId)*writeGeometryInfo;
|
|
337
|
+
#endif
|
|
334
338
|
#ifdef PREPASS_LOCAL_POSITION
|
|
335
339
|
gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
|
|
336
340
|
#endif
|
|
@@ -390,7 +394,7 @@ if (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;
|
|
|
390
394
|
if (!ShaderStore.ShadersStore[name]) {
|
|
391
395
|
ShaderStore.ShadersStore[name] = shader;
|
|
392
396
|
}
|
|
393
|
-
const includes = [decalFragmentDeclaration, defaultFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, defaultUboDeclaration, prePassDeclaration, oitDeclaration, mainUVVaryingDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, ltcHelperFunctions, clusteredLightingFunctions, lightsFragmentFunctions, shadowsFragmentFunctions, samplerFragmentDeclaration, fresnelFunction, reflectionFunction, imageProcessingDeclaration, imageProcessingFunctions, textureRepetitionFunctions, bumpFragmentMainFunctions, bumpFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, bumpFragment, decalFragment, depthPrePass, lightFragment, logDepthFragment, fogFragment, oitFragment];
|
|
397
|
+
const includes = [decalFragmentDeclaration, defaultFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, defaultUboDeclaration, objectIdFunctions, prePassDeclaration, oitDeclaration, mainUVVaryingDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, ltcHelperFunctions, clusteredLightingFunctions, lightsFragmentFunctions, shadowsFragmentFunctions, samplerFragmentDeclaration, fresnelFunction, reflectionFunction, imageProcessingDeclaration, imageProcessingFunctions, textureRepetitionFunctions, bumpFragmentMainFunctions, bumpFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, bumpFragment, decalFragment, depthPrePass, lightFragment, logDepthFragment, fogFragment, oitFragment];
|
|
394
398
|
for (const inc of includes) {
|
|
395
399
|
if (!ShaderStore.IncludesShadersStore[inc.name]) {
|
|
396
400
|
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/default.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,E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EAAE,0BAA0B,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,cAAc,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,eAAe,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAClvB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { decalFragmentDeclaration } from \"./ShadersInclude/decalFragmentDeclaration\";\nimport { defaultFragmentDeclaration } from \"./ShadersInclude/defaultFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { meshUboDeclaration } from \"./ShadersInclude/meshUboDeclaration\";\nimport { defaultUboDeclaration } from \"./ShadersInclude/defaultUboDeclaration\";\nimport { prePassDeclaration } from \"./ShadersInclude/prePassDeclaration\";\nimport { oitDeclaration } from \"./ShadersInclude/oitDeclaration\";\nimport { mainUVVaryingDeclaration } from \"./ShadersInclude/mainUVVaryingDeclaration\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { lightFragmentDeclaration } from \"./ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"./ShadersInclude/lightUboDeclaration\";\nimport { ltcHelperFunctions } from \"./ShadersInclude/ltcHelperFunctions\";\nimport { clusteredLightingFunctions } from \"./ShadersInclude/clusteredLightingFunctions\";\nimport { lightsFragmentFunctions } from \"./ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctions } from \"./ShadersInclude/shadowsFragmentFunctions\";\nimport { samplerFragmentDeclaration } from \"./ShadersInclude/samplerFragmentDeclaration\";\nimport { fresnelFunction } from \"./ShadersInclude/fresnelFunction\";\nimport { reflectionFunction } from \"./ShadersInclude/reflectionFunction\";\nimport { imageProcessingDeclaration } from \"./ShadersInclude/imageProcessingDeclaration\";\nimport { imageProcessingFunctions } from \"./ShadersInclude/imageProcessingFunctions\";\nimport { textureRepetitionFunctions } from \"./ShadersInclude/textureRepetitionFunctions\";\nimport { bumpFragmentMainFunctions } from \"./ShadersInclude/bumpFragmentMainFunctions\";\nimport { bumpFragmentFunctions } from \"./ShadersInclude/bumpFragmentFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"./ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"./ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragment } from \"./ShadersInclude/clipPlaneFragment\";\nimport { bumpFragment } from \"./ShadersInclude/bumpFragment\";\nimport { decalFragment } from \"./ShadersInclude/decalFragment\";\nimport { depthPrePass } from \"./ShadersInclude/depthPrePass\";\nimport { lightFragment } from \"./ShadersInclude/lightFragment\";\nimport { logDepthFragment } from \"./ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"./ShadersInclude/fogFragment\";\nimport { oitFragment } from \"./ShadersInclude/oitFragment\";\n\nconst name = \"defaultPixelShader\";\nconst shader = `#define CUSTOM_FRAGMENT_EXTENSION\n#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\n#include<oitDeclaration>\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#include<mainUVVaryingDeclaration>[1..7]\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include<fresnelFunction>\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<textureRepetitionFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=TEXRD(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=TEXRD(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\nvec4 specularMapColor=TEXRD(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=TEXRD(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\naggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=TEXRD(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha<alphaCutOff)\ndiscard;\n#endif\n#ifndef ALPHABLEND\nalpha=1.0;\n#endif\n#endif\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=TEXRD(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);emissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);diffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);\n#endif\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor.rgb;\n#else\ncolor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\n#if SCENE_MRT_COUNT>0\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=color; \n#endif\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [decalFragmentDeclaration, defaultFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, defaultUboDeclaration, prePassDeclaration, oitDeclaration, mainUVVaryingDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, ltcHelperFunctions, clusteredLightingFunctions, lightsFragmentFunctions, shadowsFragmentFunctions, samplerFragmentDeclaration, fresnelFunction, reflectionFunction, imageProcessingDeclaration, imageProcessingFunctions, textureRepetitionFunctions, bumpFragmentMainFunctions, bumpFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, bumpFragment, decalFragment, depthPrePass, lightFragment, logDepthFragment, fogFragment, oitFragment];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const defaultPixelShader = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"default.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/default.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6C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mB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,eAAe,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AACrwB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { decalFragmentDeclaration } from \"./ShadersInclude/decalFragmentDeclaration\";\nimport { defaultFragmentDeclaration } from \"./ShadersInclude/defaultFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { meshUboDeclaration } from \"./ShadersInclude/meshUboDeclaration\";\nimport { defaultUboDeclaration } from \"./ShadersInclude/defaultUboDeclaration\";\nimport { objectIdFunctions } from \"./ShadersInclude/objectIdFunctions\";\nimport { prePassDeclaration } from \"./ShadersInclude/prePassDeclaration\";\nimport { oitDeclaration } from \"./ShadersInclude/oitDeclaration\";\nimport { mainUVVaryingDeclaration } from \"./ShadersInclude/mainUVVaryingDeclaration\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { lightFragmentDeclaration } from \"./ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"./ShadersInclude/lightUboDeclaration\";\nimport { ltcHelperFunctions } from \"./ShadersInclude/ltcHelperFunctions\";\nimport { clusteredLightingFunctions } from \"./ShadersInclude/clusteredLightingFunctions\";\nimport { lightsFragmentFunctions } from \"./ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctions } from \"./ShadersInclude/shadowsFragmentFunctions\";\nimport { samplerFragmentDeclaration } from \"./ShadersInclude/samplerFragmentDeclaration\";\nimport { fresnelFunction } from \"./ShadersInclude/fresnelFunction\";\nimport { reflectionFunction } from \"./ShadersInclude/reflectionFunction\";\nimport { imageProcessingDeclaration } from \"./ShadersInclude/imageProcessingDeclaration\";\nimport { imageProcessingFunctions } from \"./ShadersInclude/imageProcessingFunctions\";\nimport { textureRepetitionFunctions } from \"./ShadersInclude/textureRepetitionFunctions\";\nimport { bumpFragmentMainFunctions } from \"./ShadersInclude/bumpFragmentMainFunctions\";\nimport { bumpFragmentFunctions } from \"./ShadersInclude/bumpFragmentFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"./ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"./ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragment } from \"./ShadersInclude/clipPlaneFragment\";\nimport { bumpFragment } from \"./ShadersInclude/bumpFragment\";\nimport { decalFragment } from \"./ShadersInclude/decalFragment\";\nimport { depthPrePass } from \"./ShadersInclude/depthPrePass\";\nimport { lightFragment } from \"./ShadersInclude/lightFragment\";\nimport { logDepthFragment } from \"./ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"./ShadersInclude/fogFragment\";\nimport { oitFragment } from \"./ShadersInclude/oitFragment\";\n\nconst name = \"defaultPixelShader\";\nconst shader = `#define CUSTOM_FRAGMENT_EXTENSION\n#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\n#include<oitDeclaration>\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#include<mainUVVaryingDeclaration>[1..7]\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include<fresnelFunction>\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<textureRepetitionFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=TEXRD(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=TEXRD(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\nvec4 specularMapColor=TEXRD(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=TEXRD(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\naggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=TEXRD(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha<alphaCutOff)\ndiscard;\n#endif\n#ifndef ALPHABLEND\nalpha=1.0;\n#endif\n#endif\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=TEXRD(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);emissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);diffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);\n#endif\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor.rgb;\n#else\ncolor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\n#if SCENE_MRT_COUNT>0\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=color; \n#endif\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_OBJECT_ID\ngl_FragData[PREPASS_OBJECT_ID_INDEX]=encodeObjectId(objectId)*writeGeometryInfo;\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [decalFragmentDeclaration, defaultFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, defaultUboDeclaration, objectIdFunctions, prePassDeclaration, oitDeclaration, mainUVVaryingDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, ltcHelperFunctions, clusteredLightingFunctions, lightsFragmentFunctions, shadowsFragmentFunctions, samplerFragmentDeclaration, fresnelFunction, reflectionFunction, imageProcessingDeclaration, imageProcessingFunctions, textureRepetitionFunctions, bumpFragmentMainFunctions, bumpFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, bumpFragment, decalFragment, depthPrePass, lightFragment, logDepthFragment, fogFragment, oitFragment];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const defaultPixelShader = { name, shader };\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import { objectIdFunctions } from "./ShadersInclude/objectIdFunctions.js";
|
|
3
4
|
import { clipPlaneFragmentDeclaration } from "./ShadersInclude/clipPlaneFragmentDeclaration.js";
|
|
4
5
|
import { mrtFragmentDeclaration } from "./ShadersInclude/mrtFragmentDeclaration.js";
|
|
5
6
|
import { bumpFragmentMainFunctions } from "./ShadersInclude/bumpFragmentMainFunctions.js";
|
|
@@ -73,6 +74,10 @@ uniform float glossiness;
|
|
|
73
74
|
#if defined(ALPHATEST) && defined(NEED_UV)
|
|
74
75
|
uniform sampler2D diffuseSampler;
|
|
75
76
|
#endif
|
|
77
|
+
#ifdef OBJECT_ID
|
|
78
|
+
uniform float objectId;
|
|
79
|
+
#include<objectIdFunctions>
|
|
80
|
+
#endif
|
|
76
81
|
#include<clipPlaneFragmentDeclaration>
|
|
77
82
|
#include<mrtFragmentDeclaration>[SCENE_MRT_COUNT]
|
|
78
83
|
#include<bumpFragmentMainFunctions>
|
|
@@ -140,6 +145,9 @@ gl_FragData[SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,1.0);
|
|
|
140
145
|
#ifdef POSITION
|
|
141
146
|
gl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);
|
|
142
147
|
#endif
|
|
148
|
+
#ifdef OBJECT_ID
|
|
149
|
+
gl_FragData[OBJECT_ID_INDEX]=encodeObjectId(objectId);
|
|
150
|
+
#endif
|
|
143
151
|
#ifdef VELOCITY
|
|
144
152
|
vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);
|
|
145
153
|
#endif
|
|
@@ -263,7 +271,7 @@ gl_FragData[IRRADIANCE_INDEX]=vec4(irradiance,irradiance_alpha);
|
|
|
263
271
|
if (!ShaderStore.ShadersStore[name]) {
|
|
264
272
|
ShaderStore.ShadersStore[name] = shader;
|
|
265
273
|
}
|
|
266
|
-
const includes = [clipPlaneFragmentDeclaration, mrtFragmentDeclaration, bumpFragmentMainFunctions, samplerFragmentDeclaration, bumpFragmentFunctions, helperFunctions, pbrFragmentReflectionDeclaration, sceneFragmentDeclaration, sceneUboDeclaration, pbrBRDFFunctions, openpbrDielectricReflectance, pbrIBLFunctions, reflectionFunction, openpbrGeometryInfo, openpbrIblFunctions, clipPlaneFragment, bumpFragment, openpbrSubsurfaceLayerData, openpbrTransmissionLayerData];
|
|
274
|
+
const includes = [objectIdFunctions, clipPlaneFragmentDeclaration, mrtFragmentDeclaration, bumpFragmentMainFunctions, samplerFragmentDeclaration, bumpFragmentFunctions, helperFunctions, pbrFragmentReflectionDeclaration, sceneFragmentDeclaration, sceneUboDeclaration, pbrBRDFFunctions, openpbrDielectricReflectance, pbrIBLFunctions, reflectionFunction, openpbrGeometryInfo, openpbrIblFunctions, clipPlaneFragment, bumpFragment, openpbrSubsurfaceLayerData, openpbrTransmissionLayerData];
|
|
267
275
|
for (const inc of includes) {
|
|
268
276
|
if (!ShaderStore.IncludesShadersStore[inc.name]) {
|
|
269
277
|
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/geometry.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAA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CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,eAAe,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,0BAA0B,EAAE,4BAA4B,CAAC,CAAC;AACld,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { clipPlaneFragmentDeclaration } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { mrtFragmentDeclaration } from \"./ShadersInclude/mrtFragmentDeclaration\";\nimport { bumpFragmentMainFunctions } from \"./ShadersInclude/bumpFragmentMainFunctions\";\nimport { samplerFragmentDeclaration } from \"./ShadersInclude/samplerFragmentDeclaration\";\nimport { bumpFragmentFunctions } from \"./ShadersInclude/bumpFragmentFunctions\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { pbrFragmentReflectionDeclaration } from \"./ShadersInclude/pbrFragmentReflectionDeclaration\";\nimport { sceneFragmentDeclaration } from \"./ShadersInclude/sceneFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { pbrBRDFFunctions } from \"./ShadersInclude/pbrBRDFFunctions\";\nimport { openpbrDielectricReflectance } from \"./ShadersInclude/openpbrDielectricReflectance\";\nimport { pbrIBLFunctions } from \"./ShadersInclude/pbrIBLFunctions\";\nimport { reflectionFunction } from \"./ShadersInclude/reflectionFunction\";\nimport { openpbrGeometryInfo } from \"./ShadersInclude/openpbrGeometryInfo\";\nimport { openpbrIblFunctions } from \"./ShadersInclude/openpbrIblFunctions\";\nimport { clipPlaneFragment } from \"./ShadersInclude/clipPlaneFragment\";\nimport { bumpFragment } from \"./ShadersInclude/bumpFragment\";\nimport { openpbrSubsurfaceLayerData } from \"./ShadersInclude/openpbrSubsurfaceLayerData\";\nimport { openpbrTransmissionLayerData } from \"./ShadersInclude/openpbrTransmissionLayerData\";\n\nconst name = \"geometryPixelShader\";\nconst shader = `#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#ifdef BUMP\nvarying mat4 vWorldView;varying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP) || defined(IRRADIANCE)\nvarying vec3 vPositionW;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nvarying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nuniform sampler2D reflectivitySampler;varying vec2 vReflectivityUV;\n#else\n#ifdef METALLIC_TEXTURE\nuniform sampler2D metallicSampler;varying vec2 vMetallicUV;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nuniform sampler2D roughnessSampler;varying vec2 vRoughnessUV;\n#endif\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vec2 vAlbedoUV;uniform sampler2D albedoSampler;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform vec3 reflectivityColor;\n#endif\n#ifdef ALBEDOCOLOR\nuniform vec3 albedoColor;\n#endif\n#ifdef METALLIC\nuniform float metallic;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform float glossiness;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nuniform sampler2D diffuseSampler;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<mrtFragmentDeclaration>[SCENE_MRT_COUNT]\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<helperFunctions>\n#ifdef IRRADIANCE\n#include<pbrFragmentReflectionDeclaration>\n#ifdef REFLECTION\n#ifdef USEIRRADIANCEMAP\n#include<__decl__sceneFragment>\nuniform mat4 reflectionMatrix;uniform vec2 vReflectionInfos;uniform vec3 vReflectionDominantDirection;\n#include<pbrBRDFFunctions>\n#include<openpbrDielectricReflectance>\n#include<pbrIBLFunctions>\n#include<reflectionFunction>\n#include<openpbrGeometryInfo>\n#include<openpbrIblFunctions>\n#elif defined(USESPHERICALFROMREFLECTIONMAP)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#ifdef IBL_SHADOW_TEXTURE\nuniform sampler2D iblShadowSampler;uniform vec2 shadowTextureSize;\n#endif\n#ifdef IRRADIANCE_SCATTER_MASK\nuniform float vSubsurfaceWeight;\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_WEIGHT,_VARYINGNAME_,SubsurfaceWeight,_SAMPLERNAME_,subsurfaceWeight)\nuniform float vSubsurfaceScatterAnisotropy;uniform float vTransmissionWeight;\n#include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_WEIGHT,_VARYINGNAME_,TransmissionWeight,_SAMPLERNAME_,transmissionWeight)\nuniform float vTransmissionScatterAnisotropy;\n#endif\n#endif\n#endif\nvoid main() {\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nvec3 normalOutput;\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include<bumpFragment>\n#ifdef NORMAL_WORLDSPACE\nnormalOutput=normalW;\n#else\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\n#endif\n#elif defined(HAS_NORMAL_ATTRIBUTE)\nnormalOutput=normalize(vNormalV);\n#elif defined(POSITION)\nnormalOutput=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#ifdef ENCODE_NORMAL\nnormalOutput=normalOutput*0.5+0.5;\n#endif\n#ifdef DEPTH\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef NORMAL\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\n#endif\n#ifdef SCREENSPACE_DEPTH\ngl_FragData[SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef VELOCITY_LINEAR\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w) -\n(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvec4 reflectivity=vec4(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nfloat metal=1.0;float roughness=1.0;\n#ifdef ORMTEXTURE\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;roughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\n#else\n#ifdef METALLIC_TEXTURE\nmetal*=texture2D(metallicSampler,vMetallicUV).r;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nroughness*=texture2D(roughnessSampler,vRoughnessUV).r;\n#endif\n#endif\n#ifdef METALLIC\nmetal*=metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-glossiness); \n#endif\nreflectivity.a-=roughness;vec3 color=vec3(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpace(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=albedoColor.xyz;\n#endif\nreflectivity.rgb=mix(vec3(0.04),color,metal);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity.rgb=toLinearSpace(reflectivityColor.xyz);reflectivity.a=1.0;\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity.a*=glossiness; \n#endif\n#endif\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n#ifdef IRRADIANCE\nvec3 irradiance=vec3(0.0);float irradiance_alpha=1.0;\n#ifdef REFLECTION\n#ifdef IRRADIANCE_SCATTER_MASK\n#ifndef BUMP\nvec2 uvOffset=vec2(0.0);\n#endif\nvec3 vSubsurfaceColor=vec3(1.0);float vSubsurfaceRadius=0.0;vec3 vSubsurfaceRadiusScale=vec3(1.0);\n#include<openpbrSubsurfaceLayerData>\nfloat vTransmissionDepth=1.0;vec3 vTransmissionColor=vec3(1.0);vec3 vTransmissionScatter=vec3(0.0);float vTransmissionDispersionScale=0.0;float vTransmissionDispersionAbbeNumber=0.0;\n#include<openpbrTransmissionLayerData>\n#endif\n#ifdef IBL_SHADOW_TEXTURE\n#ifdef COLORED_IBL_SHADOWS\nvec3 iblShadowValue=texture(iblShadowSampler,gl_FragCoord.xy/shadowTextureSize).rgb;\n#else\nvec3 iblShadowValue=vec3(texture(iblShadowSampler,gl_FragCoord.xy/shadowTextureSize).r);\n#endif\n#endif\n#if defined(USEIRRADIANCEMAP)\n#ifdef IRRADIANCE_SCATTER_MASK\nfloat bendAmount=subsurface_weight*-min(subsurface_scatter_anisotropy,0.0);bendAmount=mix(bendAmount,-min(transmission_scatter_anisotropy,0.0),transmission_weight);vec3 viewVector=normalize(vEyePosition.xyz-vPositionW.xyz);vec3 bentNormal=mix(normalOutput,viewVector,bendAmount*dot(normalOutput,viewVector));\n#else\nvec3 bentNormal=normalOutput;\n#endif\nirradiance=sampleIrradiance(\nbentNormal\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n,vEnvironmentIrradiance\n#endif\n#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\n,reflectionMatrix\n#endif\n#ifdef USEIRRADIANCEMAP\n,irradianceSampler\n#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\n,vReflectionDominantDirection\n#endif\n#endif\n#ifdef REALTIME_FILTERING\n,vReflectionFilteringInfo\n#ifdef IBL_CDF_FILTERING\n,icdfSampler\n#endif\n#endif\n,vReflectionInfos\n,vViewPos.xyz\n,1.0\n,vec3(1.0)\n);\n#elif defined(USESPHERICALFROMREFLECTIONMAP)\nirradiance=vEnvironmentIrradiance;\n#endif\n#ifdef IBL_SHADOW_TEXTURE\nirradiance*=iblShadowValue;\n#endif\n#ifdef IRRADIANCE_SCATTER_MASK\nirradiance_alpha=min(subsurface_weight+transmission_weight,1.0);\n#endif\n#endif\ngl_FragData[IRRADIANCE_INDEX]=vec4(irradiance,irradiance_alpha);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [clipPlaneFragmentDeclaration, mrtFragmentDeclaration, bumpFragmentMainFunctions, samplerFragmentDeclaration, bumpFragmentFunctions, helperFunctions, pbrFragmentReflectionDeclaration, sceneFragmentDeclaration, sceneUboDeclaration, pbrBRDFFunctions, openpbrDielectricReflectance, pbrIBLFunctions, reflectionFunction, openpbrGeometryInfo, openpbrIblFunctions, clipPlaneFragment, bumpFragment, openpbrSubsurfaceLayerData, openpbrTransmissionLayerData];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const geometryPixelShader = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"geometry.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/geometry.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mDAAmD,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3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4BAA4B,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,0BAA0B,EAAE,4BAA4B,CAAC,CAAC;AACre,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { objectIdFunctions } from \"./ShadersInclude/objectIdFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { mrtFragmentDeclaration } from \"./ShadersInclude/mrtFragmentDeclaration\";\nimport { bumpFragmentMainFunctions } from \"./ShadersInclude/bumpFragmentMainFunctions\";\nimport { samplerFragmentDeclaration } from \"./ShadersInclude/samplerFragmentDeclaration\";\nimport { bumpFragmentFunctions } from \"./ShadersInclude/bumpFragmentFunctions\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { pbrFragmentReflectionDeclaration } from \"./ShadersInclude/pbrFragmentReflectionDeclaration\";\nimport { sceneFragmentDeclaration } from \"./ShadersInclude/sceneFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { pbrBRDFFunctions } from \"./ShadersInclude/pbrBRDFFunctions\";\nimport { openpbrDielectricReflectance } from \"./ShadersInclude/openpbrDielectricReflectance\";\nimport { pbrIBLFunctions } from \"./ShadersInclude/pbrIBLFunctions\";\nimport { reflectionFunction } from \"./ShadersInclude/reflectionFunction\";\nimport { openpbrGeometryInfo } from \"./ShadersInclude/openpbrGeometryInfo\";\nimport { openpbrIblFunctions } from \"./ShadersInclude/openpbrIblFunctions\";\nimport { clipPlaneFragment } from \"./ShadersInclude/clipPlaneFragment\";\nimport { bumpFragment } from \"./ShadersInclude/bumpFragment\";\nimport { openpbrSubsurfaceLayerData } from \"./ShadersInclude/openpbrSubsurfaceLayerData\";\nimport { openpbrTransmissionLayerData } from \"./ShadersInclude/openpbrTransmissionLayerData\";\n\nconst name = \"geometryPixelShader\";\nconst shader = `#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#ifdef BUMP\nvarying mat4 vWorldView;varying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP) || defined(IRRADIANCE)\nvarying vec3 vPositionW;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nvarying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nuniform sampler2D reflectivitySampler;varying vec2 vReflectivityUV;\n#else\n#ifdef METALLIC_TEXTURE\nuniform sampler2D metallicSampler;varying vec2 vMetallicUV;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nuniform sampler2D roughnessSampler;varying vec2 vRoughnessUV;\n#endif\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vec2 vAlbedoUV;uniform sampler2D albedoSampler;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform vec3 reflectivityColor;\n#endif\n#ifdef ALBEDOCOLOR\nuniform vec3 albedoColor;\n#endif\n#ifdef METALLIC\nuniform float metallic;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform float glossiness;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef OBJECT_ID\nuniform float objectId;\n#include<objectIdFunctions>\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<mrtFragmentDeclaration>[SCENE_MRT_COUNT]\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<helperFunctions>\n#ifdef IRRADIANCE\n#include<pbrFragmentReflectionDeclaration>\n#ifdef REFLECTION\n#ifdef USEIRRADIANCEMAP\n#include<__decl__sceneFragment>\nuniform mat4 reflectionMatrix;uniform vec2 vReflectionInfos;uniform vec3 vReflectionDominantDirection;\n#include<pbrBRDFFunctions>\n#include<openpbrDielectricReflectance>\n#include<pbrIBLFunctions>\n#include<reflectionFunction>\n#include<openpbrGeometryInfo>\n#include<openpbrIblFunctions>\n#elif defined(USESPHERICALFROMREFLECTIONMAP)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#ifdef IBL_SHADOW_TEXTURE\nuniform sampler2D iblShadowSampler;uniform vec2 shadowTextureSize;\n#endif\n#ifdef IRRADIANCE_SCATTER_MASK\nuniform float vSubsurfaceWeight;\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_WEIGHT,_VARYINGNAME_,SubsurfaceWeight,_SAMPLERNAME_,subsurfaceWeight)\nuniform float vSubsurfaceScatterAnisotropy;uniform float vTransmissionWeight;\n#include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_WEIGHT,_VARYINGNAME_,TransmissionWeight,_SAMPLERNAME_,transmissionWeight)\nuniform float vTransmissionScatterAnisotropy;\n#endif\n#endif\n#endif\nvoid main() {\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nvec3 normalOutput;\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include<bumpFragment>\n#ifdef NORMAL_WORLDSPACE\nnormalOutput=normalW;\n#else\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\n#endif\n#elif defined(HAS_NORMAL_ATTRIBUTE)\nnormalOutput=normalize(vNormalV);\n#elif defined(POSITION)\nnormalOutput=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#ifdef ENCODE_NORMAL\nnormalOutput=normalOutput*0.5+0.5;\n#endif\n#ifdef DEPTH\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef NORMAL\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\n#endif\n#ifdef SCREENSPACE_DEPTH\ngl_FragData[SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef OBJECT_ID\ngl_FragData[OBJECT_ID_INDEX]=encodeObjectId(objectId);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef VELOCITY_LINEAR\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w) -\n(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvec4 reflectivity=vec4(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nfloat metal=1.0;float roughness=1.0;\n#ifdef ORMTEXTURE\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;roughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\n#else\n#ifdef METALLIC_TEXTURE\nmetal*=texture2D(metallicSampler,vMetallicUV).r;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nroughness*=texture2D(roughnessSampler,vRoughnessUV).r;\n#endif\n#endif\n#ifdef METALLIC\nmetal*=metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-glossiness); \n#endif\nreflectivity.a-=roughness;vec3 color=vec3(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpace(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=albedoColor.xyz;\n#endif\nreflectivity.rgb=mix(vec3(0.04),color,metal);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity.rgb=toLinearSpace(reflectivityColor.xyz);reflectivity.a=1.0;\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity.a*=glossiness; \n#endif\n#endif\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n#ifdef IRRADIANCE\nvec3 irradiance=vec3(0.0);float irradiance_alpha=1.0;\n#ifdef REFLECTION\n#ifdef IRRADIANCE_SCATTER_MASK\n#ifndef BUMP\nvec2 uvOffset=vec2(0.0);\n#endif\nvec3 vSubsurfaceColor=vec3(1.0);float vSubsurfaceRadius=0.0;vec3 vSubsurfaceRadiusScale=vec3(1.0);\n#include<openpbrSubsurfaceLayerData>\nfloat vTransmissionDepth=1.0;vec3 vTransmissionColor=vec3(1.0);vec3 vTransmissionScatter=vec3(0.0);float vTransmissionDispersionScale=0.0;float vTransmissionDispersionAbbeNumber=0.0;\n#include<openpbrTransmissionLayerData>\n#endif\n#ifdef IBL_SHADOW_TEXTURE\n#ifdef COLORED_IBL_SHADOWS\nvec3 iblShadowValue=texture(iblShadowSampler,gl_FragCoord.xy/shadowTextureSize).rgb;\n#else\nvec3 iblShadowValue=vec3(texture(iblShadowSampler,gl_FragCoord.xy/shadowTextureSize).r);\n#endif\n#endif\n#if defined(USEIRRADIANCEMAP)\n#ifdef IRRADIANCE_SCATTER_MASK\nfloat bendAmount=subsurface_weight*-min(subsurface_scatter_anisotropy,0.0);bendAmount=mix(bendAmount,-min(transmission_scatter_anisotropy,0.0),transmission_weight);vec3 viewVector=normalize(vEyePosition.xyz-vPositionW.xyz);vec3 bentNormal=mix(normalOutput,viewVector,bendAmount*dot(normalOutput,viewVector));\n#else\nvec3 bentNormal=normalOutput;\n#endif\nirradiance=sampleIrradiance(\nbentNormal\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n,vEnvironmentIrradiance\n#endif\n#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\n,reflectionMatrix\n#endif\n#ifdef USEIRRADIANCEMAP\n,irradianceSampler\n#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\n,vReflectionDominantDirection\n#endif\n#endif\n#ifdef REALTIME_FILTERING\n,vReflectionFilteringInfo\n#ifdef IBL_CDF_FILTERING\n,icdfSampler\n#endif\n#endif\n,vReflectionInfos\n,vViewPos.xyz\n,1.0\n,vec3(1.0)\n);\n#elif defined(USESPHERICALFROMREFLECTIONMAP)\nirradiance=vEnvironmentIrradiance;\n#endif\n#ifdef IBL_SHADOW_TEXTURE\nirradiance*=iblShadowValue;\n#endif\n#ifdef IRRADIANCE_SCATTER_MASK\nirradiance_alpha=min(subsurface_weight+transmission_weight,1.0);\n#endif\n#endif\ngl_FragData[IRRADIANCE_INDEX]=vec4(irradiance,irradiance_alpha);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [objectIdFunctions, clipPlaneFragmentDeclaration, mrtFragmentDeclaration, bumpFragmentMainFunctions, samplerFragmentDeclaration, bumpFragmentFunctions, helperFunctions, pbrFragmentReflectionDeclaration, sceneFragmentDeclaration, sceneUboDeclaration, pbrBRDFFunctions, openpbrDielectricReflectance, pbrIBLFunctions, reflectionFunction, openpbrGeometryInfo, openpbrIblFunctions, clipPlaneFragment, bumpFragment, openpbrSubsurfaceLayerData, openpbrTransmissionLayerData];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const geometryPixelShader = { name, shader };\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import { objectIdFunctions } from "./ShadersInclude/objectIdFunctions.js";
|
|
3
4
|
import { prePassDeclaration } from "./ShadersInclude/prePassDeclaration.js";
|
|
4
5
|
import { oitDeclaration } from "./ShadersInclude/oitDeclaration.js";
|
|
5
6
|
import { sceneFragmentDeclaration } from "./ShadersInclude/sceneFragmentDeclaration.js";
|
|
@@ -307,7 +308,7 @@ if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaM
|
|
|
307
308
|
if (!ShaderStore.ShadersStore[name]) {
|
|
308
309
|
ShaderStore.ShadersStore[name] = shader;
|
|
309
310
|
}
|
|
310
|
-
const includes = [prePassDeclaration, oitDeclaration, sceneFragmentDeclaration, decalFragmentDeclaration, openpbrFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, openpbrUboDeclaration, mainUVVaryingDeclaration, pbrFragmentExtraDeclaration, lightFragmentDeclaration, lightUboDeclaration, samplerFragmentDeclaration, pbrFragmentReflectionDeclaration, openpbrFragmentSamplersDeclaration, imageProcessingDeclaration, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, textureRepetitionFunctions, helperFunctions, subSurfaceScatteringFunctions, importanceSampling, pbrHelperFunctions, imageProcessingFunctions, shadowsFragmentFunctions, harmonicsFunctions, ltcHelperFunctions, pbrDirectLightingSetupFunctions, pbrDirectLightingFalloffFunctions, pbrBRDFFunctions, hdrFilteringFunctions, pbrDirectLightingFunctions, pbrIBLFunctions, openpbrNormalMapFragmentMainFunctions, openpbrNormalMapFragmentFunctions, reflectionFunction, openpbrDielectricReflectance, openpbrConductorReflectance, openpbrAmbientOcclusionFunctions, openpbrGeometryInfo, openpbrIblFunctions, openpbrVolumeFunctions, clipPlaneFragment, pbrBlockNormalGeometric, openpbrNormalMapFragment, openpbrBlockNormalFinal, openpbrBaseLayerData, openpbrTransmissionLayerData, openpbrSubsurfaceLayerData, openpbrCoatLayerData, openpbrThinFilmLayerData, openpbrFuzzLayerData, openpbrAmbientOcclusionData, depthPrePass, openpbrBackgroundTransmission, openpbrEnvironmentLighting, openpbrDirectLightingInit, openpbrDirectLighting, logDepthFragment, fogFragment, pbrBlockImageProcessing, openpbrBlockPrePass, oitFragment, pbrDebug];
|
|
311
|
+
const includes = [objectIdFunctions, prePassDeclaration, oitDeclaration, sceneFragmentDeclaration, decalFragmentDeclaration, openpbrFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, openpbrUboDeclaration, mainUVVaryingDeclaration, pbrFragmentExtraDeclaration, lightFragmentDeclaration, lightUboDeclaration, samplerFragmentDeclaration, pbrFragmentReflectionDeclaration, openpbrFragmentSamplersDeclaration, imageProcessingDeclaration, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, textureRepetitionFunctions, helperFunctions, subSurfaceScatteringFunctions, importanceSampling, pbrHelperFunctions, imageProcessingFunctions, shadowsFragmentFunctions, harmonicsFunctions, ltcHelperFunctions, pbrDirectLightingSetupFunctions, pbrDirectLightingFalloffFunctions, pbrBRDFFunctions, hdrFilteringFunctions, pbrDirectLightingFunctions, pbrIBLFunctions, openpbrNormalMapFragmentMainFunctions, openpbrNormalMapFragmentFunctions, reflectionFunction, openpbrDielectricReflectance, openpbrConductorReflectance, openpbrAmbientOcclusionFunctions, openpbrGeometryInfo, openpbrIblFunctions, openpbrVolumeFunctions, clipPlaneFragment, pbrBlockNormalGeometric, openpbrNormalMapFragment, openpbrBlockNormalFinal, openpbrBaseLayerData, openpbrTransmissionLayerData, openpbrSubsurfaceLayerData, openpbrCoatLayerData, openpbrThinFilmLayerData, openpbrFuzzLayerData, openpbrAmbientOcclusionData, depthPrePass, openpbrBackgroundTransmission, openpbrEnvironmentLighting, openpbrDirectLightingInit, openpbrDirectLighting, logDepthFragment, fogFragment, pbrBlockImageProcessing, openpbrBlockPrePass, oitFragment, pbrDebug];
|
|
311
312
|
for (const inc of includes) {
|
|
312
313
|
if (!ShaderStore.IncludesShadersStore[inc.name]) {
|
|
313
314
|
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openpbr.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/openpbr.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC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itDeclaration } from \"./ShadersInclude/oitDeclaration\";\nimport { sceneFragmentDeclaration } from \"./ShadersInclude/sceneFragmentDeclaration\";\nimport { decalFragmentDeclaration } from \"./ShadersInclude/decalFragmentDeclaration\";\nimport { openpbrFragmentDeclaration } from \"./ShadersInclude/openpbrFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { meshUboDeclaration } from \"./ShadersInclude/meshUboDeclaration\";\nimport { openpbrUboDeclaration } from \"./ShadersInclude/openpbrUboDeclaration\";\nimport { mainUVVaryingDeclaration } from \"./ShadersInclude/mainUVVaryingDeclaration\";\nimport { pbrFragmentExtraDeclaration } from \"./ShadersInclude/pbrFragmentExtraDeclaration\";\nimport { lightFragmentDeclaration } from \"./ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"./ShadersInclude/lightUboDeclaration\";\nimport { samplerFragmentDeclaration } from \"./ShadersInclude/samplerFragmentDeclaration\";\nimport { pbrFragmentReflectionDeclaration } from \"./ShadersInclude/pbrFragmentReflectionDeclaration\";\nimport { openpbrFragmentSamplersDeclaration } from \"./ShadersInclude/openpbrFragmentSamplersDeclaration\";\nimport { imageProcessingDeclaration } from \"./ShadersInclude/imageProcessingDeclaration\";\nimport { clipPlaneFragmentDeclaration } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"./ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"./ShadersInclude/fogFragmentDeclaration\";\nimport { textureRepetitionFunctions } from \"./ShadersInclude/textureRepetitionFunctions\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { subSurfaceScatteringFunctions } from \"./ShadersInclude/subSurfaceScatteringFunctions\";\nimport { importanceSampling } from \"./ShadersInclude/importanceSampling\";\nimport { pbrHelperFunctions } from \"./ShadersInclude/pbrHelperFunctions\";\nimport { imageProcessingFunctions } from \"./ShadersInclude/imageProcessingFunctions\";\nimport { shadowsFragmentFunctions } from \"./ShadersInclude/shadowsFragmentFunctions\";\nimport { harmonicsFunctions } from \"./ShadersInclude/harmonicsFunctions\";\nimport { ltcHelperFunctions } from \"./ShadersInclude/ltcHelperFunctions\";\nimport { pbrDirectLightingSetupFunctions } from \"./ShadersInclude/pbrDirectLightingSetupFunctions\";\nimport { pbrDirectLightingFalloffFunctions } from \"./ShadersInclude/pbrDirectLightingFalloffFunctions\";\nimport { pbrBRDFFunctions } from \"./ShadersInclude/pbrBRDFFunctions\";\nimport { hdrFilteringFunctions } from \"./ShadersInclude/hdrFilteringFunctions\";\nimport { pbrDirectLightingFunctions } from \"./ShadersInclude/pbrDirectLightingFunctions\";\nimport { pbrIBLFunctions } from \"./ShadersInclude/pbrIBLFunctions\";\nimport { openpbrNormalMapFragmentMainFunctions } from \"./ShadersInclude/openpbrNormalMapFragmentMainFunctions\";\nimport { openpbrNormalMapFragmentFunctions } from \"./ShadersInclude/openpbrNormalMapFragmentFunctions\";\nimport { reflectionFunction } from \"./ShadersInclude/reflectionFunction\";\nimport { openpbrDielectricReflectance } from \"./ShadersInclude/openpbrDielectricReflectance\";\nimport { openpbrConductorReflectance } from \"./ShadersInclude/openpbrConductorReflectance\";\nimport { openpbrAmbientOcclusionFunctions } from \"./ShadersInclude/openpbrAmbientOcclusionFunctions\";\nimport { openpbrGeometryInfo } from \"./ShadersInclude/openpbrGeometryInfo\";\nimport { openpbrIblFunctions } from \"./ShadersInclude/openpbrIblFunctions\";\nimport { openpbrVolumeFunctions } from \"./ShadersInclude/openpbrVolumeFunctions\";\nimport { clipPlaneFragment } from \"./ShadersInclude/clipPlaneFragment\";\nimport { pbrBlockNormalGeometric } from \"./ShadersInclude/pbrBlockNormalGeometric\";\nimport { openpbrNormalMapFragment } from \"./ShadersInclude/openpbrNormalMapFragment\";\nimport { openpbrBlockNormalFinal } from \"./ShadersInclude/openpbrBlockNormalFinal\";\nimport { openpbrBaseLayerData } from \"./ShadersInclude/openpbrBaseLayerData\";\nimport { openpbrTransmissionLayerData } from \"./ShadersInclude/openpbrTransmissionLayerData\";\nimport { openpbrSubsurfaceLayerData } from \"./ShadersInclude/openpbrSubsurfaceLayerData\";\nimport { openpbrCoatLayerData } from \"./ShadersInclude/openpbrCoatLayerData\";\nimport { openpbrThinFilmLayerData } from \"./ShadersInclude/openpbrThinFilmLayerData\";\nimport { openpbrFuzzLayerData } from \"./ShadersInclude/openpbrFuzzLayerData\";\nimport { openpbrAmbientOcclusionData } from \"./ShadersInclude/openpbrAmbientOcclusionData\";\nimport { depthPrePass } from \"./ShadersInclude/depthPrePass\";\nimport { openpbrBackgroundTransmission } from \"./ShadersInclude/openpbrBackgroundTransmission\";\nimport { openpbrEnvironmentLighting } from \"./ShadersInclude/openpbrEnvironmentLighting\";\nimport { openpbrDirectLightingInit } from \"./ShadersInclude/openpbrDirectLightingInit\";\nimport { openpbrDirectLighting } from \"./ShadersInclude/openpbrDirectLighting\";\nimport { logDepthFragment } from \"./ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"./ShadersInclude/fogFragment\";\nimport { pbrBlockImageProcessing } from \"./ShadersInclude/pbrBlockImageProcessing\";\nimport { openpbrBlockPrePass } from \"./ShadersInclude/openpbrBlockPrePass\";\nimport { oitFragment } from \"./ShadersInclude/oitFragment\";\nimport { pbrDebug } from \"./ShadersInclude/pbrDebug\";\n\nconst name = \"openpbrPixelShader\";\nconst shader = `#define OPENPBR_FRAGMENT_SHADER\n#define CUSTOM_FRAGMENT_EXTENSION\n#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\nprecision highp float;\n#include<oitDeclaration>\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE\n#endif\n#include<__decl__openpbrFragment>\n#include<pbrFragmentExtraDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<openpbrFragmentSamplersDeclaration>\n#include<imageProcessingDeclaration>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#include<textureRepetitionFunctions>\n#include<helperFunctions>\n#include<subSurfaceScatteringFunctions>\n#include<importanceSampling>\n#include<pbrHelperFunctions>\n#include<imageProcessingFunctions>\n#include<shadowsFragmentFunctions>\n#include<harmonicsFunctions>\n#include<pbrDirectLightingSetupFunctions>\n#include<pbrDirectLightingFalloffFunctions>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\n#include<pbrDirectLightingFunctions>\n#include<pbrIBLFunctions>\n#include<openpbrNormalMapFragmentMainFunctions>\n#include<openpbrNormalMapFragmentFunctions>\n#ifdef REFLECTION\n#include<reflectionFunction>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#include<openpbrDielectricReflectance>\n#include<openpbrConductorReflectance>\n#include<openpbrAmbientOcclusionFunctions>\n#include<openpbrGeometryInfo>\n#include<openpbrIblFunctions>\n#include<openpbrVolumeFunctions>\nvec3 layer(vec3 slab_bottom,vec3 slab_top,float lerp_factor,vec3 bottom_multiplier,vec3 top_multiplier) {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);}\nvoid main(void) {\n#ifdef PREPASS_IRRADIANCE\nvec3 total_direct_diffuse=vec3(0.0);\n#endif\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n#include<pbrBlockNormalGeometric>\nvec3 coatNormalW=normalW;\n#include<openpbrNormalMapFragment>\n#include<openpbrBlockNormalFinal>\n#include<openpbrBaseLayerData>\n#include<openpbrTransmissionLayerData>\n#include<openpbrSubsurfaceLayerData>\n#include<openpbrCoatLayerData>\n#include<openpbrThinFilmLayerData>\n#include<openpbrFuzzLayerData>\n#include<openpbrAmbientOcclusionData>\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\n#include<depthPrePass>\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n#ifdef ANISOTROPIC_COAT\ngeometryInfoAnisoOutParams coatGeoInfo=geometryInfoAniso(\ncoatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW\n,vec3(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN\n);\n#else\ngeometryInfoOutParams coatGeoInfo=geometryInfo(\ncoatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW\n);\n#endif\nspecular_roughness=mix(specular_roughness,pow(min(1.0,pow(specular_roughness,4.0)+2.0*pow(coat_roughness,4.0)),0.25),coat_weight);\n#ifdef ANISOTROPIC_BASE\ngeometryInfoAnisoOutParams baseGeoInfo=geometryInfoAniso(\nnormalW,viewDirectionW.xyz,specular_roughness,geometricNormalW\n,vec3(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN\n);\n#else\ngeometryInfoOutParams baseGeoInfo=geometryInfo(\nnormalW,viewDirectionW.xyz,specular_roughness,geometricNormalW\n);\n#endif\n#ifdef FUZZ\nvec3 fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));vec3 fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);vec3 fuzzBitangent=cross(fuzzNormalW,fuzzTangent);geometryInfoOutParams fuzzGeoInfo=geometryInfo(\nfuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW\n);\n#endif\nReflectanceParams coatReflectance;coatReflectance=dielectricReflectance(\ncoat_ior \n,1.0 \n,vec3(1.0)\n,coat_weight\n);\n#ifdef THIN_FILM\nfloat thin_film_outside_ior=mix(1.0,coat_ior,coat_weight);\n#endif\nReflectanceParams baseDielectricReflectance;{float effectiveCoatIor=mix(1.0,coat_ior,coat_weight);baseDielectricReflectance=dielectricReflectance(\nspecular_ior \n,effectiveCoatIor \n,specular_color\n,specular_weight\n);}\nReflectanceParams baseConductorReflectance;baseConductorReflectance=conductorReflectance(base_color,specular_color,specular_weight);vec3 volume_absorption=vec3(1.0);vec3 transmission_tint=vec3(1.0);float surface_translucency_weight=0.0;\n#if defined(REFRACTED_BACKGROUND) || defined(REFRACTED_ENVIRONMENT) || defined(REFRACTED_LIGHTS)\n#if defined(GEOMETRY_THIN_WALLED)\nvec3 refractedViewVector=-viewDirectionW;\n#else\n#ifdef DISPERSION\nvec3 refractedViewVectors[3];float iorDispersionSpread=transmission_dispersion_scale/transmission_dispersion_abbe_number*(specular_ior-1.0);vec3 dispersion_iors=vec3(specular_ior-iorDispersionSpread,specular_ior,specular_ior+iorDispersionSpread);for (int i=0; i<3; i++) {refractedViewVectors[i]=double_refract(-viewDirectionW,normalW,dispersion_iors[i]); }\n#else\nvec3 refractedViewVector=double_refract(-viewDirectionW,normalW,specular_ior);\n#endif\n#endif\n#ifdef GEOMETRY_THIN_WALLED\nfloat transmission_roughness=specular_roughness;\n#else\nfloat transmission_roughness=specular_roughness*clamp(4.0*(specular_ior-1.0),0.001,1.0);\n#endif\n#if (defined(TRANSMISSION_SLAB) || defined(SUBSURFACE_SLAB))\nOpenPBRHomogeneousVolume volumeParams;{\n#if defined(TRANSMISSION_SLAB)\nOpenPBRHomogeneousVolume transmissionVolumeParams=computeOpenPBRTransmissionVolume(\ntransmission_color.rgb,\ntransmission_depth,\ntransmission_scatter.rgb,\ntransmission_scatter_anisotropy\n);\n#endif\n#if defined(SUBSURFACE_SLAB)\nOpenPBRHomogeneousVolume subsurfaceVolumeParams=computeOpenPBRSubsurfaceVolume(\nsubsurface_color.rgb,\nsubsurface_radius,\nsubsurface_radius_scale.rgb,\nsubsurface_scatter_anisotropy\n);\n#endif\n#if !defined(TRANSMISSION_SLAB)\nvolumeParams=subsurfaceVolumeParams;surface_translucency_weight=subsurface_weight;\n#elif !defined(SUBSURFACE_SLAB)\nvolumeParams=transmissionVolumeParams;\n#ifdef TRANSMISSION_SLAB_VOLUME\nvolumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);\n#endif\nsurface_translucency_weight=transmission_weight;\n#else\nfloat subsurface_fraction_of_dielectric=(1.0f-transmission_weight)*subsurface_weight;float subsurface_and_transmission_fraction_of_dielectric=subsurface_fraction_of_dielectric+transmission_weight;float reciprocal_of_subsurface_and_transmission_fraction_of_dielectric =\n1.0f/maxEps(subsurface_and_transmission_fraction_of_dielectric);float trans_weight=transmission_weight*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;float subsurf_weight=subsurface_fraction_of_dielectric*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;volumeParams.scatter_coeff=transmissionVolumeParams.scatter_coeff*trans_weight+subsurfaceVolumeParams.scatter_coeff*subsurf_weight;volumeParams.absorption_coeff=transmissionVolumeParams.absorption_coeff*trans_weight+subsurfaceVolumeParams.absorption_coeff*subsurf_weight;volumeParams.anisotropy=(transmissionVolumeParams.anisotropy*trans_weight+subsurfaceVolumeParams.anisotropy*subsurf_weight)/maxEps(trans_weight+subsurf_weight);volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=volumeParams.scatter_coeff/maxEps(volumeParams.extinction_coeff);volumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);surface_translucency_weight=subsurface_and_transmission_fraction_of_dielectric;\n#endif\n}\nvolume_absorption=exp(-volumeParams.absorption_coeff*geometry_thickness);vec3 backscatter_color=vec3(1.0);{vec3 reduced_scatter=volumeParams.scatter_coeff*vec3(1.0-volumeParams.anisotropy);vec3 reduced_albedo=reduced_scatter/(volumeParams.absorption_coeff+reduced_scatter);vec3 sqrt_term=max(sqrt(1.0-reduced_albedo),0.0001);backscatter_color=(1.0-sqrt_term)/(1.0+sqrt_term);}\n#elif defined(TRANSMISSION_SLAB)\nsurface_translucency_weight=transmission_weight;\n#endif\n#ifdef SCATTERING\n#ifdef GEOMETRY_THIN_WALLED\nvec3 iso_scatter_density=vec3(1.0);\n#else\n#ifdef USE_IRRADIANCE_TEXTURE_FOR_SCATTERING\nvec3 mfp=vec3(100.0)/volumeParams.extinction_coeff;vec3 scattered_light_from_irradiance_texture=sss_convolve(sceneIrradianceSampler,sceneDepthSampler,renderTargetSize,mfp,projection,inverseProjection,SSS_SAMPLE_COUNT,noise.xy);float numLights=float(LIGHTCOUNT);\n#ifdef REFLECTION\nnumLights+=1.0;\n#endif\nscattered_light_from_irradiance_texture/=numLights;\n#else\nvec3 scattered_light_from_irradiance_texture=vec3(0.0);\n#endif\nfloat back_to_iso_scattering_blend=min(1.0+volumeParams.anisotropy,1.0);float iso_to_forward_scattering_blend=max(volumeParams.anisotropy,0.0);vec3 iso_scatter_transmittance=pow(exp(-volumeParams.scatter_coeff*geometry_thickness),vec3(0.2));vec3 iso_scatter_density=clamp(vec3(1.0)-iso_scatter_transmittance,0.0,1.0);transmission_roughness=min(transmission_roughness+pow((1.0-abs(volumeParams.anisotropy))*max3(iso_scatter_density*iso_scatter_density),3.0),1.0);\n#endif\nvolumeParams.multi_scatter_color=mix(volumeParams.ss_albedo,volumeParams.multi_scatter_color,max3(iso_scatter_density));\n#endif\n#if defined(TRANSMISSION_SLAB) && (!defined(TRANSMISSION_SLAB_VOLUME) || defined(GEOMETRY_THIN_WALLED))\ntransmission_tint*=transmission_color.rgb;\n#ifdef GEOMETRY_THIN_WALLED\nfloat sin2=1.0-baseGeoInfo.NdotV*baseGeoInfo.NdotV;sin2=sin2/(specular_ior*specular_ior);float cos_t=sqrt(1.0-sin2);float pathLength=1.0/cos_t;transmission_tint=pow(transmission_tint,vec3(pathLength));\n#else\ntransmission_tint*=transmission_color.rgb;\n#endif\n#endif\n#if defined(SUBSURFACE_SLAB) && defined(GEOMETRY_THIN_WALLED)\nfloat unweighted_translucency=max(mix(subsurface_weight,1.0f,transmission_weight),0.0001);transmission_tint=mix(vec3(1.0),transmission_tint,transmission_weight/unweighted_translucency);transmission_roughness=mix(1.0,transmission_roughness,transmission_weight/unweighted_translucency);\n#endif\nfloat transmission_roughness_alpha=transmission_roughness*transmission_roughness;\n#endif\n#include<openpbrBackgroundTransmission>\nvec3 material_surface_ibl=vec3(0.,0.,0.);\n#include<openpbrEnvironmentLighting>\nvec3 material_surface_direct=vec3(0.,0.,0.);\n#if defined(LIGHT0)\nfloat aggShadow=0.;\n#include<openpbrDirectLightingInit>[0..maxSimultaneousLights]\n#include<openpbrDirectLighting>[0..maxSimultaneousLights]\n#endif\nvec3 material_surface_emission=vEmissionColor;\n#ifdef EMISSION_COLOR\nvec3 emissionColorTex=TEXRD(emissionColorSampler,vEmissionColorUV+uvOffset).rgb;\n#ifdef EMISSION_COLOR_GAMMA\nmaterial_surface_emission*=toLinearSpace(emissionColorTex.rgb);\n#else\nmaterial_surface_emission*=emissionColorTex.rgb;\n#endif\nmaterial_surface_emission*= vEmissionColorInfos.y;\n#endif\nmaterial_surface_emission*=vLightingIntensity.y;\n#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\nvec4 finalColor=vec4(material_surface_ibl+material_surface_direct+material_surface_emission,alpha);\n#define CUSTOM_FRAGMENT_BEFORE_FOG\nfinalColor=max(finalColor,0.0);\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#include<pbrBlockImageProcessing>\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\n#include<openpbrBlockPrePass>\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=finalColor;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;}\n#endif\n#include<pbrDebug>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [prePassDeclaration, oitDeclaration, sceneFragmentDeclaration, decalFragmentDeclaration, openpbrFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, openpbrUboDeclaration, mainUVVaryingDeclaration, pbrFragmentExtraDeclaration, lightFragmentDeclaration, lightUboDeclaration, samplerFragmentDeclaration, pbrFragmentReflectionDeclaration, openpbrFragmentSamplersDeclaration, imageProcessingDeclaration, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, textureRepetitionFunctions, helperFunctions, subSurfaceScatteringFunctions, importanceSampling, pbrHelperFunctions, imageProcessingFunctions, shadowsFragmentFunctions, harmonicsFunctions, ltcHelperFunctions, pbrDirectLightingSetupFunctions, pbrDirectLightingFalloffFunctions, pbrBRDFFunctions, hdrFilteringFunctions, pbrDirectLightingFunctions, pbrIBLFunctions, openpbrNormalMapFragmentMainFunctions, openpbrNormalMapFragmentFunctions, reflectionFunction, openpbrDielectricReflectance, openpbrConductorReflectance, openpbrAmbientOcclusionFunctions, openpbrGeometryInfo, openpbrIblFunctions, openpbrVolumeFunctions, clipPlaneFragment, pbrBlockNormalGeometric, openpbrNormalMapFragment, openpbrBlockNormalFinal, openpbrBaseLayerData, openpbrTransmissionLayerData, openpbrSubsurfaceLayerData, openpbrCoatLayerData, openpbrThinFilmLayerData, openpbrFuzzLayerData, openpbrAmbientOcclusionData, depthPrePass, openpbrBackgroundTransmission, openpbrEnvironmentLighting, openpbrDirectLightingInit, openpbrDirectLighting, logDepthFragment, fogFragment, pbrBlockImageProcessing, openpbrBlockPrePass, oitFragment, pbrDebug];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const openpbrPixelShader = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"openpbr.fragment.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E,oBAAoB,EAAE,2BAA2B,EAAE,YAAY,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAChmD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { objectIdFunctions } from \"./ShadersInclude/objectIdFunctions\";\nimport { prePassDeclaration } from \"./ShadersInclude/prePassDeclaration\";\nimport { oitDeclaration } from \"./ShadersInclude/oitDeclaration\";\nimport { sceneFragmentDeclaration } from \"./ShadersInclude/sceneFragmentDeclaration\";\nimport { decalFragmentDeclaration } from \"./ShadersInclude/decalFragmentDeclaration\";\nimport { openpbrFragmentDeclaration } from \"./ShadersInclude/openpbrFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { meshUboDeclaration } from \"./ShadersInclude/meshUboDeclaration\";\nimport { openpbrUboDeclaration } from \"./ShadersInclude/openpbrUboDeclaration\";\nimport { mainUVVaryingDeclaration } from \"./ShadersInclude/mainUVVaryingDeclaration\";\nimport { pbrFragmentExtraDeclaration } from \"./ShadersInclude/pbrFragmentExtraDeclaration\";\nimport { lightFragmentDeclaration } from \"./ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"./ShadersInclude/lightUboDeclaration\";\nimport { samplerFragmentDeclaration } from \"./ShadersInclude/samplerFragmentDeclaration\";\nimport { pbrFragmentReflectionDeclaration } from \"./ShadersInclude/pbrFragmentReflectionDeclaration\";\nimport { openpbrFragmentSamplersDeclaration } from \"./ShadersInclude/openpbrFragmentSamplersDeclaration\";\nimport { imageProcessingDeclaration } from \"./ShadersInclude/imageProcessingDeclaration\";\nimport { clipPlaneFragmentDeclaration } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"./ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"./ShadersInclude/fogFragmentDeclaration\";\nimport { textureRepetitionFunctions } from \"./ShadersInclude/textureRepetitionFunctions\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { subSurfaceScatteringFunctions } from \"./ShadersInclude/subSurfaceScatteringFunctions\";\nimport { importanceSampling } from \"./ShadersInclude/importanceSampling\";\nimport { pbrHelperFunctions } from \"./ShadersInclude/pbrHelperFunctions\";\nimport { imageProcessingFunctions } from \"./ShadersInclude/imageProcessingFunctions\";\nimport { shadowsFragmentFunctions } from \"./ShadersInclude/shadowsFragmentFunctions\";\nimport { harmonicsFunctions } from \"./ShadersInclude/harmonicsFunctions\";\nimport { ltcHelperFunctions } from \"./ShadersInclude/ltcHelperFunctions\";\nimport { pbrDirectLightingSetupFunctions } from \"./ShadersInclude/pbrDirectLightingSetupFunctions\";\nimport { pbrDirectLightingFalloffFunctions } from \"./ShadersInclude/pbrDirectLightingFalloffFunctions\";\nimport { pbrBRDFFunctions } from \"./ShadersInclude/pbrBRDFFunctions\";\nimport { hdrFilteringFunctions } from \"./ShadersInclude/hdrFilteringFunctions\";\nimport { pbrDirectLightingFunctions } from \"./ShadersInclude/pbrDirectLightingFunctions\";\nimport { pbrIBLFunctions } from \"./ShadersInclude/pbrIBLFunctions\";\nimport { openpbrNormalMapFragmentMainFunctions } from \"./ShadersInclude/openpbrNormalMapFragmentMainFunctions\";\nimport { openpbrNormalMapFragmentFunctions } from \"./ShadersInclude/openpbrNormalMapFragmentFunctions\";\nimport { reflectionFunction } from \"./ShadersInclude/reflectionFunction\";\nimport { openpbrDielectricReflectance } from \"./ShadersInclude/openpbrDielectricReflectance\";\nimport { openpbrConductorReflectance } from \"./ShadersInclude/openpbrConductorReflectance\";\nimport { openpbrAmbientOcclusionFunctions } from \"./ShadersInclude/openpbrAmbientOcclusionFunctions\";\nimport { openpbrGeometryInfo } from \"./ShadersInclude/openpbrGeometryInfo\";\nimport { openpbrIblFunctions } from \"./ShadersInclude/openpbrIblFunctions\";\nimport { openpbrVolumeFunctions } from \"./ShadersInclude/openpbrVolumeFunctions\";\nimport { clipPlaneFragment } from \"./ShadersInclude/clipPlaneFragment\";\nimport { pbrBlockNormalGeometric } from \"./ShadersInclude/pbrBlockNormalGeometric\";\nimport { openpbrNormalMapFragment } from \"./ShadersInclude/openpbrNormalMapFragment\";\nimport { openpbrBlockNormalFinal } from \"./ShadersInclude/openpbrBlockNormalFinal\";\nimport { openpbrBaseLayerData } from \"./ShadersInclude/openpbrBaseLayerData\";\nimport { openpbrTransmissionLayerData } from \"./ShadersInclude/openpbrTransmissionLayerData\";\nimport { openpbrSubsurfaceLayerData } from \"./ShadersInclude/openpbrSubsurfaceLayerData\";\nimport { openpbrCoatLayerData } from \"./ShadersInclude/openpbrCoatLayerData\";\nimport { openpbrThinFilmLayerData } from \"./ShadersInclude/openpbrThinFilmLayerData\";\nimport { openpbrFuzzLayerData } from \"./ShadersInclude/openpbrFuzzLayerData\";\nimport { openpbrAmbientOcclusionData } from \"./ShadersInclude/openpbrAmbientOcclusionData\";\nimport { depthPrePass } from \"./ShadersInclude/depthPrePass\";\nimport { openpbrBackgroundTransmission } from \"./ShadersInclude/openpbrBackgroundTransmission\";\nimport { openpbrEnvironmentLighting } from \"./ShadersInclude/openpbrEnvironmentLighting\";\nimport { openpbrDirectLightingInit } from \"./ShadersInclude/openpbrDirectLightingInit\";\nimport { openpbrDirectLighting } from \"./ShadersInclude/openpbrDirectLighting\";\nimport { logDepthFragment } from \"./ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"./ShadersInclude/fogFragment\";\nimport { pbrBlockImageProcessing } from \"./ShadersInclude/pbrBlockImageProcessing\";\nimport { openpbrBlockPrePass } from \"./ShadersInclude/openpbrBlockPrePass\";\nimport { oitFragment } from \"./ShadersInclude/oitFragment\";\nimport { pbrDebug } from \"./ShadersInclude/pbrDebug\";\n\nconst name = \"openpbrPixelShader\";\nconst shader = `#define OPENPBR_FRAGMENT_SHADER\n#define CUSTOM_FRAGMENT_EXTENSION\n#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\nprecision highp float;\n#include<oitDeclaration>\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE\n#endif\n#include<__decl__openpbrFragment>\n#include<pbrFragmentExtraDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<openpbrFragmentSamplersDeclaration>\n#include<imageProcessingDeclaration>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#include<textureRepetitionFunctions>\n#include<helperFunctions>\n#include<subSurfaceScatteringFunctions>\n#include<importanceSampling>\n#include<pbrHelperFunctions>\n#include<imageProcessingFunctions>\n#include<shadowsFragmentFunctions>\n#include<harmonicsFunctions>\n#include<pbrDirectLightingSetupFunctions>\n#include<pbrDirectLightingFalloffFunctions>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\n#include<pbrDirectLightingFunctions>\n#include<pbrIBLFunctions>\n#include<openpbrNormalMapFragmentMainFunctions>\n#include<openpbrNormalMapFragmentFunctions>\n#ifdef REFLECTION\n#include<reflectionFunction>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#include<openpbrDielectricReflectance>\n#include<openpbrConductorReflectance>\n#include<openpbrAmbientOcclusionFunctions>\n#include<openpbrGeometryInfo>\n#include<openpbrIblFunctions>\n#include<openpbrVolumeFunctions>\nvec3 layer(vec3 slab_bottom,vec3 slab_top,float lerp_factor,vec3 bottom_multiplier,vec3 top_multiplier) {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);}\nvoid main(void) {\n#ifdef PREPASS_IRRADIANCE\nvec3 total_direct_diffuse=vec3(0.0);\n#endif\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n#include<pbrBlockNormalGeometric>\nvec3 coatNormalW=normalW;\n#include<openpbrNormalMapFragment>\n#include<openpbrBlockNormalFinal>\n#include<openpbrBaseLayerData>\n#include<openpbrTransmissionLayerData>\n#include<openpbrSubsurfaceLayerData>\n#include<openpbrCoatLayerData>\n#include<openpbrThinFilmLayerData>\n#include<openpbrFuzzLayerData>\n#include<openpbrAmbientOcclusionData>\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\n#include<depthPrePass>\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n#ifdef ANISOTROPIC_COAT\ngeometryInfoAnisoOutParams coatGeoInfo=geometryInfoAniso(\ncoatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW\n,vec3(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN\n);\n#else\ngeometryInfoOutParams coatGeoInfo=geometryInfo(\ncoatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW\n);\n#endif\nspecular_roughness=mix(specular_roughness,pow(min(1.0,pow(specular_roughness,4.0)+2.0*pow(coat_roughness,4.0)),0.25),coat_weight);\n#ifdef ANISOTROPIC_BASE\ngeometryInfoAnisoOutParams baseGeoInfo=geometryInfoAniso(\nnormalW,viewDirectionW.xyz,specular_roughness,geometricNormalW\n,vec3(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN\n);\n#else\ngeometryInfoOutParams baseGeoInfo=geometryInfo(\nnormalW,viewDirectionW.xyz,specular_roughness,geometricNormalW\n);\n#endif\n#ifdef FUZZ\nvec3 fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));vec3 fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);vec3 fuzzBitangent=cross(fuzzNormalW,fuzzTangent);geometryInfoOutParams fuzzGeoInfo=geometryInfo(\nfuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW\n);\n#endif\nReflectanceParams coatReflectance;coatReflectance=dielectricReflectance(\ncoat_ior \n,1.0 \n,vec3(1.0)\n,coat_weight\n);\n#ifdef THIN_FILM\nfloat thin_film_outside_ior=mix(1.0,coat_ior,coat_weight);\n#endif\nReflectanceParams baseDielectricReflectance;{float effectiveCoatIor=mix(1.0,coat_ior,coat_weight);baseDielectricReflectance=dielectricReflectance(\nspecular_ior \n,effectiveCoatIor \n,specular_color\n,specular_weight\n);}\nReflectanceParams baseConductorReflectance;baseConductorReflectance=conductorReflectance(base_color,specular_color,specular_weight);vec3 volume_absorption=vec3(1.0);vec3 transmission_tint=vec3(1.0);float surface_translucency_weight=0.0;\n#if defined(REFRACTED_BACKGROUND) || defined(REFRACTED_ENVIRONMENT) || defined(REFRACTED_LIGHTS)\n#if defined(GEOMETRY_THIN_WALLED)\nvec3 refractedViewVector=-viewDirectionW;\n#else\n#ifdef DISPERSION\nvec3 refractedViewVectors[3];float iorDispersionSpread=transmission_dispersion_scale/transmission_dispersion_abbe_number*(specular_ior-1.0);vec3 dispersion_iors=vec3(specular_ior-iorDispersionSpread,specular_ior,specular_ior+iorDispersionSpread);for (int i=0; i<3; i++) {refractedViewVectors[i]=double_refract(-viewDirectionW,normalW,dispersion_iors[i]); }\n#else\nvec3 refractedViewVector=double_refract(-viewDirectionW,normalW,specular_ior);\n#endif\n#endif\n#ifdef GEOMETRY_THIN_WALLED\nfloat transmission_roughness=specular_roughness;\n#else\nfloat transmission_roughness=specular_roughness*clamp(4.0*(specular_ior-1.0),0.001,1.0);\n#endif\n#if (defined(TRANSMISSION_SLAB) || defined(SUBSURFACE_SLAB))\nOpenPBRHomogeneousVolume volumeParams;{\n#if defined(TRANSMISSION_SLAB)\nOpenPBRHomogeneousVolume transmissionVolumeParams=computeOpenPBRTransmissionVolume(\ntransmission_color.rgb,\ntransmission_depth,\ntransmission_scatter.rgb,\ntransmission_scatter_anisotropy\n);\n#endif\n#if defined(SUBSURFACE_SLAB)\nOpenPBRHomogeneousVolume subsurfaceVolumeParams=computeOpenPBRSubsurfaceVolume(\nsubsurface_color.rgb,\nsubsurface_radius,\nsubsurface_radius_scale.rgb,\nsubsurface_scatter_anisotropy\n);\n#endif\n#if !defined(TRANSMISSION_SLAB)\nvolumeParams=subsurfaceVolumeParams;surface_translucency_weight=subsurface_weight;\n#elif !defined(SUBSURFACE_SLAB)\nvolumeParams=transmissionVolumeParams;\n#ifdef TRANSMISSION_SLAB_VOLUME\nvolumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);\n#endif\nsurface_translucency_weight=transmission_weight;\n#else\nfloat subsurface_fraction_of_dielectric=(1.0f-transmission_weight)*subsurface_weight;float subsurface_and_transmission_fraction_of_dielectric=subsurface_fraction_of_dielectric+transmission_weight;float reciprocal_of_subsurface_and_transmission_fraction_of_dielectric =\n1.0f/maxEps(subsurface_and_transmission_fraction_of_dielectric);float trans_weight=transmission_weight*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;float subsurf_weight=subsurface_fraction_of_dielectric*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;volumeParams.scatter_coeff=transmissionVolumeParams.scatter_coeff*trans_weight+subsurfaceVolumeParams.scatter_coeff*subsurf_weight;volumeParams.absorption_coeff=transmissionVolumeParams.absorption_coeff*trans_weight+subsurfaceVolumeParams.absorption_coeff*subsurf_weight;volumeParams.anisotropy=(transmissionVolumeParams.anisotropy*trans_weight+subsurfaceVolumeParams.anisotropy*subsurf_weight)/maxEps(trans_weight+subsurf_weight);volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=volumeParams.scatter_coeff/maxEps(volumeParams.extinction_coeff);volumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);surface_translucency_weight=subsurface_and_transmission_fraction_of_dielectric;\n#endif\n}\nvolume_absorption=exp(-volumeParams.absorption_coeff*geometry_thickness);vec3 backscatter_color=vec3(1.0);{vec3 reduced_scatter=volumeParams.scatter_coeff*vec3(1.0-volumeParams.anisotropy);vec3 reduced_albedo=reduced_scatter/(volumeParams.absorption_coeff+reduced_scatter);vec3 sqrt_term=max(sqrt(1.0-reduced_albedo),0.0001);backscatter_color=(1.0-sqrt_term)/(1.0+sqrt_term);}\n#elif defined(TRANSMISSION_SLAB)\nsurface_translucency_weight=transmission_weight;\n#endif\n#ifdef SCATTERING\n#ifdef GEOMETRY_THIN_WALLED\nvec3 iso_scatter_density=vec3(1.0);\n#else\n#ifdef USE_IRRADIANCE_TEXTURE_FOR_SCATTERING\nvec3 mfp=vec3(100.0)/volumeParams.extinction_coeff;vec3 scattered_light_from_irradiance_texture=sss_convolve(sceneIrradianceSampler,sceneDepthSampler,renderTargetSize,mfp,projection,inverseProjection,SSS_SAMPLE_COUNT,noise.xy);float numLights=float(LIGHTCOUNT);\n#ifdef REFLECTION\nnumLights+=1.0;\n#endif\nscattered_light_from_irradiance_texture/=numLights;\n#else\nvec3 scattered_light_from_irradiance_texture=vec3(0.0);\n#endif\nfloat back_to_iso_scattering_blend=min(1.0+volumeParams.anisotropy,1.0);float iso_to_forward_scattering_blend=max(volumeParams.anisotropy,0.0);vec3 iso_scatter_transmittance=pow(exp(-volumeParams.scatter_coeff*geometry_thickness),vec3(0.2));vec3 iso_scatter_density=clamp(vec3(1.0)-iso_scatter_transmittance,0.0,1.0);transmission_roughness=min(transmission_roughness+pow((1.0-abs(volumeParams.anisotropy))*max3(iso_scatter_density*iso_scatter_density),3.0),1.0);\n#endif\nvolumeParams.multi_scatter_color=mix(volumeParams.ss_albedo,volumeParams.multi_scatter_color,max3(iso_scatter_density));\n#endif\n#if defined(TRANSMISSION_SLAB) && (!defined(TRANSMISSION_SLAB_VOLUME) || defined(GEOMETRY_THIN_WALLED))\ntransmission_tint*=transmission_color.rgb;\n#ifdef GEOMETRY_THIN_WALLED\nfloat sin2=1.0-baseGeoInfo.NdotV*baseGeoInfo.NdotV;sin2=sin2/(specular_ior*specular_ior);float cos_t=sqrt(1.0-sin2);float pathLength=1.0/cos_t;transmission_tint=pow(transmission_tint,vec3(pathLength));\n#else\ntransmission_tint*=transmission_color.rgb;\n#endif\n#endif\n#if defined(SUBSURFACE_SLAB) && defined(GEOMETRY_THIN_WALLED)\nfloat unweighted_translucency=max(mix(subsurface_weight,1.0f,transmission_weight),0.0001);transmission_tint=mix(vec3(1.0),transmission_tint,transmission_weight/unweighted_translucency);transmission_roughness=mix(1.0,transmission_roughness,transmission_weight/unweighted_translucency);\n#endif\nfloat transmission_roughness_alpha=transmission_roughness*transmission_roughness;\n#endif\n#include<openpbrBackgroundTransmission>\nvec3 material_surface_ibl=vec3(0.,0.,0.);\n#include<openpbrEnvironmentLighting>\nvec3 material_surface_direct=vec3(0.,0.,0.);\n#if defined(LIGHT0)\nfloat aggShadow=0.;\n#include<openpbrDirectLightingInit>[0..maxSimultaneousLights]\n#include<openpbrDirectLighting>[0..maxSimultaneousLights]\n#endif\nvec3 material_surface_emission=vEmissionColor;\n#ifdef EMISSION_COLOR\nvec3 emissionColorTex=TEXRD(emissionColorSampler,vEmissionColorUV+uvOffset).rgb;\n#ifdef EMISSION_COLOR_GAMMA\nmaterial_surface_emission*=toLinearSpace(emissionColorTex.rgb);\n#else\nmaterial_surface_emission*=emissionColorTex.rgb;\n#endif\nmaterial_surface_emission*= vEmissionColorInfos.y;\n#endif\nmaterial_surface_emission*=vLightingIntensity.y;\n#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\nvec4 finalColor=vec4(material_surface_ibl+material_surface_direct+material_surface_emission,alpha);\n#define CUSTOM_FRAGMENT_BEFORE_FOG\nfinalColor=max(finalColor,0.0);\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#include<pbrBlockImageProcessing>\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\n#include<openpbrBlockPrePass>\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=finalColor;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;}\n#endif\n#include<pbrDebug>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [objectIdFunctions, prePassDeclaration, oitDeclaration, sceneFragmentDeclaration, decalFragmentDeclaration, openpbrFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, openpbrUboDeclaration, mainUVVaryingDeclaration, pbrFragmentExtraDeclaration, lightFragmentDeclaration, lightUboDeclaration, samplerFragmentDeclaration, pbrFragmentReflectionDeclaration, openpbrFragmentSamplersDeclaration, imageProcessingDeclaration, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, textureRepetitionFunctions, helperFunctions, subSurfaceScatteringFunctions, importanceSampling, pbrHelperFunctions, imageProcessingFunctions, shadowsFragmentFunctions, harmonicsFunctions, ltcHelperFunctions, pbrDirectLightingSetupFunctions, pbrDirectLightingFalloffFunctions, pbrBRDFFunctions, hdrFilteringFunctions, pbrDirectLightingFunctions, pbrIBLFunctions, openpbrNormalMapFragmentMainFunctions, openpbrNormalMapFragmentFunctions, reflectionFunction, openpbrDielectricReflectance, openpbrConductorReflectance, openpbrAmbientOcclusionFunctions, openpbrGeometryInfo, openpbrIblFunctions, openpbrVolumeFunctions, clipPlaneFragment, pbrBlockNormalGeometric, openpbrNormalMapFragment, openpbrBlockNormalFinal, openpbrBaseLayerData, openpbrTransmissionLayerData, openpbrSubsurfaceLayerData, openpbrCoatLayerData, openpbrThinFilmLayerData, openpbrFuzzLayerData, openpbrAmbientOcclusionData, depthPrePass, openpbrBackgroundTransmission, openpbrEnvironmentLighting, openpbrDirectLightingInit, openpbrDirectLighting, logDepthFragment, fogFragment, pbrBlockImageProcessing, openpbrBlockPrePass, oitFragment, pbrDebug];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const openpbrPixelShader = { name, shader };\n"]}
|
package/Shaders/pbr.fragment.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import { objectIdFunctions } from "./ShadersInclude/objectIdFunctions.js";
|
|
3
4
|
import { prePassDeclaration } from "./ShadersInclude/prePassDeclaration.js";
|
|
4
5
|
import { oitDeclaration } from "./ShadersInclude/oitDeclaration.js";
|
|
5
6
|
import { decalFragmentDeclaration } from "./ShadersInclude/decalFragmentDeclaration.js";
|
|
@@ -640,7 +641,7 @@ if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaM
|
|
|
640
641
|
if (!ShaderStore.ShadersStore[name]) {
|
|
641
642
|
ShaderStore.ShadersStore[name] = shader;
|
|
642
643
|
}
|
|
643
|
-
const includes = [prePassDeclaration, oitDeclaration, decalFragmentDeclaration, pbrFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, pbrUboDeclaration, mainUVVaryingDeclaration, pbrFragmentExtraDeclaration, lightFragmentDeclaration, lightUboDeclaration, samplerFragmentDeclaration, samplerFragmentAlternateDeclaration, pbrFragmentReflectionDeclaration, pbrFragmentSamplersDeclaration, imageProcessingDeclaration, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, textureRepetitionFunctions, helperFunctions, subSurfaceScatteringFunctions, importanceSampling, pbrHelperFunctions, imageProcessingFunctions, shadowsFragmentFunctions, harmonicsFunctions, ltcHelperFunctions, pbrDirectLightingSetupFunctions, pbrDirectLightingFalloffFunctions, pbrBRDFFunctions, hdrFilteringFunctions, pbrDirectLightingFunctions, pbrIBLFunctions, bumpFragmentMainFunctions, bumpFragmentFunctions, reflectionFunction, decalFragment, pbrBlockAlbedoOpacity, pbrBlockReflectivity, pbrBlockAmbientOcclusion, pbrBlockAlphaFresnel, pbrBlockAnisotropic, pbrBlockReflection, pbrBlockSheen, pbrBlockClearcoat, pbrBlockIridescence, pbrBlockSubSurface, clusteredLightingFunctions, pbrBlockReflectance0, pbrClusteredLightingFunctions, clipPlaneFragment, pbrBlockNormalGeometric, bumpFragment, pbrBlockNormalFinal, depthPrePass, pbrBlockLightmapInit, pbrBlockGeometryInfo, pbrBlockReflectance, pbrBlockDirectLighting, lightFragment, pbrBlockFinalLitComponents, pbrBlockFinalUnlitComponents, pbrBlockFinalColorComposition, logDepthFragment, fogFragment, pbrBlockImageProcessing, pbrBlockPrePass, oitFragment, pbrDebug];
|
|
644
|
+
const includes = [objectIdFunctions, prePassDeclaration, oitDeclaration, decalFragmentDeclaration, pbrFragmentDeclaration, sceneUboDeclaration, meshUboDeclaration, pbrUboDeclaration, mainUVVaryingDeclaration, pbrFragmentExtraDeclaration, lightFragmentDeclaration, lightUboDeclaration, samplerFragmentDeclaration, samplerFragmentAlternateDeclaration, pbrFragmentReflectionDeclaration, pbrFragmentSamplersDeclaration, imageProcessingDeclaration, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, textureRepetitionFunctions, helperFunctions, subSurfaceScatteringFunctions, importanceSampling, pbrHelperFunctions, imageProcessingFunctions, shadowsFragmentFunctions, harmonicsFunctions, ltcHelperFunctions, pbrDirectLightingSetupFunctions, pbrDirectLightingFalloffFunctions, pbrBRDFFunctions, hdrFilteringFunctions, pbrDirectLightingFunctions, pbrIBLFunctions, bumpFragmentMainFunctions, bumpFragmentFunctions, reflectionFunction, decalFragment, pbrBlockAlbedoOpacity, pbrBlockReflectivity, pbrBlockAmbientOcclusion, pbrBlockAlphaFresnel, pbrBlockAnisotropic, pbrBlockReflection, pbrBlockSheen, pbrBlockClearcoat, pbrBlockIridescence, pbrBlockSubSurface, clusteredLightingFunctions, pbrBlockReflectance0, pbrClusteredLightingFunctions, clipPlaneFragment, pbrBlockNormalGeometric, bumpFragment, pbrBlockNormalFinal, depthPrePass, pbrBlockLightmapInit, pbrBlockGeometryInfo, pbrBlockReflectance, pbrBlockDirectLighting, lightFragment, pbrBlockFinalLitComponents, pbrBlockFinalUnlitComponents, pbrBlockFinalColorComposition, logDepthFragment, fogFragment, pbrBlockImageProcessing, pbrBlockPrePass, oitFragment, pbrDebug];
|
|
644
645
|
for (const inc of includes) {
|
|
645
646
|
if (!ShaderStore.IncludesShadersStore[inc.name]) {
|
|
646
647
|
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
|