@vived/component-abb-6700 1.0.0
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/.todo.md +13 -0
- package/README.md +122 -0
- package/dist/.gitkeep +0 -0
- package/dist/Adapters/aBB6700PMAdapter.d.ts +10 -0
- package/dist/Adapters/aBB6700PMAdapter.d.ts.map +1 -0
- package/dist/Controllers/createABB6700.d.ts +12 -0
- package/dist/Controllers/createABB6700.d.ts.map +1 -0
- package/dist/Controllers/getPose.d.ts +11 -0
- package/dist/Controllers/getPose.d.ts.map +1 -0
- package/dist/Controllers/setJointAngle.d.ts +12 -0
- package/dist/Controllers/setJointAngle.d.ts.map +1 -0
- package/dist/Controllers/setPose.d.ts +11 -0
- package/dist/Controllers/setPose.d.ts.map +1 -0
- package/dist/Entities/ABB6700Entity.d.ts +35 -0
- package/dist/Entities/ABB6700Entity.d.ts.map +1 -0
- package/dist/Entities/ABB6700Repo.d.ts +32 -0
- package/dist/Entities/ABB6700Repo.d.ts.map +1 -0
- package/dist/Factory/ABB6700FeatureFactory.d.ts +26 -0
- package/dist/Factory/ABB6700FeatureFactory.d.ts.map +1 -0
- package/dist/Mocks/MockABB6700PM.d.ts +11 -0
- package/dist/Mocks/MockABB6700PM.d.ts.map +1 -0
- package/dist/Mocks/MockSetJointAngleUC.d.ts +7 -0
- package/dist/Mocks/MockSetJointAngleUC.d.ts.map +1 -0
- package/dist/Mocks/MockSetPoseUC.d.ts +7 -0
- package/dist/Mocks/MockSetPoseUC.d.ts.map +1 -0
- package/dist/PMs/ABB6700PM.d.ts +32 -0
- package/dist/PMs/ABB6700PM.d.ts.map +1 -0
- package/dist/UCs/CalcStabilizerUC.d.ts +7 -0
- package/dist/UCs/CalcStabilizerUC.d.ts.map +1 -0
- package/dist/UCs/SetJointAngleUC.d.ts +15 -0
- package/dist/UCs/SetJointAngleUC.d.ts.map +1 -0
- package/dist/UCs/SetPoseUC.d.ts +22 -0
- package/dist/UCs/SetPoseUC.d.ts.map +1 -0
- package/dist/Views/ABB6700BabylonView.d.ts +27 -0
- package/dist/Views/ABB6700BabylonView.d.ts.map +1 -0
- package/dist/abb_6700.glb +0 -0
- package/dist/abstractAudioBus-CyBWsmuN.js +14 -0
- package/dist/animationGroup-BhNThqQe.js +1454 -0
- package/dist/basisTextureLoader-BT391BsV.js +310 -0
- package/dist/brdfTextureTools-DUyKBAXf.js +79 -0
- package/dist/bumpFragment-Dd-ojPA1.js +134 -0
- package/dist/bumpFragment-KE1_PuMl.js +287 -0
- package/dist/bumpVertex-BcdvVFVx.js +8 -0
- package/dist/bumpVertexDeclaration-B5Uvs-RS.js +8 -0
- package/dist/bumpVertexDeclaration-ixSg-yGI.js +8 -0
- package/dist/clipPlaneFragment-DJwQynjA.js +136 -0
- package/dist/clipPlaneVertex-D4Wk50XG.js +376 -0
- package/dist/clipPlaneVertex-eQ147Tn2.js +350 -0
- package/dist/component.config.d.ts +17 -0
- package/dist/component.config.d.ts.map +1 -0
- package/dist/ddsTextureLoader-DeoF3iGO.js +331 -0
- package/dist/default.fragment-DKnTR9nY.js +548 -0
- package/dist/default.fragment-rIGWrUS5.js +486 -0
- package/dist/default.vertex-Bt5y1VyA.js +212 -0
- package/dist/default.vertex-Dext1liJ.js +224 -0
- package/dist/defaultUboDeclaration-BwslQZX8.js +11 -0
- package/dist/defaultUboDeclaration-DSXACgip.js +9 -0
- package/dist/easing-BAt0SO-B.js +163 -0
- package/dist/envTextureLoader-CBiW_Q-U.js +40 -0
- package/dist/exrTextureLoader-5SC6PKIA.js +740 -0
- package/dist/flowGraphApplyForceBlock-6e8-wcaw.js +32 -0
- package/dist/flowGraphApplyImpulseBlock-B27EZQow.js +32 -0
- package/dist/flowGraphArrayIndexBlock-DIUn5e4i.js +31 -0
- package/dist/flowGraphBezierCurveEasingBlock-BJmiHk40.js +25 -0
- package/dist/flowGraphBinaryOperationBlock-Bj7TANCc.js +25 -0
- package/dist/flowGraphBranchBlock-7CRvIKWc.js +19 -0
- package/dist/flowGraphCachedOperationBlock-CP1ZiuIB.js +26 -0
- package/dist/flowGraphCancelDelayBlock-DqtgzBGm.js +20 -0
- package/dist/flowGraphCodeExecutionBlock-CaYXCGqo.js +23 -0
- package/dist/flowGraphConditionalDataBlock-DJ7evX8_.js +28 -0
- package/dist/flowGraphConsoleLogBlock-cMkpqLzO.js +68 -0
- package/dist/flowGraphConstantBlock-JWybwT0A.js +28 -0
- package/dist/flowGraphContextBlock-CFDXHcbn.js +19 -0
- package/dist/flowGraphCounterBlock-B0uPkgw9.js +24 -0
- package/dist/flowGraphDataSwitchBlock-B0GSifvJ.js +27 -0
- package/dist/flowGraphDebounceBlock-CSw8zKym.js +24 -0
- package/dist/flowGraphDebugBlock-DiSR6Ahn.js +65 -0
- package/dist/flowGraphDoNBlock-C-48oQ2H.js +24 -0
- package/dist/flowGraphEasingBlock-DKUaE7Rp.js +50 -0
- package/dist/flowGraphFlipFlopBlock-DX5BGhMV.js +20 -0
- package/dist/flowGraphForLoopBlock-Di-Qwg23.js +27 -0
- package/dist/flowGraphFunctionReferenceBlock-D8X5TFsO.js +20 -0
- package/dist/flowGraphGLTFDataProvider-C4j7nPQv.js +16 -0
- package/dist/flowGraphGetAngularVelocityBlock-Cq-yTQ4D.js +31 -0
- package/dist/flowGraphGetAssetBlock-B36eioor.js +21 -0
- package/dist/flowGraphGetLinearVelocityBlock-MdrV0eUD.js +31 -0
- package/dist/flowGraphGetPhysicsMassPropertiesBlock-wXDZP1wM.js +30 -0
- package/dist/flowGraphGetPropertyBlock-eP0badwf.js +46 -0
- package/dist/flowGraphGetSoundVolumeBlock-D3gXGHXa.js +29 -0
- package/dist/flowGraphGetVariableBlock-C7-qZAec.js +31 -0
- package/dist/flowGraphIndexOfBlock-CC5l9n9P.js +31 -0
- package/dist/flowGraphInterpolationBlock-B6922jzt.js +50 -0
- package/dist/flowGraphIsKeyPressedBlock-X_iuiUOX.js +31 -0
- package/dist/flowGraphIsSoundPlayingBlock-DONQX8N8.js +29 -0
- package/dist/flowGraphJsonPointerParserBlock-DBH_gN8I.js +95 -0
- package/dist/flowGraphKeyDownEventBlock-D5T1Uyfv.js +26 -0
- package/dist/flowGraphKeyUpEventBlock-BPY_Kgkm.js +21 -0
- package/dist/flowGraphKeyboardEventBlock-C49fx3TC.js +20 -0
- package/dist/flowGraphMathBlocks-CkvrN3VJ.js +864 -0
- package/dist/flowGraphMathCombineExtractBlocks-QSjGlnoz.js +248 -0
- package/dist/flowGraphMatrixMathBlocks-B3D7Cz9p.js +117 -0
- package/dist/flowGraphMeshPickEventBlock-BBTz-taa.js +35 -0
- package/dist/flowGraphMultiGateBlock-BhY1y5BG.js +50 -0
- package/dist/flowGraphPauseAnimationBlock-CHZZXMbg.js +19 -0
- package/dist/flowGraphPauseSoundBlock-B7hMmJ0c.js +31 -0
- package/dist/flowGraphPhysicsCollisionEventBlock-CxoPpT-q.js +56 -0
- package/dist/flowGraphPlayAnimationBlock-DVAvIFux.js +99 -0
- package/dist/flowGraphPlaySoundBlock-DjHGrqbC.js +32 -0
- package/dist/flowGraphPointerDownEventBlock-qI-H0JST.js +31 -0
- package/dist/flowGraphPointerMoveEventBlock-DAi4VUyy.js +31 -0
- package/dist/flowGraphPointerOutEventBlock-CFtj68aC.js +21 -0
- package/dist/flowGraphPointerOverEventBlock-VxdHhFuu.js +23 -0
- package/dist/flowGraphPointerUpEventBlock-DRR1f07q.js +31 -0
- package/dist/flowGraphReceiveCustomEventBlock-B3bwdB66.js +52 -0
- package/dist/flowGraphSceneReadyEventBlock-Dy6lDT3j.js +23 -0
- package/dist/flowGraphSceneTickEventBlock-Bl9BF_Xw.js +32 -0
- package/dist/flowGraphSendCustomEventBlock-BAR4PGFq.js +35 -0
- package/dist/flowGraphSequenceBlock-veqU32ZZ.js +32 -0
- package/dist/flowGraphSetAngularVelocityBlock-Dj9b-zu6.js +31 -0
- package/dist/flowGraphSetDelayBlock-CMjudtvk.js +131 -0
- package/dist/flowGraphSetLinearVelocityBlock-DVDhhJBd.js +31 -0
- package/dist/flowGraphSetPhysicsMotionTypeBlock-CL3cxNCO.js +36 -0
- package/dist/flowGraphSetPropertyBlock-D3sWL3Ss.js +47 -0
- package/dist/flowGraphSetSoundVolumeBlock-CxVk45yR.js +32 -0
- package/dist/flowGraphSetVariableBlock-D1oJiwLj.js +47 -0
- package/dist/flowGraphSoundEndedEventBlock-CubEwii0.js +47 -0
- package/dist/flowGraphStopAnimationBlock-B9inwIQx.js +48 -0
- package/dist/flowGraphStopSoundBlock-BijIX2jC.js +31 -0
- package/dist/flowGraphSwitchBlock-BMhPb4OX.js +54 -0
- package/dist/flowGraphThrottleBlock-C7vrnkb1.js +37 -0
- package/dist/flowGraphTransformCoordinatesSystemBlock-DoISqaUG.js +29 -0
- package/dist/flowGraphTypeToTypeBlocks-CSML6QWx.js +57 -0
- package/dist/flowGraphUnaryOperationBlock-B0Shf-lJ.js +24 -0
- package/dist/flowGraphVectorMathBlocks-DoTRR_E0.js +178 -0
- package/dist/flowGraphWaitAllBlock-BvmDMc24.js +54 -0
- package/dist/flowGraphWhileLoopBlock-BaIq4-K2.js +27 -0
- package/dist/geometry.fragment-Bsis3UG2.js +275 -0
- package/dist/geometry.vertex-DskQ5b8j.js +222 -0
- package/dist/harmonicsFunctions-CtNrRfir.js +193 -0
- package/dist/harmonicsFunctions-PEz6APC7.js +18 -0
- package/dist/hdrTextureLoader-D9rYxJ9q.js +112 -0
- package/dist/helperFunctions-Bt7Zfkrp.js +89 -0
- package/dist/helperFunctions-CPmRxd37.js +121 -0
- package/dist/iesTextureLoader-BGUFjVhI.js +93 -0
- package/dist/index-CS3Icp_r.js +67657 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/ktxTextureLoader-cUaGg9_L.js +459 -0
- package/dist/lightFragment-BRDibDKG.js +404 -0
- package/dist/lightFragment-DCqtGMp_.js +402 -0
- package/dist/logDepthDeclaration-Bwm-3KyB.js +16 -0
- package/dist/logDepthDeclaration-gUfeSnXX.js +20 -0
- package/dist/logDepthVertex-CKeuJ6ae.js +213 -0
- package/dist/logDepthVertex-CXkmZels.js +459 -0
- package/dist/mesh.vertexData.functions-Bc9lJlrU.js +74 -0
- package/dist/oitFragment-B8zuQigp.js +792 -0
- package/dist/oitFragment-DH3h3T6x.js +657 -0
- package/dist/openpbr.fragment-BglYS6LA.js +1405 -0
- package/dist/openpbr.fragment-DrOTZs4m.js +1553 -0
- package/dist/openpbr.vertex-B-PaLFOR.js +384 -0
- package/dist/openpbr.vertex-DMdFRTnX.js +268 -0
- package/dist/openpbrMaterial-HCU0aOca.js +2880 -0
- package/dist/openpbrMaterialLoadingAdapter-CWRAa-7S.js +1122 -0
- package/dist/openpbrTransmissionLayerData-CfDVObj5.js +352 -0
- package/dist/openpbrUboDeclaration-CA2pvSbt.js +9 -0
- package/dist/openpbrUboDeclaration-xU8VOaib.js +10 -0
- package/dist/pass.fragment-1mMP54bb.js +10 -0
- package/dist/pass.fragment-DzaUp_jk.js +10 -0
- package/dist/passCube.fragment-CQaXS7g3.js +29 -0
- package/dist/passCube.fragment-QJGPwAXI.js +29 -0
- package/dist/pbr.fragment-BnaAAGxb.js +2775 -0
- package/dist/pbr.fragment-CYZk_EGU.js +2619 -0
- package/dist/pbr.vertex-CyvdCw91.js +372 -0
- package/dist/pbr.vertex-DJMAkDxs.js +270 -0
- package/dist/pbrBRDFFunctions-EugoWm6O.js +175 -0
- package/dist/pbrDebug-Bk3sPoEG.js +719 -0
- package/dist/pbrDebug-Cdalzb1I.js +614 -0
- package/dist/pbrIBLFunctions-B0bVAXCF.js +47 -0
- package/dist/pbrIBLFunctions-C06z-ouZ.js +51 -0
- package/dist/pbrMaterial-C4FCKBZQ.js +1660 -0
- package/dist/pbrMaterialLoadingAdapter-BGHlS_ZN.js +1032 -0
- package/dist/pbrUboDeclaration-1lN5_-Bw.js +9 -0
- package/dist/pbrUboDeclaration-BJOUUOZ2.js +10 -0
- package/dist/procedural.vertex-CFPKczKj.js +14 -0
- package/dist/procedural.vertex-DUW7bYZt.js +13 -0
- package/dist/rgbdDecode.fragment-CEGgE4tL.js +8 -0
- package/dist/rgbdDecode.fragment-FT0wkgah.js +8 -0
- package/dist/rgbdEncode.fragment-CLnJJf6E.js +8 -0
- package/dist/rgbdEncode.fragment-CaAcMsY9.js +8 -0
- package/dist/sceneUboDeclaration-B6oxsfcj.js +8 -0
- package/dist/sceneUboDeclaration-JByfVKik.js +13 -0
- package/dist/setupABB6700InstanceFactory.d.ts +7 -0
- package/dist/setupABB6700InstanceFactory.d.ts.map +1 -0
- package/dist/studio.env +0 -0
- package/dist/textureProcessor.fragment-BYPw6SMQ.js +152 -0
- package/dist/textureProcessor.fragment-Ciw9-F3w.js +157 -0
- package/dist/textureTools-Cct_bGgp.js +40 -0
- package/dist/tgaTextureLoader-BJOIdnFr.js +198 -0
- package/dist/thinEngine-Bt9FW4dD.js +2425 -0
- package/dist/webAudioBus-BUzRHSxr.js +88 -0
- package/dist/webAudioMainBus-Dds1TgJG.js +49 -0
- package/package.json +49 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { b0 as i } from "./index-CS3Icp_r.js";
|
|
2
|
+
import "./clipPlaneFragment-DJwQynjA.js";
|
|
3
|
+
import "./bumpFragment-Dd-ojPA1.js";
|
|
4
|
+
import "./helperFunctions-Bt7Zfkrp.js";
|
|
5
|
+
import "./pbrIBLFunctions-B0bVAXCF.js";
|
|
6
|
+
import "./sceneUboDeclaration-JByfVKik.js";
|
|
7
|
+
import "./pbrBRDFFunctions-EugoWm6O.js";
|
|
8
|
+
import "./openpbrTransmissionLayerData-CfDVObj5.js";
|
|
9
|
+
const e = "geometryPixelShader", r = `#ifdef BUMP
|
|
10
|
+
varying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;varying vNormalW: vec3f;
|
|
11
|
+
#else
|
|
12
|
+
varying vNormalV: vec3f;
|
|
13
|
+
#endif
|
|
14
|
+
varying vViewPos: vec4f;
|
|
15
|
+
#if defined(POSITION) || defined(BUMP) || defined(IRRADIANCE)
|
|
16
|
+
varying vPositionW: vec3f;
|
|
17
|
+
#endif
|
|
18
|
+
#if defined(VELOCITY) || defined(VELOCITY_LINEAR)
|
|
19
|
+
varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;
|
|
20
|
+
#endif
|
|
21
|
+
#ifdef NEED_UV
|
|
22
|
+
varying vUV: vec2f;
|
|
23
|
+
#endif
|
|
24
|
+
#ifdef BUMP
|
|
25
|
+
uniform vBumpInfos: vec3f;uniform vTangentSpaceParams: vec2f;
|
|
26
|
+
#endif
|
|
27
|
+
#if defined(REFLECTIVITY)
|
|
28
|
+
#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)
|
|
29
|
+
var reflectivitySamplerSampler: sampler;var reflectivitySampler: texture_2d<f32>;varying vReflectivityUV: vec2f;
|
|
30
|
+
#else
|
|
31
|
+
#ifdef METALLIC_TEXTURE
|
|
32
|
+
var metallicSamplerSampler: sampler;var metallicSampler: texture_2d<f32>;varying vMetallicUV: vec2f;
|
|
33
|
+
#endif
|
|
34
|
+
#ifdef ROUGHNESS_TEXTURE
|
|
35
|
+
var roughnessSamplerSampler: sampler;var roughnessSampler: texture_2d<f32>;varying vRoughnessUV: vec2f;
|
|
36
|
+
#endif
|
|
37
|
+
#endif
|
|
38
|
+
#ifdef ALBEDOTEXTURE
|
|
39
|
+
varying vAlbedoUV: vec2f;var albedoSamplerSampler: sampler;var albedoSampler: texture_2d<f32>;
|
|
40
|
+
#endif
|
|
41
|
+
#ifdef REFLECTIVITYCOLOR
|
|
42
|
+
uniform reflectivityColor: vec3f;
|
|
43
|
+
#endif
|
|
44
|
+
#ifdef ALBEDOCOLOR
|
|
45
|
+
uniform albedoColor: vec3f;
|
|
46
|
+
#endif
|
|
47
|
+
#ifdef METALLIC
|
|
48
|
+
uniform metallic: f32;
|
|
49
|
+
#endif
|
|
50
|
+
#if defined(ROUGHNESS) || defined(GLOSSINESS)
|
|
51
|
+
uniform glossiness: f32;
|
|
52
|
+
#endif
|
|
53
|
+
#endif
|
|
54
|
+
#if defined(ALPHATEST) && defined(NEED_UV)
|
|
55
|
+
var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;
|
|
56
|
+
#endif
|
|
57
|
+
#include<clipPlaneFragmentDeclaration>
|
|
58
|
+
#include<bumpFragmentMainFunctions>
|
|
59
|
+
#include<bumpFragmentFunctions>
|
|
60
|
+
#include<helperFunctions>
|
|
61
|
+
#ifdef IRRADIANCE
|
|
62
|
+
#include<pbrFragmentReflectionDeclaration>
|
|
63
|
+
#ifdef REFLECTION
|
|
64
|
+
#ifdef USEIRRADIANCEMAP
|
|
65
|
+
#include<sceneUboDeclaration>
|
|
66
|
+
uniform reflectionMatrix: mat4x4f;uniform vReflectionInfos: vec2f;uniform vReflectionDominantDirection: vec3f;
|
|
67
|
+
#include<pbrBRDFFunctions>
|
|
68
|
+
#include<openpbrDielectricReflectance>
|
|
69
|
+
#include<pbrIBLFunctions>
|
|
70
|
+
#include<reflectionFunction>
|
|
71
|
+
#include<openpbrGeometryInfo>
|
|
72
|
+
#include<openpbrIblFunctions>
|
|
73
|
+
#elif defined(USESPHERICALFROMREFLECTIONMAP)
|
|
74
|
+
varying vEnvironmentIrradiance: vec3f;
|
|
75
|
+
#endif
|
|
76
|
+
#ifdef IBL_SHADOW_TEXTURE
|
|
77
|
+
var iblShadowSampler: texture_2d<f32>;var iblShadowSamplerSampler: sampler;uniform shadowTextureSize: vec2f;
|
|
78
|
+
#endif
|
|
79
|
+
#ifdef IRRADIANCE_SCATTER_MASK
|
|
80
|
+
uniform vSubsurfaceWeight: f32;
|
|
81
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_WEIGHT,_VARYINGNAME_,SubsurfaceWeight,_SAMPLERNAME_,subsurfaceWeight)
|
|
82
|
+
uniform vSubsurfaceScatterAnisotropy: f32;uniform vTransmissionWeight: f32;
|
|
83
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_WEIGHT,_VARYINGNAME_,TransmissionWeight,_SAMPLERNAME_,transmissionWeight)
|
|
84
|
+
uniform vTransmissionScatterAnisotropy: f32;
|
|
85
|
+
#endif
|
|
86
|
+
#endif
|
|
87
|
+
#endif
|
|
88
|
+
@fragment
|
|
89
|
+
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
90
|
+
#include<clipPlaneFragment>
|
|
91
|
+
#ifdef ALPHATEST
|
|
92
|
+
if (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;}
|
|
93
|
+
#endif
|
|
94
|
+
var normalOutput: vec3f;
|
|
95
|
+
#ifdef BUMP
|
|
96
|
+
var normalW: vec3f=normalize(input.vNormalW);
|
|
97
|
+
#include<bumpFragment>
|
|
98
|
+
#ifdef NORMAL_WORLDSPACE
|
|
99
|
+
normalOutput=normalW;
|
|
100
|
+
#else
|
|
101
|
+
normalOutput=normalize( (mat4x4f(input.vWorldView0,input.vWorldView1,input.vWorldView2,input.vWorldView3)* vec4f(normalW,0.0)).xyz);
|
|
102
|
+
#endif
|
|
103
|
+
#elif defined(HAS_NORMAL_ATTRIBUTE)
|
|
104
|
+
normalOutput=normalize(input.vNormalV);
|
|
105
|
+
#elif defined(POSITION)
|
|
106
|
+
normalOutput=normalize(-cross(dpdx(input.vPositionW),dpdy(input.vPositionW)));
|
|
107
|
+
#endif
|
|
108
|
+
#ifdef ENCODE_NORMAL
|
|
109
|
+
normalOutput=normalOutput*0.5+0.5;
|
|
110
|
+
#endif
|
|
111
|
+
var fragData: array<vec4<f32>,SCENE_MRT_COUNT>;
|
|
112
|
+
#ifdef DEPTH
|
|
113
|
+
fragData[DEPTH_INDEX]=vec4f(input.vViewPos.z/input.vViewPos.w,0.0,0.0,1.0);
|
|
114
|
+
#endif
|
|
115
|
+
#ifdef NORMAL
|
|
116
|
+
fragData[NORMAL_INDEX]=vec4f(normalOutput,1.0);
|
|
117
|
+
#endif
|
|
118
|
+
#ifdef SCREENSPACE_DEPTH
|
|
119
|
+
fragData[SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,1.0);
|
|
120
|
+
#endif
|
|
121
|
+
#ifdef POSITION
|
|
122
|
+
fragData[POSITION_INDEX]= vec4f(input.vPositionW,1.0);
|
|
123
|
+
#endif
|
|
124
|
+
#ifdef VELOCITY
|
|
125
|
+
var a: vec2f=(input.vCurrentPosition.xy/input.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(input.vPreviousPosition.xy/input.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[VELOCITY_INDEX]= vec4f(velocity,0.0,1.0);
|
|
126
|
+
#endif
|
|
127
|
+
#ifdef VELOCITY_LINEAR
|
|
128
|
+
var velocity : vec2f=vec2f(0.5)*((input.vPreviousPosition.xy /
|
|
129
|
+
input.vPreviousPosition.w) -
|
|
130
|
+
(input.vCurrentPosition.xy /
|
|
131
|
+
input.vCurrentPosition.w));fragData[VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,1.0);
|
|
132
|
+
#endif
|
|
133
|
+
#ifdef REFLECTIVITY
|
|
134
|
+
var reflectivity: vec4f= vec4f(0.0,0.0,0.0,1.0);
|
|
135
|
+
#ifdef METALLICWORKFLOW
|
|
136
|
+
var metal: f32=1.0;var roughness: f32=1.0;
|
|
137
|
+
#ifdef ORMTEXTURE
|
|
138
|
+
metal*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).b;roughness*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).g;
|
|
139
|
+
#else
|
|
140
|
+
#ifdef METALLIC_TEXTURE
|
|
141
|
+
metal*=textureSample(metallicSampler,metallicSamplerSampler,input.vMetallicUV).r;
|
|
142
|
+
#endif
|
|
143
|
+
#ifdef ROUGHNESS_TEXTURE
|
|
144
|
+
roughness*=textureSample(roughnessSampler,roughnessSamplerSampler,input.vRoughnessUV).r;
|
|
145
|
+
#endif
|
|
146
|
+
#endif
|
|
147
|
+
#ifdef METALLIC
|
|
148
|
+
metal*=uniforms.metallic;
|
|
149
|
+
#endif
|
|
150
|
+
#ifdef ROUGHNESS
|
|
151
|
+
roughness*=(1.0-uniforms.glossiness);
|
|
152
|
+
#endif
|
|
153
|
+
reflectivity=vec4f(reflectivity.rgb,reflectivity.a-roughness);var color: vec3f= vec3f(1.0);
|
|
154
|
+
#ifdef ALBEDOTEXTURE
|
|
155
|
+
color=textureSample(albedoSampler,albedoSamplerSampler,input.vAlbedoUV).rgb;
|
|
156
|
+
#ifdef GAMMAALBEDO
|
|
157
|
+
color=toLinearSpaceVec4(color);
|
|
158
|
+
#endif
|
|
159
|
+
#endif
|
|
160
|
+
#ifdef ALBEDOCOLOR
|
|
161
|
+
color*=uniforms.albedoColor.xyz;
|
|
162
|
+
#endif
|
|
163
|
+
reflectivity=vec4f(mix( vec3f(0.04),color,metal),reflectivity.a);
|
|
164
|
+
#else
|
|
165
|
+
#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)
|
|
166
|
+
reflectivity=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV);
|
|
167
|
+
#ifdef GAMMAREFLECTIVITYTEXTURE
|
|
168
|
+
reflectivity=vec4f(toLinearSpaceVec3(reflectivity.rgb),reflectivity.a);
|
|
169
|
+
#endif
|
|
170
|
+
#else
|
|
171
|
+
#ifdef REFLECTIVITYCOLOR
|
|
172
|
+
reflectivity=vec4f(toLinearSpaceVec3(uniforms.reflectivityColor.xyz),1.0);
|
|
173
|
+
#endif
|
|
174
|
+
#endif
|
|
175
|
+
#ifdef GLOSSINESSS
|
|
176
|
+
reflectivity=vec4f(reflectivity.rgb,reflectivity.a*glossiness);
|
|
177
|
+
#endif
|
|
178
|
+
#endif
|
|
179
|
+
fragData[REFLECTIVITY_INDEX]=reflectivity;
|
|
180
|
+
#endif
|
|
181
|
+
#ifdef IRRADIANCE
|
|
182
|
+
var irradiance: vec3f=vec3f(0.0);var irradiance_alpha: f32=1.0;
|
|
183
|
+
#ifdef REFLECTION
|
|
184
|
+
#ifdef IRRADIANCE_SCATTER_MASK
|
|
185
|
+
#ifndef BUMP
|
|
186
|
+
let uvOffset: vec2f=vec2f(0.0);
|
|
187
|
+
#endif
|
|
188
|
+
var vSubsurfaceColor: vec3f=vec3f(1.0);var vSubsurfaceRadius: f32=0.0;var vSubsurfaceRadiusScale: vec3f=vec3f(1.0);
|
|
189
|
+
#include<openpbrSubsurfaceLayerData>(uniforms.vSubsurfaceColor,vSubsurfaceColor,uniforms.vSubsurfaceRadius,vSubsurfaceRadius,uniforms.vSubsurfaceRadiusScale,vSubsurfaceRadiusScale)
|
|
190
|
+
var vTransmissionDepth: f32=1.0;var vTransmissionColor: vec3f=vec3f(1.0);var vTransmissionScatter: vec3f=vec3f(0.0);var vTransmissionDispersionScale: f32=0.0;var vTransmissionDispersionAbbeNumber: f32=0.0;
|
|
191
|
+
#include<openpbrTransmissionLayerData>(uniforms.vTransmissionDispersionScale,vTransmissionDispersionScale,uniforms.vTransmissionDispersionAbbeNumber,vTransmissionDispersionAbbeNumber,uniforms.vTransmissionColor,vTransmissionColor,uniforms.vTransmissionDepth,vTransmissionDepth,uniforms.vTransmissionScatter\\.,vTransmissionScatter.)
|
|
192
|
+
#endif
|
|
193
|
+
#ifdef IBL_SHADOW_TEXTURE
|
|
194
|
+
#ifdef COLORED_IBL_SHADOWS
|
|
195
|
+
let iblShadowValue: vec3f=textureSample(iblShadowSampler,iblShadowSamplerSampler,fragmentInputs.position.xy/uniforms.shadowTextureSize).rgb;
|
|
196
|
+
#else
|
|
197
|
+
let iblShadowValue: vec3f=vec3f(textureSample(iblShadowSampler,iblShadowSamplerSampler,fragmentInputs.position.xy/uniforms.shadowTextureSize).r);
|
|
198
|
+
#endif
|
|
199
|
+
#endif
|
|
200
|
+
#if defined(USEIRRADIANCEMAP)
|
|
201
|
+
#ifdef IRRADIANCE_SCATTER_MASK
|
|
202
|
+
let bendAmount: f32=subsurface_weight*-min(subsurface_scatter_anisotropy,0.0);let mixedBendAmount: f32=mix(bendAmount,-min(transmission_scatter_anisotropy,0.0),transmission_weight);let viewVector: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW);let bentNormal: vec3f=mix(normalOutput,viewVector,mixedBendAmount*dot(normalOutput,viewVector));
|
|
203
|
+
#else
|
|
204
|
+
let bentNormal: vec3f=normalOutput;
|
|
205
|
+
#endif
|
|
206
|
+
irradiance=sampleIrradiance(
|
|
207
|
+
bentNormal
|
|
208
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
|
|
209
|
+
,input.vEnvironmentIrradiance
|
|
210
|
+
#endif
|
|
211
|
+
#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
|
|
212
|
+
,uniforms.reflectionMatrix
|
|
213
|
+
#endif
|
|
214
|
+
#ifdef USEIRRADIANCEMAP
|
|
215
|
+
,irradianceSampler
|
|
216
|
+
,irradianceSamplerSampler
|
|
217
|
+
#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
|
|
218
|
+
,uniforms.vReflectionDominantDirection
|
|
219
|
+
#endif
|
|
220
|
+
#endif
|
|
221
|
+
#ifdef REALTIME_FILTERING
|
|
222
|
+
,uniforms.vReflectionFilteringInfo
|
|
223
|
+
#ifdef IBL_CDF_FILTERING
|
|
224
|
+
,icdfSampler
|
|
225
|
+
,icdfSamplerSampler
|
|
226
|
+
#endif
|
|
227
|
+
#endif
|
|
228
|
+
,uniforms.vReflectionInfos
|
|
229
|
+
,input.vViewPos.xyz
|
|
230
|
+
,1.0
|
|
231
|
+
,vec3f(1.0)
|
|
232
|
+
);
|
|
233
|
+
#elif defined(USESPHERICALFROMREFLECTIONMAP)
|
|
234
|
+
irradiance=input.vEnvironmentIrradiance;
|
|
235
|
+
#endif
|
|
236
|
+
#ifdef IBL_SHADOW_TEXTURE
|
|
237
|
+
irradiance*=iblShadowValue;
|
|
238
|
+
#endif
|
|
239
|
+
#ifdef IRRADIANCE_SCATTER_MASK
|
|
240
|
+
irradiance_alpha=min(subsurface_weight+transmission_weight,1.0);
|
|
241
|
+
#endif
|
|
242
|
+
#endif
|
|
243
|
+
fragData[IRRADIANCE_INDEX]=vec4f(irradiance,irradiance_alpha);
|
|
244
|
+
#endif
|
|
245
|
+
#if SCENE_MRT_COUNT>0
|
|
246
|
+
fragmentOutputs.fragData0=fragData[0];
|
|
247
|
+
#endif
|
|
248
|
+
#if SCENE_MRT_COUNT>1
|
|
249
|
+
fragmentOutputs.fragData1=fragData[1];
|
|
250
|
+
#endif
|
|
251
|
+
#if SCENE_MRT_COUNT>2
|
|
252
|
+
fragmentOutputs.fragData2=fragData[2];
|
|
253
|
+
#endif
|
|
254
|
+
#if SCENE_MRT_COUNT>3
|
|
255
|
+
fragmentOutputs.fragData3=fragData[3];
|
|
256
|
+
#endif
|
|
257
|
+
#if SCENE_MRT_COUNT>4
|
|
258
|
+
fragmentOutputs.fragData4=fragData[4];
|
|
259
|
+
#endif
|
|
260
|
+
#if SCENE_MRT_COUNT>5
|
|
261
|
+
fragmentOutputs.fragData5=fragData[5];
|
|
262
|
+
#endif
|
|
263
|
+
#if SCENE_MRT_COUNT>6
|
|
264
|
+
fragmentOutputs.fragData6=fragData[6];
|
|
265
|
+
#endif
|
|
266
|
+
#if SCENE_MRT_COUNT>7
|
|
267
|
+
fragmentOutputs.fragData7=fragData[7];
|
|
268
|
+
#endif
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
i.ShadersStoreWGSL[e] || (i.ShadersStoreWGSL[e] = r);
|
|
272
|
+
const v = { name: e, shader: r };
|
|
273
|
+
export {
|
|
274
|
+
v as geometryPixelShaderWGSL
|
|
275
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { b0 as i } from "./index-CS3Icp_r.js";
|
|
2
|
+
import "./clipPlaneVertex-D4Wk50XG.js";
|
|
3
|
+
import "./sceneUboDeclaration-JByfVKik.js";
|
|
4
|
+
import "./harmonicsFunctions-PEz6APC7.js";
|
|
5
|
+
import "./bumpVertex-BcdvVFVx.js";
|
|
6
|
+
const e = "geometryVertexShader", r = `#include<bonesDeclaration>
|
|
7
|
+
#include<bakedVertexAnimationDeclaration>
|
|
8
|
+
#include<morphTargetsVertexGlobalDeclaration>
|
|
9
|
+
#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
|
|
10
|
+
#include<instancesDeclaration>
|
|
11
|
+
#include<sceneUboDeclaration>
|
|
12
|
+
#include<clipPlaneVertexDeclaration>
|
|
13
|
+
#ifdef IRRADIANCE
|
|
14
|
+
#ifdef REFLECTION
|
|
15
|
+
uniform reflectionMatrix: mat4x4f;uniform vReflectionInfos: vec2f;uniform vReflectionColor: vec3f;
|
|
16
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
17
|
+
varying vEnvironmentIrradiance: vec3f;
|
|
18
|
+
#ifdef SPHERICAL_HARMONICS
|
|
19
|
+
uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;
|
|
20
|
+
#else
|
|
21
|
+
uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f;
|
|
22
|
+
#endif
|
|
23
|
+
#include<harmonicsFunctions>
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
#endif
|
|
27
|
+
attribute position : vec3<f32>;
|
|
28
|
+
#ifdef HAS_NORMAL_ATTRIBUTE
|
|
29
|
+
attribute normal: vec3f;
|
|
30
|
+
#endif
|
|
31
|
+
#ifdef NEED_UV
|
|
32
|
+
varying vUV: vec2f;
|
|
33
|
+
#ifdef ALPHATEST
|
|
34
|
+
uniform diffuseMatrix: mat4x4f;
|
|
35
|
+
#endif
|
|
36
|
+
#ifdef BUMP
|
|
37
|
+
uniform bumpMatrix: mat4x4f;varying vBumpUV: vec2f;
|
|
38
|
+
#endif
|
|
39
|
+
#ifdef REFLECTIVITY
|
|
40
|
+
uniform reflectivityMatrix: mat4x4f;uniform albedoMatrix: mat4x4f;varying vReflectivityUV: vec2f;varying vAlbedoUV: vec2f;
|
|
41
|
+
#endif
|
|
42
|
+
#ifdef METALLIC_TEXTURE
|
|
43
|
+
varying vMetallicUV: vec2f;uniform metallicMatrix: mat4x4f;
|
|
44
|
+
#endif
|
|
45
|
+
#ifdef ROUGHNESS_TEXTURE
|
|
46
|
+
varying vRoughnessUV: vec2f;uniform roughnessMatrix: mat4x4f;
|
|
47
|
+
#endif
|
|
48
|
+
#ifdef SUBSURFACE_WEIGHT
|
|
49
|
+
varying vSubsurfaceWeightUV: vec2f;uniform subsurfaceWeightMatrix: mat4x4f;
|
|
50
|
+
#endif
|
|
51
|
+
#ifdef TRANSMISSION_WEIGHT
|
|
52
|
+
varying vTransmissionWeightUV: vec2f;uniform transmissionWeightMatrix: mat4x4f;
|
|
53
|
+
#endif
|
|
54
|
+
#ifdef UV1
|
|
55
|
+
attribute uv: vec2f;
|
|
56
|
+
#endif
|
|
57
|
+
#ifdef UV2
|
|
58
|
+
attribute uv2: vec2f;
|
|
59
|
+
#endif
|
|
60
|
+
#endif
|
|
61
|
+
#ifdef BUMP
|
|
62
|
+
varying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;
|
|
63
|
+
#endif
|
|
64
|
+
#ifdef BUMP
|
|
65
|
+
varying vNormalW: vec3f;
|
|
66
|
+
#else
|
|
67
|
+
varying vNormalV: vec3f;
|
|
68
|
+
#endif
|
|
69
|
+
varying vViewPos: vec4f;
|
|
70
|
+
#if defined(POSITION) || defined(BUMP) || defined(IRRADIANCE)
|
|
71
|
+
varying vPositionW: vec3f;
|
|
72
|
+
#endif
|
|
73
|
+
#if defined(VELOCITY) || defined(VELOCITY_LINEAR)
|
|
74
|
+
uniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;
|
|
75
|
+
#endif
|
|
76
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
77
|
+
@vertex
|
|
78
|
+
fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=vertexInputs.position;
|
|
79
|
+
#ifdef HAS_NORMAL_ATTRIBUTE
|
|
80
|
+
var normalUpdated: vec3f=vertexInputs.normal;
|
|
81
|
+
#else
|
|
82
|
+
var normalUpdated: vec3f=vec3f(0.0,0.0,0.0);
|
|
83
|
+
#endif
|
|
84
|
+
#ifdef UV1
|
|
85
|
+
var uvUpdated: vec2f=vertexInputs.uv;
|
|
86
|
+
#endif
|
|
87
|
+
#ifdef UV2
|
|
88
|
+
var uv2Updated: vec2f=vertexInputs.uv2;
|
|
89
|
+
#endif
|
|
90
|
+
#include<morphTargetsVertexGlobal>
|
|
91
|
+
#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
|
|
92
|
+
#include<instancesVertex>
|
|
93
|
+
#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)
|
|
94
|
+
vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);
|
|
95
|
+
#endif
|
|
96
|
+
#include<bonesVertex>
|
|
97
|
+
#include<bakedVertexAnimation>
|
|
98
|
+
var worldPos: vec4f= vec4f(finalWorld* vec4f(positionUpdated,1.0));
|
|
99
|
+
#ifdef BUMP
|
|
100
|
+
let vWorldView=scene.view*finalWorld;vertexOutputs.vWorldView0=vWorldView[0];vertexOutputs.vWorldView1=vWorldView[1];vertexOutputs.vWorldView2=vWorldView[2];vertexOutputs.vWorldView3=vWorldView[3];let normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);
|
|
101
|
+
#else
|
|
102
|
+
#ifdef NORMAL_WORLDSPACE
|
|
103
|
+
vertexOutputs.vNormalV=normalize((finalWorld* vec4f(normalUpdated,0.0)).xyz);
|
|
104
|
+
#else
|
|
105
|
+
vertexOutputs.vNormalV=normalize(((scene.view*finalWorld)* vec4f(normalUpdated,0.0)).xyz);
|
|
106
|
+
#endif
|
|
107
|
+
#endif
|
|
108
|
+
vertexOutputs.vViewPos=scene.view*worldPos;
|
|
109
|
+
#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)
|
|
110
|
+
vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0);
|
|
111
|
+
#if NUM_BONE_INFLUENCERS>0
|
|
112
|
+
var previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];
|
|
113
|
+
#if NUM_BONE_INFLUENCERS>1
|
|
114
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];
|
|
115
|
+
#endif
|
|
116
|
+
#if NUM_BONE_INFLUENCERS>2
|
|
117
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];
|
|
118
|
+
#endif
|
|
119
|
+
#if NUM_BONE_INFLUENCERS>3
|
|
120
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];
|
|
121
|
+
#endif
|
|
122
|
+
#if NUM_BONE_INFLUENCERS>4
|
|
123
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];
|
|
124
|
+
#endif
|
|
125
|
+
#if NUM_BONE_INFLUENCERS>5
|
|
126
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];
|
|
127
|
+
#endif
|
|
128
|
+
#if NUM_BONE_INFLUENCERS>6
|
|
129
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];
|
|
130
|
+
#endif
|
|
131
|
+
#if NUM_BONE_INFLUENCERS>7
|
|
132
|
+
previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];
|
|
133
|
+
#endif
|
|
134
|
+
vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0);
|
|
135
|
+
#else
|
|
136
|
+
vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);
|
|
137
|
+
#endif
|
|
138
|
+
#endif
|
|
139
|
+
#if defined(POSITION) || defined(BUMP) || defined(IRRADIANCE)
|
|
140
|
+
vertexOutputs.vPositionW=worldPos.xyz/worldPos.w;
|
|
141
|
+
#endif
|
|
142
|
+
vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0);
|
|
143
|
+
#include<clipPlaneVertex>
|
|
144
|
+
#ifdef NEED_UV
|
|
145
|
+
#ifdef UV1
|
|
146
|
+
#if defined(ALPHATEST) && defined(ALPHATEST_UV1)
|
|
147
|
+
vertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
148
|
+
#else
|
|
149
|
+
vertexOutputs.vUV=uvUpdated;
|
|
150
|
+
#endif
|
|
151
|
+
#ifdef BUMP_UV1
|
|
152
|
+
vertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
153
|
+
#endif
|
|
154
|
+
#ifdef REFLECTIVITY_UV1
|
|
155
|
+
vertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
156
|
+
#else
|
|
157
|
+
#ifdef METALLIC_UV1
|
|
158
|
+
vertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
159
|
+
#endif
|
|
160
|
+
#ifdef ROUGHNESS_UV1
|
|
161
|
+
vertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
162
|
+
#endif
|
|
163
|
+
#endif
|
|
164
|
+
#ifdef ALBEDO_UV1
|
|
165
|
+
vertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
166
|
+
#endif
|
|
167
|
+
#ifdef SUBSURFACE_WEIGHT_UV1
|
|
168
|
+
vertexOutputs.vSubsurfaceWeightUV=(uniforms.subsurfaceWeightMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
169
|
+
#endif
|
|
170
|
+
#ifdef TRANSMISSION_WEIGHT_UV1
|
|
171
|
+
vertexOutputs.vTransmissionWeightUV=(uniforms.transmissionWeightMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
|
|
172
|
+
#endif
|
|
173
|
+
#endif
|
|
174
|
+
#ifdef UV2
|
|
175
|
+
#if defined(ALPHATEST) && defined(ALPHATEST_UV2)
|
|
176
|
+
vertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
177
|
+
#else
|
|
178
|
+
vertexOutputs.vUV=uv2Updated;
|
|
179
|
+
#endif
|
|
180
|
+
#ifdef BUMP_UV2
|
|
181
|
+
vertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
182
|
+
#endif
|
|
183
|
+
#ifdef REFLECTIVITY_UV2
|
|
184
|
+
vertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
185
|
+
#else
|
|
186
|
+
#ifdef METALLIC_UV2
|
|
187
|
+
vertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
188
|
+
#endif
|
|
189
|
+
#ifdef ROUGHNESS_UV2
|
|
190
|
+
vertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
191
|
+
#endif
|
|
192
|
+
#endif
|
|
193
|
+
#ifdef ALBEDO_UV2
|
|
194
|
+
vertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
195
|
+
#endif
|
|
196
|
+
#ifdef SUBSURFACE_WEIGHT_UV2
|
|
197
|
+
vertexOutputs.vSubsurfaceWeightUV=(uniforms.subsurfaceWeightMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
198
|
+
#endif
|
|
199
|
+
#ifdef TRANSMISSION_WEIGHT_UV2
|
|
200
|
+
vertexOutputs.vTransmissionWeightUV=(uniforms.transmissionWeightMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
|
|
201
|
+
#endif
|
|
202
|
+
#endif
|
|
203
|
+
#endif
|
|
204
|
+
#include<bumpVertex>
|
|
205
|
+
#ifdef IRRADIANCE
|
|
206
|
+
#ifdef REFLECTION
|
|
207
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
208
|
+
var reflectionVector: vec3f=(uniforms.reflectionMatrix*vec4f(normalUpdated,0.0)).xyz;
|
|
209
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
210
|
+
reflectionVector.z*=-1.0f;
|
|
211
|
+
#endif
|
|
212
|
+
vertexOutputs.vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector)*uniforms.vReflectionInfos.x;
|
|
213
|
+
#endif
|
|
214
|
+
#endif
|
|
215
|
+
#endif
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
i.ShadersStoreWGSL[e] || (i.ShadersStoreWGSL[e] = r);
|
|
219
|
+
const d = { name: e, shader: r };
|
|
220
|
+
export {
|
|
221
|
+
d as geometryVertexShaderWGSL
|
|
222
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { b0 as e } from "./index-CS3Icp_r.js";
|
|
2
|
+
const t = "pbrBRDFFunctions", a = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
|
|
3
|
+
#define BRDF_DIFFUSE_MODEL_EON 0
|
|
4
|
+
#define BRDF_DIFFUSE_MODEL_BURLEY 1
|
|
5
|
+
#define BRDF_DIFFUSE_MODEL_LAMBERT 2
|
|
6
|
+
#define BRDF_DIFFUSE_MODEL_LEGACY 3
|
|
7
|
+
#define DIELECTRIC_SPECULAR_MODEL_GLTF 0
|
|
8
|
+
#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1
|
|
9
|
+
#define CONDUCTOR_SPECULAR_MODEL_GLTF 0
|
|
10
|
+
#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1
|
|
11
|
+
#if !defined(PBR_VERTEX_SHADER) && !defined(OPENPBR_VERTEX_SHADER)
|
|
12
|
+
#ifdef MS_BRDF_ENERGY_CONSERVATION
|
|
13
|
+
vec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}
|
|
14
|
+
#endif
|
|
15
|
+
#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR
|
|
16
|
+
#define F82_COS_THETA_MAX 0.142857143
|
|
17
|
+
#define F82_ONE_MINUS_CTM_POW5 0.462664366
|
|
18
|
+
#define F82_ONE_MINUS_CTM_POW6 0.396569457
|
|
19
|
+
#define F82_B_DENOMINATOR_RECIP 17.6512785
|
|
20
|
+
#define BRDF_Z_SCALE 16.0
|
|
21
|
+
vec3 getF82Specular(float NdotV,vec3 F0,vec3 edgeTint,float roughness) {vec3 white_minus_F0=vec3(1.0)-F0;vec3 b=(F0+white_minus_F0*F82_ONE_MINUS_CTM_POW5)*(vec3(1.0)-edgeTint)*F82_B_DENOMINATOR_RECIP;float cos_theta=max(roughness,NdotV);float one_minus_cos_theta=1.0-cos_theta;vec3 offset_from_F0=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0);return clamp(F0+offset_from_F0,0.0,1.0);}
|
|
22
|
+
vec3 getF82B(vec3 F0,vec3 edgeTint) {return (F0+(vec3(1.0)-F0)*F82_ONE_MINUS_CTM_POW5)*(vec3(1.0)-edgeTint)*F82_B_DENOMINATOR_RECIP;}
|
|
23
|
+
vec3 getF82DirectionalAlbedo(vec3 F0,vec3 F90,vec3 b,vec3 environmentBrdf) {return (F90-F0)*environmentBrdf.x+F0*environmentBrdf.y-b*environmentBrdf.z;}
|
|
24
|
+
vec3 getF82AverageFresnel(vec3 F0,vec3 b) {return F0+(vec3(1.0)-F0)/21.0-b/126.0;}
|
|
25
|
+
#endif
|
|
26
|
+
#ifdef FUZZENVIRONMENTBRDF
|
|
27
|
+
vec3 getFuzzBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(perceptualRoughness,NdotV);vec4 brdfLookup=texture2D(environmentFuzzBrdfSampler,UV);const vec2 RiRange=vec2(0.0,0.75);const vec2 ARange =vec2(0.005,0.88);const vec2 BRange =vec2(-0.18,0.002);brdfLookup.r=mix(ARange.x, ARange.y, brdfLookup.r);brdfLookup.g=mix(BRange.x, BRange.y, brdfLookup.g);brdfLookup.b=mix(RiRange.x,RiRange.y,brdfLookup.b);return brdfLookup.rgb;}
|
|
28
|
+
#endif
|
|
29
|
+
#ifdef ENVIRONMENTBRDF
|
|
30
|
+
vec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);
|
|
31
|
+
#ifdef ENVIRONMENTBRDF_RGBD
|
|
32
|
+
brdfLookup.rgb=fromRGBD(brdfLookup.rgba);
|
|
33
|
+
#endif
|
|
34
|
+
return brdfLookup.rgb;}
|
|
35
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {
|
|
36
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
37
|
+
vec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
|
|
38
|
+
#else
|
|
39
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
|
|
40
|
+
#endif
|
|
41
|
+
return reflectance;}
|
|
42
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {
|
|
43
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
44
|
+
vec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
|
|
45
|
+
#else
|
|
46
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
|
|
47
|
+
#endif
|
|
48
|
+
return reflectance;}
|
|
49
|
+
#endif
|
|
50
|
+
/* NOT USED
|
|
51
|
+
#if defined(SHEEN) && defined(SHEEN_SOFTER)
|
|
52
|
+
float getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)
|
|
53
|
+
{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}
|
|
54
|
+
#endif
|
|
55
|
+
*/
|
|
56
|
+
#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
|
|
57
|
+
vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
|
|
58
|
+
{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}
|
|
59
|
+
#endif
|
|
60
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
|
|
61
|
+
/**
|
|
62
|
+
* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.
|
|
63
|
+
* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table
|
|
64
|
+
*/
|
|
65
|
+
vec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}
|
|
66
|
+
#endif
|
|
67
|
+
vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)
|
|
68
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
69
|
+
float fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)
|
|
70
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
71
|
+
#ifdef CLEARCOAT
|
|
72
|
+
vec3 getR0RemappedForClearCoat(vec3 f0) {
|
|
73
|
+
#ifdef CLEARCOAT_DEFAULTIOR
|
|
74
|
+
#ifdef MOBILE
|
|
75
|
+
return saturate(f0*(f0*0.526868+0.529324)-0.0482256);
|
|
76
|
+
#else
|
|
77
|
+
return saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
|
|
78
|
+
#endif
|
|
79
|
+
#else
|
|
80
|
+
vec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t);
|
|
81
|
+
#endif
|
|
82
|
+
}
|
|
83
|
+
#endif
|
|
84
|
+
#ifdef IRIDESCENCE
|
|
85
|
+
const mat3 XYZ_TO_REC709=mat3(
|
|
86
|
+
3.2404542,-0.9692660, 0.0556434,
|
|
87
|
+
-1.5371385, 1.8760108,-0.2040259,
|
|
88
|
+
-0.4985314, 0.0415560, 1.0572252
|
|
89
|
+
);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}
|
|
90
|
+
vec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));}
|
|
91
|
+
float getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));}
|
|
92
|
+
vec3 evalSensitivity(float opd,vec3 shift) {float phase=2.0*PI*opd*1.0e-9;const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);vec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}
|
|
93
|
+
vec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {vec3 I=vec3(1.0);float iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));float sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));float cosTheta2Sq=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}
|
|
94
|
+
float cosTheta2=sqrt(cosTheta2Sq);float R0=getR0fromIORs(iridescenceIOR,outsideIOR);float R12=fresnelSchlickGGX(cosTheta1,R0,1.);float R21=R12;float T121=1.0-R12;float phi12=0.0;if (iridescenceIOR<outsideIOR) phi12=PI;float phi21=PI-phi12;vec3 baseIOR=getIORTfromAirToSurfaceR0(clamp(baseF0,0.0,0.9999));
|
|
95
|
+
vec3 R1=getR0fromIORs(baseIOR,iridescenceIOR);float maxR1=max(R1.r,max(R1.g,R1.b));if (maxR1<1e-6) {return max(vec3(R12),vec3(0.0));}
|
|
96
|
+
vec3 R23=fresnelSchlickGGX(cosTheta2,R1,vec3(1.));vec3 phi23=vec3(0.0);if (baseIOR[0]<iridescenceIOR) phi23[0]=PI;if (baseIOR[1]<iridescenceIOR) phi23[1]=PI;if (baseIOR[2]<iridescenceIOR) phi23[2]=PI;float opd=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;vec3 phi=vec3(phi21)+phi23;vec3 R123=clamp(R12*R23,1e-5,0.9999);vec3 r123=sqrt(R123);vec3 Rs=square(T121)*R23/(vec3(1.0)-R123);vec3 C0=R12+Rs;I=C0;vec3 Cm=Rs-T121;for (int m=1; m<=2; ++m)
|
|
97
|
+
{Cm*=r123;vec3 Sm=2.0*evalSensitivity(float(m)*opd,float(m)*phi);I+=Cm*Sm;}
|
|
98
|
+
return max(I,vec3(0.0));}
|
|
99
|
+
#endif
|
|
100
|
+
float normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)
|
|
101
|
+
{float a2=square(alphaG);float d=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}
|
|
102
|
+
#ifdef SHEEN
|
|
103
|
+
float normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)
|
|
104
|
+
{float invR=1./alphaG;float cos2h=NdotH*NdotH;float sin2h=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}
|
|
105
|
+
#endif
|
|
106
|
+
#ifdef ANISOTROPIC
|
|
107
|
+
float normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {float a2=alphaTB.x*alphaTB.y;vec3 v=vec3(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);float v2=dot(v,v);float w2=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}
|
|
108
|
+
#endif
|
|
109
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
110
|
+
float smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {
|
|
111
|
+
#ifdef MOBILE
|
|
112
|
+
float GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);float GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);
|
|
113
|
+
#else
|
|
114
|
+
float a2=alphaG*alphaG;float GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);float GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);
|
|
115
|
+
#endif
|
|
116
|
+
}
|
|
117
|
+
#else
|
|
118
|
+
float smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)
|
|
119
|
+
{
|
|
120
|
+
#ifdef MOBILE
|
|
121
|
+
return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
|
|
122
|
+
#else
|
|
123
|
+
float alphaSquared=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
|
|
124
|
+
#endif
|
|
125
|
+
}
|
|
126
|
+
float smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)
|
|
127
|
+
{float visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}
|
|
128
|
+
#endif
|
|
129
|
+
#ifdef ANISOTROPIC
|
|
130
|
+
float smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {float lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));float lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));float v=0.5/(lambdaV+lambdaL);return v;}
|
|
131
|
+
#endif
|
|
132
|
+
#ifdef CLEARCOAT
|
|
133
|
+
float visibility_Kelemen(float VdotH) {return 0.25/(VdotH*VdotH); }
|
|
134
|
+
#endif
|
|
135
|
+
#ifdef SHEEN
|
|
136
|
+
float visibility_Ashikhmin(float NdotL,float NdotV)
|
|
137
|
+
{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}
|
|
138
|
+
/* NOT USED
|
|
139
|
+
#ifdef SHEEN_SOFTER
|
|
140
|
+
float l(float x,float alphaG)
|
|
141
|
+
{float oneMinusAlphaSq=(1.0-alphaG)*(1.0-alphaG);float a=mix(21.5473,25.3245,oneMinusAlphaSq);float b=mix(3.82987,3.32435,oneMinusAlphaSq);float c=mix(0.19823,0.16801,oneMinusAlphaSq);float d=mix(-1.97760,-1.27393,oneMinusAlphaSq);float e=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}
|
|
142
|
+
float lambdaSheen(float cosTheta,float alphaG)
|
|
143
|
+
{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}
|
|
144
|
+
float visibility_CharlieSheen(float NdotL,float NdotV,float alphaG)
|
|
145
|
+
{float G=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}
|
|
146
|
+
#endif
|
|
147
|
+
*/
|
|
148
|
+
#endif
|
|
149
|
+
float diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {float diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));float diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));float diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;float fresnel =
|
|
150
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
|
|
151
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}
|
|
152
|
+
const float constant1_FON=0.5-2.0/(3.0*PI);const float constant2_FON=2.0/3.0-28.0/(15.0*PI);float E_FON_approx(float mu,float roughness)
|
|
153
|
+
{float sigma=roughness;
|
|
154
|
+
float mucomp=1.0-mu;float mucomp2=mucomp*mucomp;const mat2 Gcoeffs=mat2(0.0571085289,-0.332181442,
|
|
155
|
+
0.491881867,0.0714429953);float GoverPi=dot(Gcoeffs*vec2(mucomp,mucomp2),vec2(1.0,mucomp2));return (1.0+sigma*GoverPi)/(1.0+constant1_FON*sigma);}
|
|
156
|
+
vec3 diffuseBRDF_EON(vec3 albedo,float roughness,float NdotL,float NdotV,float LdotV)
|
|
157
|
+
{vec3 rho=albedo;float sigma=roughness;
|
|
158
|
+
float mu_i=NdotL;
|
|
159
|
+
float mu_o=NdotV;
|
|
160
|
+
float s=LdotV-mu_i*mu_o;
|
|
161
|
+
float sovertF=s>0.0 ? s/max(mu_i,mu_o) : s;
|
|
162
|
+
float AF=1.0/(1.0+constant1_FON*sigma);
|
|
163
|
+
vec3 f_ss=(rho*RECIPROCAL_PI)*AF*(1.0+sigma*sovertF);
|
|
164
|
+
float EFo=E_FON_approx(mu_o,sigma);
|
|
165
|
+
float EFi=E_FON_approx(mu_i,sigma);
|
|
166
|
+
float avgEF=AF*(1.0+constant2_FON*sigma);
|
|
167
|
+
vec3 rho_ms=(rho*rho)*avgEF/(vec3(1.0)-rho*(1.0-avgEF));const float eps=1.0e-7;vec3 f_ms=(rho_ms*RECIPROCAL_PI)*max(eps,1.0-EFo)
|
|
168
|
+
* max(eps,1.0-EFi)
|
|
169
|
+
/ max(eps,1.0-avgEF);return (f_ss+f_ms);}
|
|
170
|
+
#ifdef SS_TRANSLUCENCY
|
|
171
|
+
vec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {vec3 S=1./maxEps(diffusionDistance);vec3 temp=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}
|
|
172
|
+
float computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);}
|
|
173
|
+
#endif
|
|
174
|
+
#endif
|
|
175
|
+
`;
|
|
176
|
+
e.IncludesShadersStore[t] || (e.IncludesShadersStore[t] = a);
|
|
177
|
+
const o = "harmonicsFunctions", n = `#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
178
|
+
#ifdef SPHERICAL_HARMONICS
|
|
179
|
+
vec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00
|
|
180
|
+
+ vSphericalL1_1*(normal.y)
|
|
181
|
+
+ vSphericalL10*(normal.z)
|
|
182
|
+
+ vSphericalL11*(normal.x)
|
|
183
|
+
+ vSphericalL2_2*(normal.y*normal.x)
|
|
184
|
+
+ vSphericalL2_1*(normal.y*normal.z)
|
|
185
|
+
+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)
|
|
186
|
+
+ vSphericalL21*(normal.z*normal.x)
|
|
187
|
+
+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}
|
|
188
|
+
#else
|
|
189
|
+
vec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;}
|
|
190
|
+
#endif
|
|
191
|
+
#endif
|
|
192
|
+
`;
|
|
193
|
+
e.IncludesShadersStore[o] || (e.IncludesShadersStore[o] = n);
|