babylon.pbrMaterial.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  2. declare module BABYLON {
  3. /**
  4. * The Physically based material of BJS.
  5. *
  6. * This offers the main features of a standard PBR material.
  7. * For more information, please refer to the documentation :
  8. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  9. */
  10. class PBRMaterial extends BABYLON.Material {
  11. /**
  12. * Intensity of the direct lights e.g. the four lights available in your scene.
  13. * This impacts both the direct diffuse and specular highlights.
  14. */
  15. directIntensity: number;
  16. /**
  17. * Intensity of the emissive part of the material.
  18. * This helps controlling the emissive effect without modifying the emissive color.
  19. */
  20. emissiveIntensity: number;
  21. /**
  22. * Intensity of the environment e.g. how much the environment will light the object
  23. * either through harmonics for rough material or through the refelction for shiny ones.
  24. */
  25. environmentIntensity: number;
  26. /**
  27. * This is a special control allowing the reduction of the specular highlights coming from the
  28. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  29. */
  30. specularIntensity: number;
  31. private _lightingInfos;
  32. /**
  33. * Debug Control allowing disabling the bump map on this material.
  34. */
  35. disableBumpMap: boolean;
  36. /**
  37. * Debug Control helping enforcing or dropping the darkness of shadows.
  38. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  39. */
  40. overloadedShadowIntensity: number;
  41. /**
  42. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  43. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  44. */
  45. overloadedShadeIntensity: number;
  46. private _overloadedShadowInfos;
  47. /**
  48. * The camera exposure used on this material.
  49. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  50. * This corresponds to a photographic exposure.
  51. */
  52. cameraExposure: number;
  53. /**
  54. * The camera contrast used on this material.
  55. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  56. */
  57. cameraContrast: number;
  58. private _cameraInfos;
  59. private _microsurfaceTextureLods;
  60. /**
  61. * Debug Control allowing to overload the ambient color.
  62. * This as to be use with the overloadedAmbientIntensity parameter.
  63. */
  64. overloadedAmbient: Color3;
  65. /**
  66. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  67. */
  68. overloadedAmbientIntensity: number;
  69. /**
  70. * Debug Control allowing to overload the albedo color.
  71. * This as to be use with the overloadedAlbedoIntensity parameter.
  72. */
  73. overloadedAlbedo: Color3;
  74. /**
  75. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  76. */
  77. overloadedAlbedoIntensity: number;
  78. /**
  79. * Debug Control allowing to overload the reflectivity color.
  80. * This as to be use with the overloadedReflectivityIntensity parameter.
  81. */
  82. overloadedReflectivity: Color3;
  83. /**
  84. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  85. */
  86. overloadedReflectivityIntensity: number;
  87. /**
  88. * Debug Control allowing to overload the emissive color.
  89. * This as to be use with the overloadedEmissiveIntensity parameter.
  90. */
  91. overloadedEmissive: Color3;
  92. /**
  93. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  94. */
  95. overloadedEmissiveIntensity: number;
  96. private _overloadedIntensity;
  97. /**
  98. * Debug Control allowing to overload the reflection color.
  99. * This as to be use with the overloadedReflectionIntensity parameter.
  100. */
  101. overloadedReflection: Color3;
  102. /**
  103. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  104. */
  105. overloadedReflectionIntensity: number;
  106. /**
  107. * Debug Control allowing to overload the microsurface.
  108. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  109. */
  110. overloadedMicroSurface: number;
  111. /**
  112. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  113. */
  114. overloadedMicroSurfaceIntensity: number;
  115. private _overloadedMicroSurface;
  116. /**
  117. * AKA Diffuse Texture in standard nomenclature.
  118. */
  119. albedoTexture: BaseTexture;
  120. /**
  121. * AKA Occlusion Texture in other nomenclature.
  122. */
  123. ambientTexture: BaseTexture;
  124. opacityTexture: BaseTexture;
  125. reflectionTexture: BaseTexture;
  126. emissiveTexture: BaseTexture;
  127. /**
  128. * AKA Specular texture in other nomenclature.
  129. */
  130. reflectivityTexture: BaseTexture;
  131. bumpTexture: BaseTexture;
  132. lightmapTexture: BaseTexture;
  133. refractionTexture: BaseTexture;
  134. ambientColor: Color3;
  135. /**
  136. * AKA Diffuse Color in other nomenclature.
  137. */
  138. albedoColor: Color3;
  139. /**
  140. * AKA Specular Color in other nomenclature.
  141. */
  142. reflectivityColor: Color3;
  143. reflectionColor: Color3;
  144. emissiveColor: Color3;
  145. /**
  146. * AKA Glossiness in other nomenclature.
  147. */
  148. microSurface: number;
  149. /**
  150. * source material index of refraction (IOR)' / 'destination material IOR.
  151. */
  152. indexOfRefraction: number;
  153. /**
  154. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  155. */
  156. invertRefractionY: boolean;
  157. opacityFresnelParameters: FresnelParameters;
  158. emissiveFresnelParameters: FresnelParameters;
  159. /**
  160. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  161. * Materials half opaque for instance using refraction could benefit from this control.
  162. */
  163. linkRefractionWithTransparency: boolean;
  164. /**
  165. * The emissive and albedo are linked to never be more than one (Energy conservation).
  166. */
  167. linkEmissiveWithAlbedo: boolean;
  168. useLightmapAsShadowmap: boolean;
  169. /**
  170. * In this mode, the emissive informtaion will always be added to the lighting once.
  171. * A light for instance can be thought as emissive.
  172. */
  173. useEmissiveAsIllumination: boolean;
  174. /**
  175. * Secifies that the alpha is coming form the albedo channel alpha channel.
  176. */
  177. useAlphaFromAlbedoTexture: boolean;
  178. /**
  179. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  180. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  181. */
  182. useSpecularOverAlpha: boolean;
  183. /**
  184. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  185. */
  186. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  187. /**
  188. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  189. * The material will try to infer what glossiness each pixel should be.
  190. */
  191. useAutoMicroSurfaceFromReflectivityMap: boolean;
  192. /**
  193. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  194. * the creation of the material.
  195. */
  196. useScalarInLinearSpace: boolean;
  197. /**
  198. * BJS is using an harcoded light falloff based on a manually sets up range.
  199. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  200. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  201. */
  202. usePhysicalLightFalloff: boolean;
  203. /**
  204. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  205. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  206. */
  207. useRadianceOverAlpha: boolean;
  208. /**
  209. * Allows using the bump map in parallax mode.
  210. */
  211. useParallax: boolean;
  212. /**
  213. * Allows using the bump map in parallax occlusion mode.
  214. */
  215. useParallaxOcclusion: boolean;
  216. /**
  217. * Controls the scale bias of the parallax mode.
  218. */
  219. parallaxScaleBias: number;
  220. disableLighting: boolean;
  221. private _renderTargets;
  222. private _worldViewProjectionMatrix;
  223. private _globalAmbientColor;
  224. private _tempColor;
  225. private _renderId;
  226. private _defines;
  227. private _cachedDefines;
  228. private _useLogarithmicDepth;
  229. /**
  230. * Instantiates a new PBRMaterial instance.
  231. *
  232. * @param name The material name
  233. * @param scene The scene the material will be use in.
  234. */
  235. constructor(name: string, scene: Scene);
  236. useLogarithmicDepth: boolean;
  237. needAlphaBlending(): boolean;
  238. needAlphaTesting(): boolean;
  239. private _shouldUseAlphaFromAlbedoTexture();
  240. getAlphaTestTexture(): BaseTexture;
  241. private _checkCache(scene, mesh?, useInstances?);
  242. private convertColorToLinearSpaceToRef(color, ref);
  243. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  244. private static _scaledAlbedo;
  245. private static _scaledReflectivity;
  246. private static _scaledEmissive;
  247. private static _scaledReflection;
  248. private static _lightRadiuses;
  249. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean): void;
  250. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  251. unbind(): void;
  252. bindOnlyWorldMatrix(world: Matrix): void;
  253. private _myScene;
  254. private _myShadowGenerator;
  255. bind(world: Matrix, mesh?: Mesh): void;
  256. getAnimatables(): IAnimatable[];
  257. dispose(forceDisposeEffect?: boolean): void;
  258. clone(name: string): PBRMaterial;
  259. serialize(): any;
  260. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  261. }
  262. }