@babylonjs/core 5.6.1 → 5.7.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/Cameras/Inputs/freeCameraTouchInput.js +2 -2
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Particles/particleHelper.js +1 -1
- package/Particles/particleHelper.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ var ParticleHelper = /** @class */ (function () {
|
|
|
32
32
|
system = new ParticleSystem("default system", capacity, scene);
|
|
33
33
|
}
|
|
34
34
|
system.emitter = emitter;
|
|
35
|
-
system.particleTexture = new Texture("https://
|
|
35
|
+
system.particleTexture = new Texture("https://assets.babylonjs.com/textures/flare.png", system.getScene());
|
|
36
36
|
system.createConeEmitter(0.1, Math.PI / 4);
|
|
37
37
|
// Particle color
|
|
38
38
|
system.color1 = new Color4(1.0, 1.0, 1.0, 1.0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particleHelper.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Particles/particleHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oB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c,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;yBACvF;wBACD,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;wBAE7B,OAAO,CAAC,MAAM,CAAC,CAAC;qBACnB;yBAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,KAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IA9LD;;OAEG;IACW,4BAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC;IAE9D,sCAAsC;IACxB,yBAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IAyLpD,qBAAC;CAAA,AAhMD,IAgMC;SAhMY,cAAc","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IParticleSystem } from \"./IParticleSystem\";\r\nimport { GPUParticleSystem } from \"./gpuParticleSystem\";\r\nimport { ParticleSystemSet } from \"./particleSystemSet\";\r\nimport { ParticleSystem } from \"./particleSystem\";\r\nimport { WebRequest } from \"../Misc/webRequest\";\r\nimport { Constants } from \"../Engines/constants\";\r\n/**\r\n * This class is made for on one-liner static method to help creating particle system set.\r\n */\r\nexport class ParticleHelper {\r\n /**\r\n * Gets or sets base Assets URL\r\n */\r\n public static BaseAssetsUrl = ParticleSystemSet.BaseAssetsUrl;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /**\r\n * Create a default particle system that you can tweak\r\n * @param emitter defines the emitter to use\r\n * @param capacity defines the system capacity (default is 500 particles)\r\n * @param scene defines the hosting scene\r\n * @param useGPU defines if a GPUParticleSystem must be created (default is false)\r\n * @returns the new Particle system\r\n */\r\n public static CreateDefault(emitter: Nullable<AbstractMesh | Vector3>, capacity = 500, scene?: Scene, useGPU = false): IParticleSystem {\r\n let system: IParticleSystem;\r\n\r\n if (useGPU) {\r\n system = new GPUParticleSystem(\"default system\", { capacity: capacity }, scene!);\r\n } else {\r\n system = new ParticleSystem(\"default system\", capacity, scene!);\r\n }\r\n\r\n system.emitter = emitter;\r\n system.particleTexture = new Texture(\"https://www.babylonjs.com/assets/Flare.png\", system.getScene());\r\n system.createConeEmitter(0.1, Math.PI / 4);\r\n\r\n // Particle color\r\n system.color1 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n system.color2 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n system.colorDead = new Color4(1.0, 1.0, 1.0, 0.0);\r\n\r\n // Particle Size\r\n system.minSize = 0.1;\r\n system.maxSize = 0.1;\r\n\r\n // Emission speed\r\n system.minEmitPower = 2;\r\n system.maxEmitPower = 2;\r\n\r\n // Update speed\r\n system.updateSpeed = 1 / 60;\r\n\r\n system.emitRate = 30;\r\n\r\n return system;\r\n }\r\n\r\n /**\r\n * This is the main static method (one-liner) of this helper to create different particle systems\r\n * @param type This string represents the type to the particle system to create\r\n * @param scene The scene where the particle system should live\r\n * @param gpu If the system will use gpu\r\n * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)\r\n * @returns the ParticleSystemSet created\r\n */\r\n public static CreateAsync(type: string, scene: Nullable<Scene>, gpu: boolean = false, capacity?: number): Promise<ParticleSystemSet> {\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n const token = {};\r\n\r\n scene!._addPendingData(token);\r\n\r\n return new Promise((resolve, reject) => {\r\n if (gpu && !GPUParticleSystem.IsSupported) {\r\n scene!._removePendingData(token);\r\n return reject(\"Particle system with GPU is not supported.\");\r\n }\r\n\r\n Tools.LoadFile(\r\n `${ParticleHelper.BaseAssetsUrl}/systems/${type}.json`,\r\n (data) => {\r\n scene!._removePendingData(token);\r\n const newData = JSON.parse(data.toString());\r\n return resolve(ParticleSystemSet.Parse(newData, scene!, gpu, capacity));\r\n },\r\n undefined,\r\n undefined,\r\n undefined,\r\n () => {\r\n scene!._removePendingData(token);\r\n return reject(`An error occurred with the creation of your particle system. Check if your type '${type}' exists.`);\r\n }\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Static function used to export a particle system to a ParticleSystemSet variable.\r\n * Please note that the emitter shape is not exported\r\n * @param systems defines the particle systems to export\r\n * @returns the created particle system set\r\n */\r\n public static ExportSet(systems: IParticleSystem[]): ParticleSystemSet {\r\n const set = new ParticleSystemSet();\r\n\r\n for (const system of systems) {\r\n set.systems.push(system);\r\n }\r\n\r\n return set;\r\n }\r\n\r\n /**\r\n * Creates a particle system from a snippet saved in a remote file\r\n * @param name defines the name of the particle system to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @param scene defines the hosting scene\r\n * @param gpu If the system will use gpu\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)\r\n * @returns a promise that will resolve to the new particle system\r\n */\r\n public static ParseFromFileAsync(name: Nullable<string>, url: string, scene: Scene, gpu: boolean = false, rootUrl: string = \"\", capacity?: number): Promise<IParticleSystem> {\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const serializationObject = JSON.parse(request.responseText);\r\n let output: IParticleSystem;\r\n\r\n if (gpu) {\r\n output = GPUParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n } else {\r\n output = ParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n }\r\n\r\n if (name) {\r\n output.name = name;\r\n }\r\n\r\n resolve(output);\r\n } else {\r\n reject(\"Unable to load the particle system\");\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a particle system from a snippet saved by the particle system editor\r\n * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)\r\n * @param scene defines the hosting scene\r\n * @param gpu If the system will use gpu\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)\r\n * @returns a promise that will resolve to the new particle system\r\n */\r\n public static CreateFromSnippetAsync(snippetId: string, scene: Scene, gpu: boolean = false, rootUrl: string = \"\", capacity?: number): Promise<IParticleSystem> {\r\n if (snippetId === \"_BLANK\") {\r\n const system = this.CreateDefault(null);\r\n system.start();\r\n return Promise.resolve(system);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.particleSystem);\r\n let output: IParticleSystem;\r\n\r\n if (gpu) {\r\n output = GPUParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n } else {\r\n output = ParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n }\r\n output.snippetId = snippetId;\r\n\r\n resolve(output);\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"particleHelper.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Particles/particleHelper.ts"],"names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,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;wBACzE,IAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;wBAC/D,IAAI,MAAM,SAAiB,CAAC;wBAE5B,IAAI,GAAG,EAAE;4BACL,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;yBAC1F;6BAAM;4BACH,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;yBACvF;wBACD,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;wBAE7B,OAAO,CAAC,MAAM,CAAC,CAAC;qBACnB;yBAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,KAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IA9LD;;OAEG;IACW,4BAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC;IAE9D,sCAAsC;IACxB,yBAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IAyLpD,qBAAC;CAAA,AAhMD,IAgMC;SAhMY,cAAc","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IParticleSystem } from \"./IParticleSystem\";\r\nimport { GPUParticleSystem } from \"./gpuParticleSystem\";\r\nimport { ParticleSystemSet } from \"./particleSystemSet\";\r\nimport { ParticleSystem } from \"./particleSystem\";\r\nimport { WebRequest } from \"../Misc/webRequest\";\r\nimport { Constants } from \"../Engines/constants\";\r\n/**\r\n * This class is made for on one-liner static method to help creating particle system set.\r\n */\r\nexport class ParticleHelper {\r\n /**\r\n * Gets or sets base Assets URL\r\n */\r\n public static BaseAssetsUrl = ParticleSystemSet.BaseAssetsUrl;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /**\r\n * Create a default particle system that you can tweak\r\n * @param emitter defines the emitter to use\r\n * @param capacity defines the system capacity (default is 500 particles)\r\n * @param scene defines the hosting scene\r\n * @param useGPU defines if a GPUParticleSystem must be created (default is false)\r\n * @returns the new Particle system\r\n */\r\n public static CreateDefault(emitter: Nullable<AbstractMesh | Vector3>, capacity = 500, scene?: Scene, useGPU = false): IParticleSystem {\r\n let system: IParticleSystem;\r\n\r\n if (useGPU) {\r\n system = new GPUParticleSystem(\"default system\", { capacity: capacity }, scene!);\r\n } else {\r\n system = new ParticleSystem(\"default system\", capacity, scene!);\r\n }\r\n\r\n system.emitter = emitter;\r\n system.particleTexture = new Texture(\"https://assets.babylonjs.com/textures/flare.png\", system.getScene());\r\n system.createConeEmitter(0.1, Math.PI / 4);\r\n\r\n // Particle color\r\n system.color1 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n system.color2 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n system.colorDead = new Color4(1.0, 1.0, 1.0, 0.0);\r\n\r\n // Particle Size\r\n system.minSize = 0.1;\r\n system.maxSize = 0.1;\r\n\r\n // Emission speed\r\n system.minEmitPower = 2;\r\n system.maxEmitPower = 2;\r\n\r\n // Update speed\r\n system.updateSpeed = 1 / 60;\r\n\r\n system.emitRate = 30;\r\n\r\n return system;\r\n }\r\n\r\n /**\r\n * This is the main static method (one-liner) of this helper to create different particle systems\r\n * @param type This string represents the type to the particle system to create\r\n * @param scene The scene where the particle system should live\r\n * @param gpu If the system will use gpu\r\n * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)\r\n * @returns the ParticleSystemSet created\r\n */\r\n public static CreateAsync(type: string, scene: Nullable<Scene>, gpu: boolean = false, capacity?: number): Promise<ParticleSystemSet> {\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n const token = {};\r\n\r\n scene!._addPendingData(token);\r\n\r\n return new Promise((resolve, reject) => {\r\n if (gpu && !GPUParticleSystem.IsSupported) {\r\n scene!._removePendingData(token);\r\n return reject(\"Particle system with GPU is not supported.\");\r\n }\r\n\r\n Tools.LoadFile(\r\n `${ParticleHelper.BaseAssetsUrl}/systems/${type}.json`,\r\n (data) => {\r\n scene!._removePendingData(token);\r\n const newData = JSON.parse(data.toString());\r\n return resolve(ParticleSystemSet.Parse(newData, scene!, gpu, capacity));\r\n },\r\n undefined,\r\n undefined,\r\n undefined,\r\n () => {\r\n scene!._removePendingData(token);\r\n return reject(`An error occurred with the creation of your particle system. Check if your type '${type}' exists.`);\r\n }\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Static function used to export a particle system to a ParticleSystemSet variable.\r\n * Please note that the emitter shape is not exported\r\n * @param systems defines the particle systems to export\r\n * @returns the created particle system set\r\n */\r\n public static ExportSet(systems: IParticleSystem[]): ParticleSystemSet {\r\n const set = new ParticleSystemSet();\r\n\r\n for (const system of systems) {\r\n set.systems.push(system);\r\n }\r\n\r\n return set;\r\n }\r\n\r\n /**\r\n * Creates a particle system from a snippet saved in a remote file\r\n * @param name defines the name of the particle system to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @param scene defines the hosting scene\r\n * @param gpu If the system will use gpu\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)\r\n * @returns a promise that will resolve to the new particle system\r\n */\r\n public static ParseFromFileAsync(name: Nullable<string>, url: string, scene: Scene, gpu: boolean = false, rootUrl: string = \"\", capacity?: number): Promise<IParticleSystem> {\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const serializationObject = JSON.parse(request.responseText);\r\n let output: IParticleSystem;\r\n\r\n if (gpu) {\r\n output = GPUParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n } else {\r\n output = ParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n }\r\n\r\n if (name) {\r\n output.name = name;\r\n }\r\n\r\n resolve(output);\r\n } else {\r\n reject(\"Unable to load the particle system\");\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a particle system from a snippet saved by the particle system editor\r\n * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)\r\n * @param scene defines the hosting scene\r\n * @param gpu If the system will use gpu\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)\r\n * @returns a promise that will resolve to the new particle system\r\n */\r\n public static CreateFromSnippetAsync(snippetId: string, scene: Scene, gpu: boolean = false, rootUrl: string = \"\", capacity?: number): Promise<IParticleSystem> {\r\n if (snippetId === \"_BLANK\") {\r\n const system = this.CreateDefault(null);\r\n system.start();\r\n return Promise.resolve(system);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.particleSystem);\r\n let output: IParticleSystem;\r\n\r\n if (gpu) {\r\n output = GPUParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n } else {\r\n output = ParticleSystem.Parse(serializationObject, scene, rootUrl, false, capacity);\r\n }\r\n output.snippetId = snippetId;\r\n\r\n resolve(output);\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "../../Engines/shaderStore.js";
|
|
3
3
|
var name = "pbrBlockClearcoat";
|
|
4
|
-
var shader = "struct clearcoatOutParams\n{\nvec3 specularEnvironmentR0;\nfloat conservationFactor;\nvec3 clearCoatNormalW;\nvec2 clearCoatAARoughnessFactors;\nfloat clearCoatIntensity;\nfloat clearCoatRoughness;\n#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;\nfloat clearCoatNdotVRefract;\nvec3 clearCoatColor;\nfloat clearCoatThickness;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\n#endif\n#if DEBUGMODE>0\nmat3 TBNClearCoat;\nvec2 clearCoatMapData;\nvec4 clearCoatTintMapData;\nvec4 environmentClearCoatRadiance;\nfloat clearCoatNdotV;\nvec3 clearCoatEnvironmentReflectance;\n#endif\n};\n#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\nin vec3 vPositionW,\nin vec3 geometricNormalW,\nin vec3 viewDirectionW,\nin vec2 vClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 clearCoatMapRoughnessData,\n#endif\nin vec3 specularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nin vec4 vClearCoatTintParams,\nin float clearCoatColorAtDistance,\nin vec4 vClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nin vec4 clearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nin vec2 vClearCoatBumpInfos,\nin vec4 clearCoatBumpMapData,\nin vec2 vClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nin mat3 vTBN,\n#else\nin vec2 vClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nin mat4 normalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nin vec3 faceNormal,\n#endif\n#ifdef REFLECTION\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nin float ambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\nin float frontFacingMultiplier,\n#endif\nout clearcoatOutParams outParams\n)\n{\nfloat clearCoatIntensity=vClearCoatParams.x;\nfloat clearCoatRoughness=vClearCoatParams.y;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\nclearCoatRoughness*=clearCoatMapData.y;\n#endif\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\n#endif\n#endif\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\nclearCoatRoughness*=clearCoatMapData.y;\n#else\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\n#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;\noutParams.clearCoatRoughness=clearCoatRoughness;\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\nfloat clearCoatThickness=vClearCoatTintParams.a;\n#ifdef CLEARCOAT_TINT_TEXTURE\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\n#else\nclearCoatColor*=clearCoatTintMapData.rgb;\n#endif\nclearCoatThickness*=clearCoatTintMapData.a;\n#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\n#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\noutParams.clearCoatThickness=clearCoatThickness;\n#endif\n#ifdef CLEARCOAT_REMAP_F0\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\n#else\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\n#endif\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\nvec3 clearCoatNormalW=geometricNormalW;\n#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\n#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\n#else\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\n#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\n#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\n#endif\noutParams.clearCoatNormalW=clearCoatNormalW;\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\n#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatVRefract
|
|
4
|
+
var shader = "struct clearcoatOutParams\n{\nvec3 specularEnvironmentR0;\nfloat conservationFactor;\nvec3 clearCoatNormalW;\nvec2 clearCoatAARoughnessFactors;\nfloat clearCoatIntensity;\nfloat clearCoatRoughness;\n#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;\nfloat clearCoatNdotVRefract;\nvec3 clearCoatColor;\nfloat clearCoatThickness;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\n#endif\n#if DEBUGMODE>0\nmat3 TBNClearCoat;\nvec2 clearCoatMapData;\nvec4 clearCoatTintMapData;\nvec4 environmentClearCoatRadiance;\nfloat clearCoatNdotV;\nvec3 clearCoatEnvironmentReflectance;\n#endif\n};\n#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\nin vec3 vPositionW,\nin vec3 geometricNormalW,\nin vec3 viewDirectionW,\nin vec2 vClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 clearCoatMapRoughnessData,\n#endif\nin vec3 specularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nin vec4 vClearCoatTintParams,\nin float clearCoatColorAtDistance,\nin vec4 vClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nin vec4 clearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nin vec2 vClearCoatBumpInfos,\nin vec4 clearCoatBumpMapData,\nin vec2 vClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nin mat3 vTBN,\n#else\nin vec2 vClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nin mat4 normalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nin vec3 faceNormal,\n#endif\n#ifdef REFLECTION\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nin float ambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\nin float frontFacingMultiplier,\n#endif\nout clearcoatOutParams outParams\n)\n{\nfloat clearCoatIntensity=vClearCoatParams.x;\nfloat clearCoatRoughness=vClearCoatParams.y;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\nclearCoatRoughness*=clearCoatMapData.y;\n#endif\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\n#endif\n#endif\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\nclearCoatRoughness*=clearCoatMapData.y;\n#else\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\n#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;\noutParams.clearCoatRoughness=clearCoatRoughness;\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\nfloat clearCoatThickness=vClearCoatTintParams.a;\n#ifdef CLEARCOAT_TINT_TEXTURE\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\n#else\nclearCoatColor*=clearCoatTintMapData.rgb;\n#endif\nclearCoatThickness*=clearCoatTintMapData.a;\n#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\n#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\noutParams.clearCoatThickness=clearCoatThickness;\n#endif\n#ifdef CLEARCOAT_REMAP_F0\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\n#else\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\n#endif\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\nvec3 clearCoatNormalW=geometricNormalW;\n#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\n#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\n#else\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\n#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\n#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\n#endif\noutParams.clearCoatNormalW=clearCoatNormalW;\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\n#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\n#endif\n#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\n#endif\n#if defined(REFLECTION)\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\n#ifdef SPECULARAA\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\n#endif\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nclearCoatReflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\n#else\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\n#endif\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\n#endif\nsampleReflectionTexture(\nclearCoatAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nclearCoatNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nclearCoatRoughness,\n#endif\nreflectionSampler,\nclearCoatReflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentClearCoatRadiance\n);\n#if DEBUGMODE>0\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\n#ifdef RADIANCEOCCLUSION\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\nclearCoatEnvironmentReflectance*=clearCoatSeo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\nclearCoatEnvironmentReflectance*=clearCoatEho;\n#endif\n#endif\n#endif\n#else\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\n#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\n#if DEBUGMODE>0\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\n#endif\noutParams.finalClearCoatRadianceScaled=\nenvironmentClearCoatRadiance.rgb *\nclearCoatEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(CLEARCOAT_TINT)\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\n#endif\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnelIBLClearCoat*=clearCoatIntensity;\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\n#endif\n}\n#endif\n";
|
|
5
5
|
// Sideeffect
|
|
6
6
|
ShaderStore.IncludesShadersStore[name] = shader;
|
|
7
7
|
/** @hidden */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrBlockClearcoat.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Shaders/ShadersInclude/pbrBlockClearcoat.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,IAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,IAAM,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"pbrBlockClearcoat.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Shaders/ShadersInclude/pbrBlockClearcoat.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,IAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,IAAM,MAAM,GAAG,0vRA6Qd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,cAAc;AACd,MAAM,CAAC,IAAM,iBAAiB,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"pbrBlockClearcoat\";\nconst shader = `struct clearcoatOutParams\r{\rvec3 specularEnvironmentR0;\rfloat conservationFactor;\rvec3 clearCoatNormalW;\rvec2 clearCoatAARoughnessFactors;\rfloat clearCoatIntensity;\rfloat clearCoatRoughness;\r#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\r#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;\rfloat clearCoatNdotVRefract;\rvec3 clearCoatColor;\rfloat clearCoatThickness;\r#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\r#endif\n#if DEBUGMODE>0\nmat3 TBNClearCoat;\rvec2 clearCoatMapData;\rvec4 clearCoatTintMapData;\rvec4 environmentClearCoatRadiance;\rfloat clearCoatNdotV;\rvec3 clearCoatEnvironmentReflectance;\r#endif\n};\r#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\rin vec3 vPositionW,\rin vec3 geometricNormalW,\rin vec3 viewDirectionW,\rin vec2 vClearCoatParams,\r#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 clearCoatMapRoughnessData,\r#endif\nin vec3 specularEnvironmentR0,\r#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\r#endif\n#ifdef CLEARCOAT_TINT\nin vec4 vClearCoatTintParams,\rin float clearCoatColorAtDistance,\rin vec4 vClearCoatRefractionParams,\r#ifdef CLEARCOAT_TINT_TEXTURE\nin vec4 clearCoatTintMapData,\r#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nin vec2 vClearCoatBumpInfos,\rin vec4 clearCoatBumpMapData,\rin vec2 vClearCoatBumpUV,\r#if defined(TANGENT) && defined(NORMAL)\nin mat3 vTBN,\r#else\nin vec2 vClearCoatTangentSpaceParams,\r#endif\n#ifdef OBJECTSPACE_NORMALMAP\nin mat4 normalMatrix,\r#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nin vec3 faceNormal,\r#endif\n#ifdef REFLECTION\nin vec3 vReflectionMicrosurfaceInfos,\rin vec2 vReflectionInfos,\rin vec3 vReflectionColor,\rin vec4 vLightingIntensity,\r#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\r#else\nin sampler2D reflectionSampler,\r#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\rin samplerCube reflectionSamplerHigh,\r#else\nin sampler2D reflectionSamplerLow,\rin sampler2D reflectionSamplerHigh,\r#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\r#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nin float ambientMonochrome,\r#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\nin float frontFacingMultiplier,\r#endif\nout clearcoatOutParams outParams\r)\r{\rfloat clearCoatIntensity=vClearCoatParams.x;\rfloat clearCoatRoughness=vClearCoatParams.y;\r#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\r#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\nclearCoatRoughness*=clearCoatMapData.y;\r#endif\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\r#endif\n#endif\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\nclearCoatRoughness*=clearCoatMapData.y;\r#else\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\r#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;\routParams.clearCoatRoughness=clearCoatRoughness;\r#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\rfloat clearCoatThickness=vClearCoatTintParams.a;\r#ifdef CLEARCOAT_TINT_TEXTURE\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\r#else\nclearCoatColor*=clearCoatTintMapData.rgb;\r#endif\nclearCoatThickness*=clearCoatTintMapData.a;\r#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\r#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\routParams.clearCoatThickness=clearCoatThickness;\r#endif\n#ifdef CLEARCOAT_REMAP_F0\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\r#else\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\r#endif\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\rvec3 clearCoatNormalW=geometricNormalW;\r#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\r#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\r#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\r#else\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;\rmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\r#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\r#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);\rclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\r#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\r#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\r#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\r#endif\noutParams.clearCoatNormalW=clearCoatNormalW;\routParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\rfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\rfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\r#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\r#endif\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);\routParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\r#endif\n#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\r#endif\n#if defined(REFLECTION)\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\r#ifdef SPECULARAA\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\r#endif\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\rvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\r#ifdef REFLECTIONMAP_OPPOSITEZ\nclearCoatReflectionVector.z*=-1.0;\r#endif\n#ifdef REFLECTIONMAP_3D\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\r#else\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\r#ifdef REFLECTIONMAP_PROJECTION\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\r#endif\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\r#endif\nsampleReflectionTexture(\rclearCoatAlphaG,\rvReflectionMicrosurfaceInfos,\rvReflectionInfos,\rvReflectionColor,\r#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nclearCoatNdotVUnclamped,\r#endif\n#ifdef LINEARSPECULARREFLECTION\nclearCoatRoughness,\r#endif\nreflectionSampler,\rclearCoatReflectionCoords,\r#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\rreflectionSamplerHigh,\r#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\r#endif\nenvironmentClearCoatRadiance\r);\r#if DEBUGMODE>0\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\r#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\r#ifdef RADIANCEOCCLUSION\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\rclearCoatEnvironmentReflectance*=clearCoatSeo;\r#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\rclearCoatEnvironmentReflectance*=clearCoatEho;\r#endif\n#endif\n#endif\n#else\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\r#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\r#if DEBUGMODE>0\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\r#endif\noutParams.finalClearCoatRadianceScaled=\renvironmentClearCoatRadiance.rgb *\rclearCoatEnvironmentReflectance *\rvLightingIntensity.z;\r#endif\n#if defined(CLEARCOAT_TINT)\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\r#endif\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\rfresnelIBLClearCoat*=clearCoatIntensity;\routParams.conservationFactor=(1.-fresnelIBLClearCoat);\r#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\r#endif\n}\r#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @hidden */\nexport const pbrBlockClearcoat = { name, shader };\n"]}
|