babylonjs.materials.module.d.ts 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442
  1. /// <reference types="babylonjs"/>
  2. declare module 'babylonjs-materials' {
  3. export = BABYLON;
  4. }
  5. declare module BABYLON {
  6. class ShadowOnlyMaterial extends PushMaterial {
  7. private _renderId;
  8. private _activeLight;
  9. constructor(name: string, scene: Scene);
  10. needAlphaBlending(): boolean;
  11. needAlphaTesting(): boolean;
  12. getAlphaTestTexture(): Nullable<BaseTexture>;
  13. activeLight: IShadowLight;
  14. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  15. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  16. clone(name: string): ShadowOnlyMaterial;
  17. serialize(): any;
  18. getClassName(): string;
  19. static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
  20. }
  21. }
  22. declare module BABYLON {
  23. class GradientMaterial extends PushMaterial {
  24. private _maxSimultaneousLights;
  25. maxSimultaneousLights: number;
  26. topColor: Color3;
  27. topColorAlpha: number;
  28. bottomColor: Color3;
  29. bottomColorAlpha: number;
  30. offset: number;
  31. smoothness: number;
  32. disableLighting: boolean;
  33. private _scaledDiffuse;
  34. private _renderId;
  35. constructor(name: string, scene: Scene);
  36. needAlphaBlending(): boolean;
  37. needAlphaTesting(): boolean;
  38. getAlphaTestTexture(): Nullable<BaseTexture>;
  39. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  40. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  41. getAnimatables(): IAnimatable[];
  42. dispose(forceDisposeEffect?: boolean): void;
  43. clone(name: string): GradientMaterial;
  44. serialize(): any;
  45. getClassName(): string;
  46. static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial;
  47. }
  48. }
  49. declare module BABYLON {
  50. class NormalMaterial extends PushMaterial {
  51. private _diffuseTexture;
  52. diffuseTexture: BaseTexture;
  53. diffuseColor: Color3;
  54. private _disableLighting;
  55. disableLighting: boolean;
  56. private _maxSimultaneousLights;
  57. maxSimultaneousLights: number;
  58. private _renderId;
  59. constructor(name: string, scene: Scene);
  60. needAlphaBlending(): boolean;
  61. needAlphaTesting(): boolean;
  62. getAlphaTestTexture(): Nullable<BaseTexture>;
  63. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  64. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  65. getAnimatables(): IAnimatable[];
  66. getActiveTextures(): BaseTexture[];
  67. hasTexture(texture: BaseTexture): boolean;
  68. dispose(forceDisposeEffect?: boolean): void;
  69. clone(name: string): NormalMaterial;
  70. serialize(): any;
  71. getClassName(): string;
  72. static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial;
  73. }
  74. }
  75. declare module BABYLON {
  76. class LavaMaterial extends PushMaterial {
  77. private _diffuseTexture;
  78. diffuseTexture: BaseTexture;
  79. noiseTexture: BaseTexture;
  80. fogColor: Color3;
  81. speed: number;
  82. movingSpeed: number;
  83. lowFrequencySpeed: number;
  84. fogDensity: number;
  85. private _lastTime;
  86. diffuseColor: Color3;
  87. private _disableLighting;
  88. disableLighting: boolean;
  89. private _maxSimultaneousLights;
  90. maxSimultaneousLights: number;
  91. private _scaledDiffuse;
  92. private _renderId;
  93. constructor(name: string, scene: Scene);
  94. needAlphaBlending(): boolean;
  95. needAlphaTesting(): boolean;
  96. getAlphaTestTexture(): Nullable<BaseTexture>;
  97. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  98. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  99. getAnimatables(): IAnimatable[];
  100. getActiveTextures(): BaseTexture[];
  101. hasTexture(texture: BaseTexture): boolean;
  102. dispose(forceDisposeEffect?: boolean): void;
  103. clone(name: string): LavaMaterial;
  104. serialize(): any;
  105. getClassName(): string;
  106. static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial;
  107. }
  108. }
  109. declare module BABYLON {
  110. class SimpleMaterial extends PushMaterial {
  111. private _diffuseTexture;
  112. diffuseTexture: BaseTexture;
  113. diffuseColor: Color3;
  114. private _disableLighting;
  115. disableLighting: boolean;
  116. private _maxSimultaneousLights;
  117. maxSimultaneousLights: number;
  118. private _renderId;
  119. constructor(name: string, scene: Scene);
  120. needAlphaBlending(): boolean;
  121. needAlphaTesting(): boolean;
  122. getAlphaTestTexture(): Nullable<BaseTexture>;
  123. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  124. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  125. getAnimatables(): IAnimatable[];
  126. getActiveTextures(): BaseTexture[];
  127. hasTexture(texture: BaseTexture): boolean;
  128. dispose(forceDisposeEffect?: boolean): void;
  129. clone(name: string): SimpleMaterial;
  130. serialize(): any;
  131. getClassName(): string;
  132. static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial;
  133. }
  134. }
  135. declare module BABYLON {
  136. class WaterMaterial extends PushMaterial {
  137. renderTargetSize: Vector2;
  138. private _bumpTexture;
  139. bumpTexture: BaseTexture;
  140. diffuseColor: Color3;
  141. specularColor: Color3;
  142. specularPower: number;
  143. private _disableLighting;
  144. disableLighting: boolean;
  145. private _maxSimultaneousLights;
  146. maxSimultaneousLights: number;
  147. /**
  148. * @param {number}: Represents the wind force
  149. */
  150. windForce: number;
  151. /**
  152. * @param {Vector2}: The direction of the wind in the plane (X, Z)
  153. */
  154. windDirection: Vector2;
  155. /**
  156. * @param {number}: Wave height, represents the height of the waves
  157. */
  158. waveHeight: number;
  159. /**
  160. * @param {number}: Bump height, represents the bump height related to the bump map
  161. */
  162. bumpHeight: number;
  163. /**
  164. * @param {boolean}: Add a smaller moving bump to less steady waves.
  165. */
  166. private _bumpSuperimpose;
  167. bumpSuperimpose: boolean;
  168. /**
  169. * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  170. */
  171. private _fresnelSeparate;
  172. fresnelSeparate: boolean;
  173. /**
  174. * @param {boolean}: bump Waves modify the reflection.
  175. */
  176. private _bumpAffectsReflection;
  177. bumpAffectsReflection: boolean;
  178. /**
  179. * @param {number}: The water color blended with the refraction (near)
  180. */
  181. waterColor: Color3;
  182. /**
  183. * @param {number}: The blend factor related to the water color
  184. */
  185. colorBlendFactor: number;
  186. /**
  187. * @param {number}: The water color blended with the reflection (far)
  188. */
  189. waterColor2: Color3;
  190. /**
  191. * @param {number}: The blend factor related to the water color (reflection, far)
  192. */
  193. colorBlendFactor2: number;
  194. /**
  195. * @param {number}: Represents the maximum length of a wave
  196. */
  197. waveLength: number;
  198. /**
  199. * @param {number}: Defines the waves speed
  200. */
  201. waveSpeed: number;
  202. protected _renderTargets: SmartArray<RenderTargetTexture>;
  203. private _mesh;
  204. private _refractionRTT;
  205. private _reflectionRTT;
  206. private _reflectionTransform;
  207. private _lastTime;
  208. private _lastDeltaTime;
  209. private _renderId;
  210. private _useLogarithmicDepth;
  211. /**
  212. * Constructor
  213. */
  214. constructor(name: string, scene: Scene, renderTargetSize?: Vector2);
  215. useLogarithmicDepth: boolean;
  216. readonly refractionTexture: RenderTargetTexture;
  217. readonly reflectionTexture: RenderTargetTexture;
  218. addToRenderList(node: any): void;
  219. enableRenderTargets(enable: boolean): void;
  220. getRenderList(): Nullable<AbstractMesh[]>;
  221. readonly renderTargetsEnabled: boolean;
  222. needAlphaBlending(): boolean;
  223. needAlphaTesting(): boolean;
  224. getAlphaTestTexture(): Nullable<BaseTexture>;
  225. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  226. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  227. private _createRenderTargets(scene, renderTargetSize);
  228. getAnimatables(): IAnimatable[];
  229. getActiveTextures(): BaseTexture[];
  230. hasTexture(texture: BaseTexture): boolean;
  231. dispose(forceDisposeEffect?: boolean): void;
  232. clone(name: string): WaterMaterial;
  233. serialize(): any;
  234. getClassName(): string;
  235. static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial;
  236. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  237. }
  238. }
  239. declare module BABYLON {
  240. class FireMaterial extends PushMaterial {
  241. private _diffuseTexture;
  242. diffuseTexture: Nullable<BaseTexture>;
  243. private _distortionTexture;
  244. distortionTexture: Nullable<BaseTexture>;
  245. private _opacityTexture;
  246. opacityTexture: Nullable<BaseTexture>;
  247. diffuseColor: Color3;
  248. speed: number;
  249. private _scaledDiffuse;
  250. private _renderId;
  251. private _lastTime;
  252. constructor(name: string, scene: Scene);
  253. needAlphaBlending(): boolean;
  254. needAlphaTesting(): boolean;
  255. getAlphaTestTexture(): Nullable<BaseTexture>;
  256. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  257. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  258. getAnimatables(): IAnimatable[];
  259. getActiveTextures(): BaseTexture[];
  260. hasTexture(texture: BaseTexture): boolean;
  261. getClassName(): string;
  262. dispose(forceDisposeEffect?: boolean): void;
  263. clone(name: string): FireMaterial;
  264. serialize(): any;
  265. static Parse(source: any, scene: Scene, rootUrl: string): FireMaterial;
  266. }
  267. }
  268. declare module BABYLON {
  269. class FurMaterial extends PushMaterial {
  270. private _diffuseTexture;
  271. diffuseTexture: BaseTexture;
  272. private _heightTexture;
  273. heightTexture: BaseTexture;
  274. diffuseColor: Color3;
  275. furLength: number;
  276. furAngle: number;
  277. furColor: Color3;
  278. furOffset: number;
  279. furSpacing: number;
  280. furGravity: Vector3;
  281. furSpeed: number;
  282. furDensity: number;
  283. furTexture: DynamicTexture;
  284. private _disableLighting;
  285. disableLighting: boolean;
  286. private _maxSimultaneousLights;
  287. maxSimultaneousLights: number;
  288. highLevelFur: boolean;
  289. _meshes: AbstractMesh[];
  290. private _renderId;
  291. private _furTime;
  292. constructor(name: string, scene: Scene);
  293. furTime: number;
  294. needAlphaBlending(): boolean;
  295. needAlphaTesting(): boolean;
  296. getAlphaTestTexture(): Nullable<BaseTexture>;
  297. updateFur(): void;
  298. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  299. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  300. getAnimatables(): IAnimatable[];
  301. getActiveTextures(): BaseTexture[];
  302. hasTexture(texture: BaseTexture): boolean;
  303. dispose(forceDisposeEffect?: boolean): void;
  304. clone(name: string): FurMaterial;
  305. serialize(): any;
  306. getClassName(): string;
  307. static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial;
  308. static GenerateTexture(name: string, scene: Scene): DynamicTexture;
  309. static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[];
  310. }
  311. }
  312. declare module BABYLON {
  313. class TerrainMaterial extends PushMaterial {
  314. private _mixTexture;
  315. mixTexture: BaseTexture;
  316. private _diffuseTexture1;
  317. diffuseTexture1: Texture;
  318. private _diffuseTexture2;
  319. diffuseTexture2: Texture;
  320. private _diffuseTexture3;
  321. diffuseTexture3: Texture;
  322. private _bumpTexture1;
  323. bumpTexture1: Texture;
  324. private _bumpTexture2;
  325. bumpTexture2: Texture;
  326. private _bumpTexture3;
  327. bumpTexture3: Texture;
  328. diffuseColor: Color3;
  329. specularColor: Color3;
  330. specularPower: number;
  331. private _disableLighting;
  332. disableLighting: boolean;
  333. private _maxSimultaneousLights;
  334. maxSimultaneousLights: number;
  335. private _renderId;
  336. constructor(name: string, scene: Scene);
  337. needAlphaBlending(): boolean;
  338. needAlphaTesting(): boolean;
  339. getAlphaTestTexture(): Nullable<BaseTexture>;
  340. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  341. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  342. getAnimatables(): IAnimatable[];
  343. getActiveTextures(): BaseTexture[];
  344. hasTexture(texture: BaseTexture): boolean;
  345. dispose(forceDisposeEffect?: boolean): void;
  346. clone(name: string): TerrainMaterial;
  347. serialize(): any;
  348. getClassName(): string;
  349. static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial;
  350. }
  351. }
  352. declare module BABYLON {
  353. class TriPlanarMaterial extends PushMaterial {
  354. mixTexture: BaseTexture;
  355. private _diffuseTextureX;
  356. diffuseTextureX: BaseTexture;
  357. private _diffuseTextureY;
  358. diffuseTextureY: BaseTexture;
  359. private _diffuseTextureZ;
  360. diffuseTextureZ: BaseTexture;
  361. private _normalTextureX;
  362. normalTextureX: BaseTexture;
  363. private _normalTextureY;
  364. normalTextureY: BaseTexture;
  365. private _normalTextureZ;
  366. normalTextureZ: BaseTexture;
  367. tileSize: number;
  368. diffuseColor: Color3;
  369. specularColor: Color3;
  370. specularPower: number;
  371. private _disableLighting;
  372. disableLighting: boolean;
  373. private _maxSimultaneousLights;
  374. maxSimultaneousLights: number;
  375. private _renderId;
  376. constructor(name: string, scene: Scene);
  377. needAlphaBlending(): boolean;
  378. needAlphaTesting(): boolean;
  379. getAlphaTestTexture(): Nullable<BaseTexture>;
  380. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  381. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  382. getAnimatables(): IAnimatable[];
  383. getActiveTextures(): BaseTexture[];
  384. hasTexture(texture: BaseTexture): boolean;
  385. dispose(forceDisposeEffect?: boolean): void;
  386. clone(name: string): TriPlanarMaterial;
  387. serialize(): any;
  388. getClassName(): string;
  389. static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial;
  390. }
  391. }
  392. declare module BABYLON {
  393. class SkyMaterial extends PushMaterial {
  394. luminance: number;
  395. turbidity: number;
  396. rayleigh: number;
  397. mieCoefficient: number;
  398. mieDirectionalG: number;
  399. distance: number;
  400. inclination: number;
  401. azimuth: number;
  402. sunPosition: Vector3;
  403. useSunPosition: boolean;
  404. private _cameraPosition;
  405. private _renderId;
  406. constructor(name: string, scene: Scene);
  407. needAlphaBlending(): boolean;
  408. needAlphaTesting(): boolean;
  409. getAlphaTestTexture(): Nullable<BaseTexture>;
  410. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  411. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  412. getAnimatables(): IAnimatable[];
  413. dispose(forceDisposeEffect?: boolean): void;
  414. clone(name: string): SkyMaterial;
  415. serialize(): any;
  416. getClassName(): string;
  417. static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial;
  418. }
  419. }
  420. declare module BABYLON {
  421. /**
  422. * The grid materials allows you to wrap any shape with a grid.
  423. * Colors are customizable.
  424. */
  425. class GridMaterial extends BABYLON.PushMaterial {
  426. /**
  427. * Main color of the grid (e.g. between lines)
  428. */
  429. mainColor: Color3;
  430. /**
  431. * Color of the grid lines.
  432. */
  433. lineColor: Color3;
  434. /**
  435. * The scale of the grid compared to unit.
  436. */
  437. gridRatio: number;
  438. /**
  439. * Allows setting an offset for the grid lines.
  440. */
  441. gridOffset: Vector3;
  442. /**
  443. * The frequency of thicker lines.
  444. */
  445. majorUnitFrequency: number;
  446. /**
  447. * The visibility of minor units in the grid.
  448. */
  449. minorUnitVisibility: number;
  450. /**
  451. * The grid opacity outside of the lines.
  452. */
  453. opacity: number;
  454. /**
  455. * Determine RBG output is premultiplied by alpha value.
  456. */
  457. preMultiplyAlpha: boolean;
  458. private _gridControl;
  459. private _renderId;
  460. /**
  461. * constructor
  462. * @param name The name given to the material in order to identify it afterwards.
  463. * @param scene The scene the material is used in.
  464. */
  465. constructor(name: string, scene: Scene);
  466. /**
  467. * Returns wehter or not the grid requires alpha blending.
  468. */
  469. needAlphaBlending(): boolean;
  470. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  471. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  472. dispose(forceDisposeEffect?: boolean): void;
  473. clone(name: string): GridMaterial;
  474. serialize(): any;
  475. getClassName(): string;
  476. static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial;
  477. }
  478. }
  479. declare module BABYLON {
  480. class StandardMaterialDefines_OldVer extends MaterialDefines implements IImageProcessingConfigurationDefines {
  481. DIFFUSE: boolean;
  482. AMBIENT: boolean;
  483. OPACITY: boolean;
  484. OPACITYRGB: boolean;
  485. REFLECTION: boolean;
  486. EMISSIVE: boolean;
  487. SPECULAR: boolean;
  488. BUMP: boolean;
  489. PARALLAX: boolean;
  490. PARALLAXOCCLUSION: boolean;
  491. SPECULAROVERALPHA: boolean;
  492. CLIPPLANE: boolean;
  493. ALPHATEST: boolean;
  494. ALPHAFROMDIFFUSE: boolean;
  495. POINTSIZE: boolean;
  496. FOG: boolean;
  497. SPECULARTERM: boolean;
  498. DIFFUSEFRESNEL: boolean;
  499. OPACITYFRESNEL: boolean;
  500. REFLECTIONFRESNEL: boolean;
  501. REFRACTIONFRESNEL: boolean;
  502. EMISSIVEFRESNEL: boolean;
  503. FRESNEL: boolean;
  504. NORMAL: boolean;
  505. UV1: boolean;
  506. UV2: boolean;
  507. VERTEXCOLOR: boolean;
  508. VERTEXALPHA: boolean;
  509. NUM_BONE_INFLUENCERS: number;
  510. BonesPerMesh: number;
  511. INSTANCES: boolean;
  512. GLOSSINESS: boolean;
  513. ROUGHNESS: boolean;
  514. EMISSIVEASILLUMINATION: boolean;
  515. LINKEMISSIVEWITHDIFFUSE: boolean;
  516. REFLECTIONFRESNELFROMSPECULAR: boolean;
  517. LIGHTMAP: boolean;
  518. USELIGHTMAPASSHADOWMAP: boolean;
  519. REFLECTIONMAP_3D: boolean;
  520. REFLECTIONMAP_SPHERICAL: boolean;
  521. REFLECTIONMAP_PLANAR: boolean;
  522. REFLECTIONMAP_CUBIC: boolean;
  523. REFLECTIONMAP_PROJECTION: boolean;
  524. REFLECTIONMAP_SKYBOX: boolean;
  525. REFLECTIONMAP_EXPLICIT: boolean;
  526. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  527. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  528. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  529. INVERTCUBICMAP: boolean;
  530. LOGARITHMICDEPTH: boolean;
  531. REFRACTION: boolean;
  532. REFRACTIONMAP_3D: boolean;
  533. REFLECTIONOVERALPHA: boolean;
  534. TWOSIDEDLIGHTING: boolean;
  535. SHADOWFLOAT: boolean;
  536. MORPHTARGETS: boolean;
  537. MORPHTARGETS_NORMAL: boolean;
  538. MORPHTARGETS_TANGENT: boolean;
  539. NUM_MORPH_INFLUENCERS: number;
  540. IMAGEPROCESSING: boolean;
  541. VIGNETTE: boolean;
  542. VIGNETTEBLENDMODEMULTIPLY: boolean;
  543. VIGNETTEBLENDMODEOPAQUE: boolean;
  544. TONEMAPPING: boolean;
  545. CONTRAST: boolean;
  546. COLORCURVES: boolean;
  547. COLORGRADING: boolean;
  548. COLORGRADING3D: boolean;
  549. SAMPLER3DGREENDEPTH: boolean;
  550. SAMPLER3DBGRMAP: boolean;
  551. IMAGEPROCESSINGPOSTPROCESS: boolean;
  552. EXPOSURE: boolean;
  553. constructor();
  554. setReflectionMode(modeToEnable: string): void;
  555. }
  556. class StandardMaterial_OldVer extends PushMaterial {
  557. private _diffuseTexture;
  558. diffuseTexture: BaseTexture;
  559. private _ambientTexture;
  560. ambientTexture: BaseTexture;
  561. private _opacityTexture;
  562. opacityTexture: BaseTexture;
  563. private _reflectionTexture;
  564. reflectionTexture: BaseTexture;
  565. private _emissiveTexture;
  566. emissiveTexture: BaseTexture;
  567. private _specularTexture;
  568. specularTexture: BaseTexture;
  569. private _bumpTexture;
  570. bumpTexture: BaseTexture;
  571. private _lightmapTexture;
  572. lightmapTexture: BaseTexture;
  573. private _refractionTexture;
  574. refractionTexture: BaseTexture;
  575. ambientColor: Color3;
  576. diffuseColor: Color3;
  577. specularColor: Color3;
  578. emissiveColor: Color3;
  579. specularPower: number;
  580. private _useAlphaFromDiffuseTexture;
  581. useAlphaFromDiffuseTexture: boolean;
  582. private _useEmissiveAsIllumination;
  583. useEmissiveAsIllumination: boolean;
  584. private _linkEmissiveWithDiffuse;
  585. linkEmissiveWithDiffuse: boolean;
  586. private _useSpecularOverAlpha;
  587. useSpecularOverAlpha: boolean;
  588. private _useReflectionOverAlpha;
  589. useReflectionOverAlpha: boolean;
  590. private _disableLighting;
  591. disableLighting: boolean;
  592. private _useParallax;
  593. useParallax: boolean;
  594. private _useParallaxOcclusion;
  595. useParallaxOcclusion: boolean;
  596. parallaxScaleBias: number;
  597. private _roughness;
  598. roughness: number;
  599. indexOfRefraction: number;
  600. invertRefractionY: boolean;
  601. private _useLightmapAsShadowmap;
  602. useLightmapAsShadowmap: boolean;
  603. private _diffuseFresnelParameters;
  604. diffuseFresnelParameters: FresnelParameters;
  605. private _opacityFresnelParameters;
  606. opacityFresnelParameters: FresnelParameters;
  607. private _reflectionFresnelParameters;
  608. reflectionFresnelParameters: FresnelParameters;
  609. private _refractionFresnelParameters;
  610. refractionFresnelParameters: FresnelParameters;
  611. private _emissiveFresnelParameters;
  612. emissiveFresnelParameters: FresnelParameters;
  613. private _useReflectionFresnelFromSpecular;
  614. useReflectionFresnelFromSpecular: boolean;
  615. private _useGlossinessFromSpecularMapAlpha;
  616. useGlossinessFromSpecularMapAlpha: boolean;
  617. private _maxSimultaneousLights;
  618. maxSimultaneousLights: number;
  619. /**
  620. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  621. */
  622. private _invertNormalMapX;
  623. invertNormalMapX: boolean;
  624. /**
  625. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  626. */
  627. private _invertNormalMapY;
  628. invertNormalMapY: boolean;
  629. /**
  630. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  631. */
  632. private _twoSidedLighting;
  633. twoSidedLighting: boolean;
  634. /**
  635. * Default configuration related to image processing available in the standard Material.
  636. */
  637. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  638. /**
  639. * Gets the image processing configuration used either in this material.
  640. */
  641. /**
  642. * Sets the Default image processing configuration used either in the this material.
  643. *
  644. * If sets to null, the scene one is in use.
  645. */
  646. imageProcessingConfiguration: ImageProcessingConfiguration;
  647. /**
  648. * Keep track of the image processing observer to allow dispose and replace.
  649. */
  650. private _imageProcessingObserver;
  651. /**
  652. * Attaches a new image processing configuration to the Standard Material.
  653. * @param configuration
  654. */
  655. protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
  656. /**
  657. * Gets wether the color curves effect is enabled.
  658. */
  659. /**
  660. * Sets wether the color curves effect is enabled.
  661. */
  662. cameraColorCurvesEnabled: boolean;
  663. /**
  664. * Gets wether the color grading effect is enabled.
  665. */
  666. /**
  667. * Gets wether the color grading effect is enabled.
  668. */
  669. cameraColorGradingEnabled: boolean;
  670. /**
  671. * Gets wether tonemapping is enabled or not.
  672. */
  673. /**
  674. * Sets wether tonemapping is enabled or not
  675. */
  676. cameraToneMappingEnabled: boolean;
  677. /**
  678. * The camera exposure used on this material.
  679. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  680. * This corresponds to a photographic exposure.
  681. */
  682. /**
  683. * The camera exposure used on this material.
  684. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  685. * This corresponds to a photographic exposure.
  686. */
  687. cameraExposure: number;
  688. /**
  689. * Gets The camera contrast used on this material.
  690. */
  691. /**
  692. * Sets The camera contrast used on this material.
  693. */
  694. cameraContrast: number;
  695. /**
  696. * Gets the Color Grading 2D Lookup Texture.
  697. */
  698. /**
  699. * Sets the Color Grading 2D Lookup Texture.
  700. */
  701. cameraColorGradingTexture: Nullable<BaseTexture>;
  702. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer) => string;
  703. protected _renderTargets: SmartArray<RenderTargetTexture>;
  704. protected _worldViewProjectionMatrix: Matrix;
  705. protected _globalAmbientColor: Color3;
  706. protected _useLogarithmicDepth: boolean;
  707. constructor(name: string, scene: Scene);
  708. getClassName(): string;
  709. useLogarithmicDepth: boolean;
  710. needAlphaBlending(): boolean;
  711. needAlphaTesting(): boolean;
  712. protected _shouldUseAlphaFromDiffuseTexture(): boolean;
  713. getAlphaTestTexture(): BaseTexture;
  714. /**
  715. * Child classes can use it to update shaders
  716. */
  717. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  718. buildUniformLayout(): void;
  719. unbind(): void;
  720. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  721. getAnimatables(): IAnimatable[];
  722. getActiveTextures(): BaseTexture[];
  723. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  724. clone(name: string): StandardMaterial_OldVer;
  725. serialize(): any;
  726. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial_OldVer;
  727. static _DiffuseTextureEnabled: boolean;
  728. static DiffuseTextureEnabled: boolean;
  729. static _AmbientTextureEnabled: boolean;
  730. static AmbientTextureEnabled: boolean;
  731. static _OpacityTextureEnabled: boolean;
  732. static OpacityTextureEnabled: boolean;
  733. static _ReflectionTextureEnabled: boolean;
  734. static ReflectionTextureEnabled: boolean;
  735. static _EmissiveTextureEnabled: boolean;
  736. static EmissiveTextureEnabled: boolean;
  737. static _SpecularTextureEnabled: boolean;
  738. static SpecularTextureEnabled: boolean;
  739. static _BumpTextureEnabled: boolean;
  740. static BumpTextureEnabled: boolean;
  741. static _LightmapTextureEnabled: boolean;
  742. static LightmapTextureEnabled: boolean;
  743. static _RefractionTextureEnabled: boolean;
  744. static RefractionTextureEnabled: boolean;
  745. static _ColorGradingTextureEnabled: boolean;
  746. static ColorGradingTextureEnabled: boolean;
  747. static _FresnelEnabled: boolean;
  748. static FresnelEnabled: boolean;
  749. }
  750. class CustomShaderStructure {
  751. FragmentStore: string;
  752. VertexStore: string;
  753. constructor();
  754. }
  755. class ShaderSpecialParts {
  756. constructor();
  757. Fragment_Begin: string;
  758. Fragment_Definitions: string;
  759. Fragment_MainBegin: string;
  760. Fragment_Custom_Diffuse: string;
  761. Fragment_Custom_Alpha: string;
  762. Fragment_Before_FragColor: string;
  763. Vertex_Begin: string;
  764. Vertex_Definitions: string;
  765. Vertex_MainBegin: string;
  766. Vertex_Before_PositionUpdated: string;
  767. Vertex_Before_NormalUpdated: string;
  768. }
  769. class ShaderForVer3_0 extends CustomShaderStructure {
  770. constructor();
  771. }
  772. class StandardShaderVersions {
  773. static Ver3_0: string;
  774. }
  775. class CustomMaterial extends StandardMaterial_OldVer {
  776. static ShaderIndexer: number;
  777. CustomParts: ShaderSpecialParts;
  778. ShaderVersion: CustomShaderStructure;
  779. _isCreatedShader: boolean;
  780. _createdShaderName: string;
  781. _customUniform: string[];
  782. _newUniforms: string[];
  783. _newUniformInstances: any[];
  784. _newSamplerInstances: Texture[];
  785. AttachAfterBind(mesh: Mesh, effect: Effect): void;
  786. ReviewUniform(name: string, arr: string[]): string[];
  787. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer): string;
  788. SelectVersion(ver: string): void;
  789. constructor(name: string, scene: Scene);
  790. AddUniform(name: string, kind: string, param: any): CustomMaterial;
  791. Fragment_Begin(shaderPart: string): CustomMaterial;
  792. Fragment_Definitions(shaderPart: string): CustomMaterial;
  793. Fragment_MainBegin(shaderPart: string): CustomMaterial;
  794. Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
  795. Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
  796. Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
  797. Vertex_Begin(shaderPart: string): CustomMaterial;
  798. Vertex_Definitions(shaderPart: string): CustomMaterial;
  799. Vertex_MainBegin(shaderPart: string): CustomMaterial;
  800. Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
  801. Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
  802. }
  803. }
  804. declare module BABYLON {
  805. class CellMaterial extends PushMaterial {
  806. private _diffuseTexture;
  807. diffuseTexture: BaseTexture;
  808. diffuseColor: Color3;
  809. _computeHighLevel: boolean;
  810. computeHighLevel: boolean;
  811. private _disableLighting;
  812. disableLighting: boolean;
  813. private _maxSimultaneousLights;
  814. maxSimultaneousLights: number;
  815. private _renderId;
  816. constructor(name: string, scene: Scene);
  817. needAlphaBlending(): boolean;
  818. needAlphaTesting(): boolean;
  819. getAlphaTestTexture(): Nullable<BaseTexture>;
  820. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  821. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  822. getAnimatables(): IAnimatable[];
  823. getActiveTextures(): BaseTexture[];
  824. hasTexture(texture: BaseTexture): boolean;
  825. dispose(forceDisposeEffect?: boolean): void;
  826. getClassName(): string;
  827. clone(name: string): CellMaterial;
  828. serialize(): any;
  829. static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial;
  830. }
  831. }
  832. declare module BABYLON {
  833. /**
  834. * The Physically based material of BJS.
  835. *
  836. * This offers the main features of a standard PBR material.
  837. * For more information, please refer to the documentation :
  838. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  839. */
  840. class LegacyPBRMaterial extends BABYLON.Material {
  841. /**
  842. * Intensity of the direct lights e.g. the four lights available in your scene.
  843. * This impacts both the direct diffuse and specular highlights.
  844. */
  845. directIntensity: number;
  846. /**
  847. * Intensity of the emissive part of the material.
  848. * This helps controlling the emissive effect without modifying the emissive color.
  849. */
  850. emissiveIntensity: number;
  851. /**
  852. * Intensity of the environment e.g. how much the environment will light the object
  853. * either through harmonics for rough material or through the refelction for shiny ones.
  854. */
  855. environmentIntensity: number;
  856. /**
  857. * This is a special control allowing the reduction of the specular highlights coming from the
  858. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  859. */
  860. specularIntensity: number;
  861. private _lightingInfos;
  862. /**
  863. * Debug Control allowing disabling the bump map on this material.
  864. */
  865. disableBumpMap: boolean;
  866. /**
  867. * Debug Control helping enforcing or dropping the darkness of shadows.
  868. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  869. */
  870. overloadedShadowIntensity: number;
  871. /**
  872. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  873. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  874. */
  875. overloadedShadeIntensity: number;
  876. private _overloadedShadowInfos;
  877. /**
  878. * The camera exposure used on this material.
  879. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  880. * This corresponds to a photographic exposure.
  881. */
  882. cameraExposure: number;
  883. /**
  884. * The camera contrast used on this material.
  885. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  886. */
  887. cameraContrast: number;
  888. /**
  889. * Color Grading 2D Lookup Texture.
  890. * This allows special effects like sepia, black and white to sixties rendering style.
  891. */
  892. cameraColorGradingTexture: Nullable<BaseTexture>;
  893. /**
  894. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  895. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  896. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  897. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  898. */
  899. cameraColorCurves: Nullable<ColorCurves>;
  900. private _cameraInfos;
  901. private _microsurfaceTextureLods;
  902. /**
  903. * Debug Control allowing to overload the ambient color.
  904. * This as to be use with the overloadedAmbientIntensity parameter.
  905. */
  906. overloadedAmbient: Color3;
  907. /**
  908. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  909. */
  910. overloadedAmbientIntensity: number;
  911. /**
  912. * Debug Control allowing to overload the albedo color.
  913. * This as to be use with the overloadedAlbedoIntensity parameter.
  914. */
  915. overloadedAlbedo: Color3;
  916. /**
  917. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  918. */
  919. overloadedAlbedoIntensity: number;
  920. /**
  921. * Debug Control allowing to overload the reflectivity color.
  922. * This as to be use with the overloadedReflectivityIntensity parameter.
  923. */
  924. overloadedReflectivity: Color3;
  925. /**
  926. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  927. */
  928. overloadedReflectivityIntensity: number;
  929. /**
  930. * Debug Control allowing to overload the emissive color.
  931. * This as to be use with the overloadedEmissiveIntensity parameter.
  932. */
  933. overloadedEmissive: Color3;
  934. /**
  935. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  936. */
  937. overloadedEmissiveIntensity: number;
  938. private _overloadedIntensity;
  939. /**
  940. * Debug Control allowing to overload the reflection color.
  941. * This as to be use with the overloadedReflectionIntensity parameter.
  942. */
  943. overloadedReflection: Color3;
  944. /**
  945. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  946. */
  947. overloadedReflectionIntensity: number;
  948. /**
  949. * Debug Control allowing to overload the microsurface.
  950. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  951. */
  952. overloadedMicroSurface: number;
  953. /**
  954. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  955. */
  956. overloadedMicroSurfaceIntensity: number;
  957. private _overloadedMicroSurface;
  958. /**
  959. * AKA Diffuse Texture in standard nomenclature.
  960. */
  961. albedoTexture: BaseTexture;
  962. /**
  963. * AKA Occlusion Texture in other nomenclature.
  964. */
  965. ambientTexture: BaseTexture;
  966. /**
  967. * AKA Occlusion Texture Intensity in other nomenclature.
  968. */
  969. ambientTextureStrength: number;
  970. opacityTexture: BaseTexture;
  971. reflectionTexture: BaseTexture;
  972. emissiveTexture: BaseTexture;
  973. /**
  974. * AKA Specular texture in other nomenclature.
  975. */
  976. reflectivityTexture: BaseTexture;
  977. /**
  978. * Used to switch from specular/glossiness to metallic/roughness workflow.
  979. */
  980. metallicTexture: BaseTexture;
  981. /**
  982. * Specifies the metallic scalar of the metallic/roughness workflow.
  983. * Can also be used to scale the metalness values of the metallic texture.
  984. */
  985. metallic: number;
  986. /**
  987. * Specifies the roughness scalar of the metallic/roughness workflow.
  988. * Can also be used to scale the roughness values of the metallic texture.
  989. */
  990. roughness: number;
  991. /**
  992. * Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode.
  993. * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
  994. */
  995. microSurfaceTexture: BaseTexture;
  996. bumpTexture: BaseTexture;
  997. lightmapTexture: BaseTexture;
  998. refractionTexture: BaseTexture;
  999. ambientColor: Color3;
  1000. /**
  1001. * AKA Diffuse Color in other nomenclature.
  1002. */
  1003. albedoColor: Color3;
  1004. /**
  1005. * AKA Specular Color in other nomenclature.
  1006. */
  1007. reflectivityColor: Color3;
  1008. reflectionColor: Color3;
  1009. emissiveColor: Color3;
  1010. /**
  1011. * AKA Glossiness in other nomenclature.
  1012. */
  1013. microSurface: number;
  1014. /**
  1015. * source material index of refraction (IOR)' / 'destination material IOR.
  1016. */
  1017. indexOfRefraction: number;
  1018. /**
  1019. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  1020. */
  1021. invertRefractionY: boolean;
  1022. opacityFresnelParameters: FresnelParameters;
  1023. emissiveFresnelParameters: FresnelParameters;
  1024. /**
  1025. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  1026. * Materials half opaque for instance using refraction could benefit from this control.
  1027. */
  1028. linkRefractionWithTransparency: boolean;
  1029. /**
  1030. * The emissive and albedo are linked to never be more than one (Energy conservation).
  1031. */
  1032. linkEmissiveWithAlbedo: boolean;
  1033. useLightmapAsShadowmap: boolean;
  1034. /**
  1035. * In this mode, the emissive informtaion will always be added to the lighting once.
  1036. * A light for instance can be thought as emissive.
  1037. */
  1038. useEmissiveAsIllumination: boolean;
  1039. /**
  1040. * Secifies that the alpha is coming form the albedo channel alpha channel.
  1041. */
  1042. useAlphaFromAlbedoTexture: boolean;
  1043. /**
  1044. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  1045. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  1046. */
  1047. useSpecularOverAlpha: boolean;
  1048. /**
  1049. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  1050. */
  1051. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  1052. /**
  1053. * Specifies if the metallic texture contains the roughness information in its alpha channel.
  1054. */
  1055. useRoughnessFromMetallicTextureAlpha: boolean;
  1056. /**
  1057. * Specifies if the metallic texture contains the roughness information in its green channel.
  1058. */
  1059. useRoughnessFromMetallicTextureGreen: boolean;
  1060. /**
  1061. * Specifies if the metallic texture contains the metallness information in its blue channel.
  1062. */
  1063. useMetallnessFromMetallicTextureBlue: boolean;
  1064. /**
  1065. * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
  1066. */
  1067. useAmbientOcclusionFromMetallicTextureRed: boolean;
  1068. /**
  1069. * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
  1070. */
  1071. useAmbientInGrayScale: boolean;
  1072. /**
  1073. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  1074. * The material will try to infer what glossiness each pixel should be.
  1075. */
  1076. useAutoMicroSurfaceFromReflectivityMap: boolean;
  1077. /**
  1078. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  1079. * the creation of the material.
  1080. */
  1081. useScalarInLinearSpace: boolean;
  1082. /**
  1083. * BJS is using an harcoded light falloff based on a manually sets up range.
  1084. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  1085. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  1086. */
  1087. usePhysicalLightFalloff: boolean;
  1088. /**
  1089. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  1090. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  1091. */
  1092. useRadianceOverAlpha: boolean;
  1093. /**
  1094. * Allows using the bump map in parallax mode.
  1095. */
  1096. useParallax: boolean;
  1097. /**
  1098. * Allows using the bump map in parallax occlusion mode.
  1099. */
  1100. useParallaxOcclusion: boolean;
  1101. /**
  1102. * Controls the scale bias of the parallax mode.
  1103. */
  1104. parallaxScaleBias: number;
  1105. /**
  1106. * If sets to true, disables all the lights affecting the material.
  1107. */
  1108. disableLighting: boolean;
  1109. /**
  1110. * Number of Simultaneous lights allowed on the material.
  1111. */
  1112. maxSimultaneousLights: number;
  1113. /**
  1114. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  1115. */
  1116. invertNormalMapX: boolean;
  1117. /**
  1118. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  1119. */
  1120. invertNormalMapY: boolean;
  1121. /**
  1122. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  1123. */
  1124. twoSidedLighting: boolean;
  1125. private _renderTargets;
  1126. private _globalAmbientColor;
  1127. private _tempColor;
  1128. private _renderId;
  1129. private _defines;
  1130. private _cachedDefines;
  1131. private _useLogarithmicDepth;
  1132. /**
  1133. * Instantiates a new PBRMaterial instance.
  1134. *
  1135. * @param name The material name
  1136. * @param scene The scene the material will be use in.
  1137. */
  1138. constructor(name: string, scene: Scene);
  1139. getClassName(): string;
  1140. useLogarithmicDepth: boolean;
  1141. needAlphaBlending(): boolean;
  1142. needAlphaTesting(): boolean;
  1143. private _shouldUseAlphaFromAlbedoTexture();
  1144. getAlphaTestTexture(): BaseTexture;
  1145. private _checkCache(scene, mesh?, useInstances?);
  1146. private convertColorToLinearSpaceToRef(color, ref);
  1147. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  1148. private static _scaledAlbedo;
  1149. private static _scaledReflectivity;
  1150. private static _scaledEmissive;
  1151. private static _scaledReflection;
  1152. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
  1153. isReady(mesh?: Nullable<AbstractMesh>, useInstances?: boolean): boolean;
  1154. buildUniformLayout(): void;
  1155. unbind(): void;
  1156. bindOnlyWorldMatrix(world: Matrix): void;
  1157. private _myScene;
  1158. bind(world: Matrix, mesh?: Mesh): void;
  1159. getAnimatables(): IAnimatable[];
  1160. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  1161. clone(name: string): LegacyPBRMaterial;
  1162. serialize(): any;
  1163. static Parse(source: any, scene: Scene, rootUrl: string): LegacyPBRMaterial;
  1164. }
  1165. }
  1166. declare namespace BABYLON {
  1167. /**
  1168. * Background material
  1169. */
  1170. class BackgroundMaterial extends BABYLON.PushMaterial {
  1171. /**
  1172. * Key light Color (multiply against the R channel of the environement texture)
  1173. */
  1174. protected _primaryColor: Color3;
  1175. primaryColor: Color3;
  1176. /**
  1177. * Key light Level (allowing HDR output of the background)
  1178. */
  1179. protected _primaryLevel: float;
  1180. primaryLevel: float;
  1181. /**
  1182. * Secondary light Color (multiply against the G channel of the environement texture)
  1183. */
  1184. protected _secondaryColor: Color3;
  1185. secondaryColor: Color3;
  1186. /**
  1187. * Secondary light Level (allowing HDR output of the background)
  1188. */
  1189. protected _secondaryLevel: float;
  1190. secondaryLevel: float;
  1191. /**
  1192. * Third light Color (multiply against the B channel of the environement texture)
  1193. */
  1194. protected _thirdColor: Color3;
  1195. thirdColor: Color3;
  1196. /**
  1197. * Third light Level (allowing HDR output of the background)
  1198. */
  1199. protected _thirdLevel: float;
  1200. thirdLevel: float;
  1201. /**
  1202. * Reflection Texture used in the material.
  1203. * Should be author in a specific way for the best result (refer to the documentation).
  1204. */
  1205. protected _reflectionTexture: Nullable<BaseTexture>;
  1206. reflectionTexture: Nullable<BaseTexture>;
  1207. /**
  1208. * Reflection Texture level of blur.
  1209. *
  1210. * Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the
  1211. * texture twice.
  1212. */
  1213. protected _reflectionBlur: float;
  1214. reflectionBlur: float;
  1215. /**
  1216. * Diffuse Texture used in the material.
  1217. * Should be author in a specific way for the best result (refer to the documentation).
  1218. */
  1219. protected _diffuseTexture: Nullable<BaseTexture>;
  1220. diffuseTexture: Nullable<BaseTexture>;
  1221. /**
  1222. * Specify the list of lights casting shadow on the material.
  1223. * All scene shadow lights will be included if null.
  1224. */
  1225. protected _shadowLights: Nullable<IShadowLight[]>;
  1226. shadowLights: Nullable<IShadowLight[]>;
  1227. /**
  1228. * For the lights having a blurred shadow generator, this can add a second blur pass in order to reach
  1229. * soft lighting on the background.
  1230. */
  1231. protected _shadowBlurScale: int;
  1232. shadowBlurScale: int;
  1233. /**
  1234. * Helps adjusting the shadow to a softer level if required.
  1235. * 0 means black shadows and 1 means no shadows.
  1236. */
  1237. protected _shadowLevel: float;
  1238. shadowLevel: float;
  1239. /**
  1240. * This helps specifying that the material is falling off to the sky box at grazing angle.
  1241. * This helps ensuring a nice transition when the camera goes under the ground.
  1242. */
  1243. protected _opacityFresnel: boolean;
  1244. opacityFresnel: boolean;
  1245. /**
  1246. * Helps to directly use the maps channels instead of their level.
  1247. */
  1248. protected _useRGBColor: boolean;
  1249. useRGBColor: boolean;
  1250. /**
  1251. * Number of Simultaneous lights allowed on the material.
  1252. */
  1253. private _maxSimultaneousLights;
  1254. maxSimultaneousLights: int;
  1255. /**
  1256. * Default configuration related to image processing available in the Background Material.
  1257. */
  1258. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  1259. /**
  1260. * Keep track of the image processing observer to allow dispose and replace.
  1261. */
  1262. private _imageProcessingObserver;
  1263. /**
  1264. * Attaches a new image processing configuration to the PBR Material.
  1265. * @param configuration (if null the scene configuration will be use)
  1266. */
  1267. protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
  1268. /**
  1269. * Gets the image processing configuration used either in this material.
  1270. */
  1271. /**
  1272. * Sets the Default image processing configuration used either in the this material.
  1273. *
  1274. * If sets to null, the scene one is in use.
  1275. */
  1276. imageProcessingConfiguration: Nullable<ImageProcessingConfiguration>;
  1277. /**
  1278. * Gets wether the color curves effect is enabled.
  1279. */
  1280. /**
  1281. * Sets wether the color curves effect is enabled.
  1282. */
  1283. cameraColorCurvesEnabled: boolean;
  1284. /**
  1285. * Gets wether the color grading effect is enabled.
  1286. */
  1287. /**
  1288. * Gets wether the color grading effect is enabled.
  1289. */
  1290. cameraColorGradingEnabled: boolean;
  1291. /**
  1292. * Gets wether tonemapping is enabled or not.
  1293. */
  1294. /**
  1295. * Sets wether tonemapping is enabled or not
  1296. */
  1297. cameraToneMappingEnabled: boolean;
  1298. /**
  1299. * The camera exposure used on this material.
  1300. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  1301. * This corresponds to a photographic exposure.
  1302. */
  1303. /**
  1304. * The camera exposure used on this material.
  1305. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  1306. * This corresponds to a photographic exposure.
  1307. */
  1308. cameraExposure: float;
  1309. /**
  1310. * Gets The camera contrast used on this material.
  1311. */
  1312. /**
  1313. * Sets The camera contrast used on this material.
  1314. */
  1315. cameraContrast: float;
  1316. /**
  1317. * Gets the Color Grading 2D Lookup Texture.
  1318. */
  1319. /**
  1320. * Sets the Color Grading 2D Lookup Texture.
  1321. */
  1322. cameraColorGradingTexture: Nullable<BaseTexture>;
  1323. /**
  1324. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  1325. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  1326. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  1327. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  1328. */
  1329. /**
  1330. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  1331. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  1332. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  1333. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  1334. */
  1335. cameraColorCurves: Nullable<ColorCurves>;
  1336. private _renderTargets;
  1337. /**
  1338. * constructor
  1339. * @param name The name of the material
  1340. * @param scene The scene to add the material to
  1341. */
  1342. constructor(name: string, scene: BABYLON.Scene);
  1343. /**
  1344. * The entire material has been created in order to prevent overdraw.
  1345. * @returns false
  1346. */
  1347. needAlphaTesting(): boolean;
  1348. /**
  1349. * The entire material has been created in order to prevent overdraw.
  1350. * @returns true if blending is enable
  1351. */
  1352. needAlphaBlending(): boolean;
  1353. /**
  1354. * Checks wether the material is ready to be rendered for a given mesh.
  1355. * @param mesh The mesh to render
  1356. * @param subMesh The submesh to check against
  1357. * @param useInstances Specify wether or not the material is used with instances
  1358. */
  1359. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  1360. /**
  1361. * Build the uniform buffer used in the material.
  1362. */
  1363. buildUniformLayout(): void;
  1364. /**
  1365. * Unbind the material.
  1366. */
  1367. unbind(): void;
  1368. /**
  1369. * Bind only the world matrix to the material.
  1370. * @param world The world matrix to bind.
  1371. */
  1372. bindOnlyWorldMatrix(world: Matrix): void;
  1373. /**
  1374. * Bind the material for a dedicated submeh (every used meshes will be considered opaque).
  1375. * @param world The world matrix to bind.
  1376. * @param subMesh The submesh to bind for.
  1377. */
  1378. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  1379. /**
  1380. * Dispose the material.
  1381. * @forceDisposeEffect Force disposal of the associated effect.
  1382. * @forceDisposeTextures Force disposal of the associated textures.
  1383. */
  1384. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  1385. /**
  1386. * Clones the material.
  1387. * @name The cloned name.
  1388. * @returns The cloned material.
  1389. */
  1390. clone(name: string): BackgroundMaterial;
  1391. /**
  1392. * Serializes the current material to its JSON representation.
  1393. * @returns The JSON representation.
  1394. */
  1395. serialize(): any;
  1396. /**
  1397. * Gets the class name of the material
  1398. * @returns "BackgroundMaterial"
  1399. */
  1400. getClassName(): string;
  1401. /**
  1402. * Parse a JSON input to create back a background material.
  1403. * @param source
  1404. * @param scene
  1405. * @param rootUrl
  1406. * @returns the instantiated BackgroundMaterial.
  1407. */
  1408. static Parse(source: any, scene: Scene, rootUrl: string): BackgroundMaterial;
  1409. }
  1410. }