imageProcessingConfiguration.d.ts 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. import { Observable } from "../Misc/observable";
  2. import type { Nullable } from "../types";
  3. import { Color4 } from "../Maths/math.color";
  4. import { ColorCurves } from "../Materials/colorCurves";
  5. import type { BaseTexture } from "../Materials/Textures/baseTexture";
  6. import type { Effect } from "../Materials/effect";
  7. import type { IImageProcessingConfigurationDefines } from "./imageProcessingConfiguration.defines";
  8. /**
  9. * This groups together the common properties used for image processing either in direct forward pass
  10. * or through post processing effect depending on the use of the image processing pipeline in your scene
  11. * or not.
  12. */
  13. export declare class ImageProcessingConfiguration {
  14. /**
  15. * Default tone mapping applied in BabylonJS.
  16. */
  17. static readonly TONEMAPPING_STANDARD = 0;
  18. /**
  19. * ACES Tone mapping (used by default in unreal and unity). This can help getting closer
  20. * to other engines rendering to increase portability.
  21. */
  22. static readonly TONEMAPPING_ACES = 1;
  23. /**
  24. * Color curves setup used in the effect if colorCurvesEnabled is set to true
  25. */
  26. colorCurves: Nullable<ColorCurves>;
  27. private _colorCurvesEnabled;
  28. /**
  29. * Gets whether the color curves effect is enabled.
  30. */
  31. get colorCurvesEnabled(): boolean;
  32. /**
  33. * Sets whether the color curves effect is enabled.
  34. */
  35. set colorCurvesEnabled(value: boolean);
  36. private _colorGradingTexture;
  37. /**
  38. * Color grading LUT texture used in the effect if colorGradingEnabled is set to true
  39. */
  40. get colorGradingTexture(): Nullable<BaseTexture>;
  41. /**
  42. * Color grading LUT texture used in the effect if colorGradingEnabled is set to true
  43. */
  44. set colorGradingTexture(value: Nullable<BaseTexture>);
  45. private _colorGradingEnabled;
  46. /**
  47. * Gets whether the color grading effect is enabled.
  48. */
  49. get colorGradingEnabled(): boolean;
  50. /**
  51. * Sets whether the color grading effect is enabled.
  52. */
  53. set colorGradingEnabled(value: boolean);
  54. private _colorGradingWithGreenDepth;
  55. /**
  56. * Gets whether the color grading effect is using a green depth for the 3d Texture.
  57. */
  58. get colorGradingWithGreenDepth(): boolean;
  59. /**
  60. * Sets whether the color grading effect is using a green depth for the 3d Texture.
  61. */
  62. set colorGradingWithGreenDepth(value: boolean);
  63. private _colorGradingBGR;
  64. /**
  65. * Gets whether the color grading texture contains BGR values.
  66. */
  67. get colorGradingBGR(): boolean;
  68. /**
  69. * Sets whether the color grading texture contains BGR values.
  70. */
  71. set colorGradingBGR(value: boolean);
  72. /** @internal */
  73. _exposure: number;
  74. /**
  75. * Gets the Exposure used in the effect.
  76. */
  77. get exposure(): number;
  78. /**
  79. * Sets the Exposure used in the effect.
  80. */
  81. set exposure(value: number);
  82. private _toneMappingEnabled;
  83. /**
  84. * Gets whether the tone mapping effect is enabled.
  85. */
  86. get toneMappingEnabled(): boolean;
  87. /**
  88. * Sets whether the tone mapping effect is enabled.
  89. */
  90. set toneMappingEnabled(value: boolean);
  91. private _toneMappingType;
  92. /**
  93. * Gets the type of tone mapping effect.
  94. */
  95. get toneMappingType(): number;
  96. /**
  97. * Sets the type of tone mapping effect used in BabylonJS.
  98. */
  99. set toneMappingType(value: number);
  100. protected _contrast: number;
  101. /**
  102. * Gets the contrast used in the effect.
  103. */
  104. get contrast(): number;
  105. /**
  106. * Sets the contrast used in the effect.
  107. */
  108. set contrast(value: number);
  109. /**
  110. * Vignette stretch size.
  111. */
  112. vignetteStretch: number;
  113. /**
  114. * Vignette center X Offset.
  115. */
  116. vignetteCenterX: number;
  117. /**
  118. * Vignette center Y Offset.
  119. */
  120. vignetteCenterY: number;
  121. /**
  122. * Back Compat: Vignette center Y Offset.
  123. * @deprecated use vignetteCenterY instead
  124. */
  125. get vignetteCentreY(): number;
  126. set vignetteCentreY(value: number);
  127. /**
  128. * Back Compat: Vignette center X Offset.
  129. * @deprecated use vignetteCenterX instead
  130. */
  131. get vignetteCentreX(): number;
  132. set vignetteCentreX(value: number);
  133. /**
  134. * Vignette weight or intensity of the vignette effect.
  135. */
  136. vignetteWeight: number;
  137. /**
  138. * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
  139. * if vignetteEnabled is set to true.
  140. */
  141. vignetteColor: Color4;
  142. /**
  143. * Camera field of view used by the Vignette effect.
  144. */
  145. vignetteCameraFov: number;
  146. private _vignetteBlendMode;
  147. /**
  148. * Gets the vignette blend mode allowing different kind of effect.
  149. */
  150. get vignetteBlendMode(): number;
  151. /**
  152. * Sets the vignette blend mode allowing different kind of effect.
  153. */
  154. set vignetteBlendMode(value: number);
  155. private _vignetteEnabled;
  156. /**
  157. * Gets whether the vignette effect is enabled.
  158. */
  159. get vignetteEnabled(): boolean;
  160. /**
  161. * Sets whether the vignette effect is enabled.
  162. */
  163. set vignetteEnabled(value: boolean);
  164. private _ditheringEnabled;
  165. /**
  166. * Gets whether the dithering effect is enabled.
  167. * The dithering effect can be used to reduce banding.
  168. */
  169. get ditheringEnabled(): boolean;
  170. /**
  171. * Sets whether the dithering effect is enabled.
  172. * The dithering effect can be used to reduce banding.
  173. */
  174. set ditheringEnabled(value: boolean);
  175. private _ditheringIntensity;
  176. /**
  177. * Gets the dithering intensity. 0 is no dithering. Default is 1.0 / 255.0.
  178. */
  179. get ditheringIntensity(): number;
  180. /**
  181. * Sets the dithering intensity. 0 is no dithering. Default is 1.0 / 255.0.
  182. */
  183. set ditheringIntensity(value: number);
  184. /** @internal */
  185. _skipFinalColorClamp: boolean;
  186. /**
  187. * If apply by post process is set to true, setting this to true will skip the final color clamp step in the fragment shader
  188. * Applies to PBR materials.
  189. */
  190. get skipFinalColorClamp(): boolean;
  191. /**
  192. * If apply by post process is set to true, setting this to true will skip the final color clamp step in the fragment shader
  193. * Applies to PBR materials.
  194. */
  195. set skipFinalColorClamp(value: boolean);
  196. /** @internal */
  197. _applyByPostProcess: boolean;
  198. /**
  199. * Gets whether the image processing is applied through a post process or not.
  200. */
  201. get applyByPostProcess(): boolean;
  202. /**
  203. * Sets whether the image processing is applied through a post process or not.
  204. */
  205. set applyByPostProcess(value: boolean);
  206. private _isEnabled;
  207. /**
  208. * Gets whether the image processing is enabled or not.
  209. */
  210. get isEnabled(): boolean;
  211. /**
  212. * Sets whether the image processing is enabled or not.
  213. */
  214. set isEnabled(value: boolean);
  215. /**
  216. * An event triggered when the configuration changes and requires Shader to Update some parameters.
  217. */
  218. onUpdateParameters: Observable<ImageProcessingConfiguration>;
  219. /**
  220. * Method called each time the image processing information changes requires to recompile the effect.
  221. */
  222. protected _updateParameters(): void;
  223. /**
  224. * Gets the current class name.
  225. * @returns "ImageProcessingConfiguration"
  226. */
  227. getClassName(): string;
  228. /**
  229. * Prepare the list of uniforms associated with the Image Processing effects.
  230. * @param uniforms The list of uniforms used in the effect
  231. * @param defines the list of defines currently in use
  232. */
  233. static PrepareUniforms: (uniforms: string[], defines: IImageProcessingConfigurationDefines) => void;
  234. /**
  235. * Prepare the list of samplers associated with the Image Processing effects.
  236. * @param samplersList The list of uniforms used in the effect
  237. * @param defines the list of defines currently in use
  238. */
  239. static PrepareSamplers: (samplersList: string[], defines: IImageProcessingConfigurationDefines) => void;
  240. /**
  241. * Prepare the list of defines associated to the shader.
  242. * @param defines the list of defines to complete
  243. * @param forPostProcess Define if we are currently in post process mode or not
  244. */
  245. prepareDefines(defines: IImageProcessingConfigurationDefines, forPostProcess?: boolean): void;
  246. /**
  247. * Returns true if all the image processing information are ready.
  248. * @returns True if ready, otherwise, false
  249. */
  250. isReady(): boolean;
  251. /**
  252. * Binds the image processing to the shader.
  253. * @param effect The effect to bind to
  254. * @param overrideAspectRatio Override the aspect ratio of the effect
  255. */
  256. bind(effect: Effect, overrideAspectRatio?: number): void;
  257. /**
  258. * Clones the current image processing instance.
  259. * @returns The cloned image processing
  260. */
  261. clone(): ImageProcessingConfiguration;
  262. /**
  263. * Serializes the current image processing instance to a json representation.
  264. * @returns a JSON representation
  265. */
  266. serialize(): any;
  267. /**
  268. * Parses the image processing from a json representation.
  269. * @param source the JSON source to parse
  270. * @returns The parsed image processing
  271. */
  272. static Parse(source: any): ImageProcessingConfiguration;
  273. private static _VIGNETTEMODE_MULTIPLY;
  274. private static _VIGNETTEMODE_OPAQUE;
  275. /**
  276. * Used to apply the vignette as a mix with the pixel color.
  277. */
  278. static get VIGNETTEMODE_MULTIPLY(): number;
  279. /**
  280. * Used to apply the vignette as a replacement of the pixel color.
  281. */
  282. static get VIGNETTEMODE_OPAQUE(): number;
  283. }