babylonjs-addons 8.26.1 → 8.26.2
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/NOTICE.md +33 -0
- package/babylonjs.addons.d.ts +1139 -0
- package/babylonjs.addons.js +1 -1
- package/babylonjs.addons.min.js +1 -1
- package/babylonjs.addons.min.js.map +1 -1
- package/babylonjs.addons.module.d.ts +2972 -563
- package/package.json +2 -2
package/babylonjs.addons.d.ts
CHANGED
@@ -683,6 +683,1145 @@ declare module ADDONS {
|
|
683
683
|
};
|
684
684
|
|
685
685
|
|
686
|
+
/**
|
687
|
+
* The transmittance LUT can be used to get the radiance from an external light source arriving a given point, accounting for atmospheric scattering.
|
688
|
+
*/
|
689
|
+
export class TransmittanceLut {
|
690
|
+
/**
|
691
|
+
* Listen to this observer to know when the LUT data has been updated.
|
692
|
+
* This is typically infrequent (once at startup), but also happens whenever the atmosphere's properties change.
|
693
|
+
*/
|
694
|
+
readonly onUpdatedObservable: BABYLON.Observable<void>;
|
695
|
+
private readonly _atmosphere;
|
696
|
+
private _lutData;
|
697
|
+
private _renderTarget;
|
698
|
+
private _effectWrapper;
|
699
|
+
private _effectRenderer;
|
700
|
+
private _isDirty;
|
701
|
+
private _isDisposed;
|
702
|
+
/**
|
703
|
+
* True if the LUT has been rendered.
|
704
|
+
*/
|
705
|
+
get isDirty(): boolean;
|
706
|
+
/**
|
707
|
+
* The render target that contains the transmittance LUT.
|
708
|
+
* @throws if the LUT has been disposed.
|
709
|
+
*/
|
710
|
+
get renderTarget(): BABYLON.RenderTargetTexture;
|
711
|
+
/**
|
712
|
+
* Constructs the {@link TransmittanceLut}.
|
713
|
+
* @param atmosphere - The atmosphere that owns this LUT.
|
714
|
+
*/
|
715
|
+
constructor(atmosphere: Atmosphere);
|
716
|
+
/**
|
717
|
+
* Gets the transmittance of an external light through the atmosphere to a point specified by its distance to the planet center and its geocentric normal.
|
718
|
+
* The result is always a linear space color.
|
719
|
+
* @param directionToLight - The direction to the light source.
|
720
|
+
* @param pointRadius - The distance from the origin to the point.
|
721
|
+
* @param pointGeocentricNormal - The normal of the point.
|
722
|
+
* @param result - The color to write the result to.
|
723
|
+
* @returns The result color.
|
724
|
+
*/
|
725
|
+
getTransmittedColorToRef<T extends BABYLON.IColor3Like>(directionToLight: BABYLON.IVector3Like, pointRadius: number, pointGeocentricNormal: BABYLON.IVector3Like, result: T): T;
|
726
|
+
/**
|
727
|
+
* Derives light color from the transmittance at a point specified by its distance to the planet center and its geocentric normal.
|
728
|
+
* @param light - The light to update.
|
729
|
+
* @param pointRadius - The distance from the origin to the point.
|
730
|
+
* @param pointGeocentricNormal - The normal of the point.
|
731
|
+
*/
|
732
|
+
updateLightParameters(light: BABYLON.DirectionalLight, pointRadius: number, pointGeocentricNormal: BABYLON.IVector3Like): void;
|
733
|
+
/**
|
734
|
+
* Renders the LUT if needed.
|
735
|
+
* @returns true if the LUT was rendered.
|
736
|
+
*/
|
737
|
+
render(): boolean;
|
738
|
+
/**
|
739
|
+
* Marks the LUT as needing to be rendered.
|
740
|
+
*/
|
741
|
+
markDirty(): void;
|
742
|
+
/**
|
743
|
+
* Disposes the LUT and its resources.
|
744
|
+
*/
|
745
|
+
dispose(): void;
|
746
|
+
}
|
747
|
+
|
748
|
+
|
749
|
+
/**
|
750
|
+
* Samples the texture data at the given uv coordinate using bilinear interpolation.
|
751
|
+
* Note this will not match GPU sampling behavior exactly.
|
752
|
+
* Currently assumes clamping behavior.
|
753
|
+
* @param u - The u coordinate to sample.
|
754
|
+
* @param v - The v coordinate to sample.
|
755
|
+
* @param widthPx - The width of the texture in texels.
|
756
|
+
* @param heightPx - The height of the texture in texels.
|
757
|
+
* @param data - The texture data to sample.
|
758
|
+
* @param result - The color to store the sample.
|
759
|
+
* @param normalizeFunc - The function to normalize the texel values. Default is to divide by 255.
|
760
|
+
* @returns The result color.
|
761
|
+
*/
|
762
|
+
export const Sample2DRgbaToRef: <T extends BABYLON.IColor4Like>(u: number, v: number, widthPx: number, heightPx: number, data: Uint8Array | Uint16Array | Float32Array, result: T, normalizeFunc?: (value: number) => number) => T;
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
/**
|
768
|
+
* The diffuse sky irradiance LUT is used to query the diffuse irradiance at a specified position.
|
769
|
+
*/
|
770
|
+
export class DiffuseSkyIrradianceLut {
|
771
|
+
private readonly _atmosphere;
|
772
|
+
private _renderTarget;
|
773
|
+
private _effectWrapper;
|
774
|
+
private _effectRenderer;
|
775
|
+
private _isDirty;
|
776
|
+
private _isDisposed;
|
777
|
+
private _lutData;
|
778
|
+
/**
|
779
|
+
* True if the LUT needs to be rendered.
|
780
|
+
*/
|
781
|
+
get isDirty(): boolean;
|
782
|
+
/**
|
783
|
+
* True if the LUT has been disposed.
|
784
|
+
*/
|
785
|
+
get isDisposed(): boolean;
|
786
|
+
/**
|
787
|
+
* The render target used for this LUT.
|
788
|
+
* @throws if the LUT has been disposed.
|
789
|
+
*/
|
790
|
+
get renderTarget(): BABYLON.RenderTargetTexture;
|
791
|
+
/**
|
792
|
+
* True if the LUT data has been read back from the GPU.
|
793
|
+
*/
|
794
|
+
get hasLutData(): boolean;
|
795
|
+
/**
|
796
|
+
* Constructs the {@link DiffuseSkyIrradianceLut}.
|
797
|
+
* @param atmosphere - The atmosphere to use.
|
798
|
+
*/
|
799
|
+
constructor(atmosphere: Atmosphere);
|
800
|
+
/**
|
801
|
+
* Gets the diffuse sky irradiance for a surface oriented along the geocentric normal.
|
802
|
+
* Resulting color is always in linear space.
|
803
|
+
* @param directionToLight - The direction to the light in world space.
|
804
|
+
* @param radius - The position's distance to the planet origin.
|
805
|
+
* @param cameraGeocentricNormal - The geocentric normal of the camera.
|
806
|
+
* @param lightIrradiance - The irradiance of the light.
|
807
|
+
* @param result - The color to store the result in.
|
808
|
+
* @returns The result color.
|
809
|
+
*/
|
810
|
+
getDiffuseSkyIrradianceToRef<T extends BABYLON.IColor3Like>(directionToLight: BABYLON.IVector3Like, radius: number, cameraGeocentricNormal: BABYLON.IVector3Like, lightIrradiance: number, result: T): T;
|
811
|
+
/**
|
812
|
+
* Renders the LUT.
|
813
|
+
* @returns True if the LUT was rendered.
|
814
|
+
*/
|
815
|
+
render(): boolean;
|
816
|
+
/**
|
817
|
+
* Marks the LUT as needing to be rendered.
|
818
|
+
*/
|
819
|
+
markDirty(): void;
|
820
|
+
/**
|
821
|
+
* Disposes the LUT.
|
822
|
+
*/
|
823
|
+
dispose(): void;
|
824
|
+
}
|
825
|
+
|
826
|
+
|
827
|
+
/**
|
828
|
+
* The options for the {@link AtmospherePhysicalProperties} that describe the planet, the atmosphere, and scattering.
|
829
|
+
*/
|
830
|
+
export interface IAtmospherePhysicalPropertiesOptions {
|
831
|
+
/**
|
832
|
+
* The radius of the planet in kilometers.
|
833
|
+
*/
|
834
|
+
planetRadius?: number;
|
835
|
+
/**
|
836
|
+
* The minimum camera radius (distance from the planet's center) allowed when rendering the atmosphere.
|
837
|
+
* This should be greater than 0.
|
838
|
+
* It prevents rendering issues close to the planet's surface.
|
839
|
+
*/
|
840
|
+
planetRadiusOffset?: number;
|
841
|
+
/**
|
842
|
+
* The thickness of the atmosphere measured in kilometers from the planet's surface to the outer edge of the atmosphere.
|
843
|
+
*/
|
844
|
+
atmosphereThickness?: number;
|
845
|
+
/**
|
846
|
+
* The scale applied to the Rayleigh scattering.
|
847
|
+
*/
|
848
|
+
rayleighScatteringScale?: number;
|
849
|
+
/**
|
850
|
+
* The Rayleigh scattering per kilometer at sea level for red, green, and blue wavelengths.
|
851
|
+
*/
|
852
|
+
peakRayleighScattering?: BABYLON.Vector3;
|
853
|
+
/**
|
854
|
+
* The scale applied to the Mie scattering.
|
855
|
+
*/
|
856
|
+
mieScatteringScale?: number;
|
857
|
+
/**
|
858
|
+
* The Mie scattering per kilometer at sea level for red, green, and blue wavelengths.
|
859
|
+
*/
|
860
|
+
peakMieScattering?: BABYLON.Vector3;
|
861
|
+
/**
|
862
|
+
* The scale applied to the Mie absorption.
|
863
|
+
*/
|
864
|
+
mieAbsorptionScale?: number;
|
865
|
+
/**
|
866
|
+
* The Mie absorption per kilometer at sea level for red, green, and blue wavelengths.
|
867
|
+
*/
|
868
|
+
peakMieAbsorption?: BABYLON.Vector3;
|
869
|
+
/**
|
870
|
+
* The scale applied to the ozone absorption.
|
871
|
+
*/
|
872
|
+
ozoneAbsorptionScale?: number;
|
873
|
+
/**
|
874
|
+
* The ozone absorption per kilometer at sea level for red, green, and blue wavelengths.
|
875
|
+
*/
|
876
|
+
peakOzoneAbsorption?: BABYLON.Vector3;
|
877
|
+
}
|
878
|
+
|
879
|
+
|
880
|
+
/**
|
881
|
+
* Describes the physical properties of the atmosphere. Assumes a spherical planet.
|
882
|
+
* - "radius" values describe a distance from the planet's center.
|
883
|
+
* - "height" values describe a distance from the planet's surface.
|
884
|
+
* - Distances are in kilometers unless otherwise specified. Angles are in radians.
|
885
|
+
*/
|
886
|
+
export class AtmospherePhysicalProperties {
|
887
|
+
/**
|
888
|
+
* Notification for when properties of the {@link AtmospherePhysicalProperties} are changed.
|
889
|
+
*/
|
890
|
+
readonly onChangedObservable: BABYLON.Observable<AtmospherePhysicalProperties>;
|
891
|
+
private _planetRadius;
|
892
|
+
private _planetRadiusOffset;
|
893
|
+
private _atmosphereThickness;
|
894
|
+
private _rayleighScatteringScale;
|
895
|
+
private _peakRayleighScattering;
|
896
|
+
private _mieScatteringScale;
|
897
|
+
private _peakMieScattering;
|
898
|
+
private _mieAbsorptionScale;
|
899
|
+
private _peakMieAbsorption;
|
900
|
+
private _ozoneAbsorptionScale;
|
901
|
+
private _peakOzoneAbsorption;
|
902
|
+
private _planetRadiusWithOffset;
|
903
|
+
private _planetRadiusSquared;
|
904
|
+
private _atmosphereRadius;
|
905
|
+
private _atmosphereRadiusSquared;
|
906
|
+
private _horizonDistanceToAtmosphereEdge;
|
907
|
+
private _horizonDistanceToAtmosphereEdgeSquared;
|
908
|
+
private _rayleighScattering;
|
909
|
+
private _mieScattering;
|
910
|
+
private _mieAbsorption;
|
911
|
+
private _mieExtinction;
|
912
|
+
private _ozoneAbsorption;
|
913
|
+
/**
|
914
|
+
* The radius of the planet in kilometers.
|
915
|
+
*/
|
916
|
+
get planetRadius(): number;
|
917
|
+
set planetRadius(value: number);
|
918
|
+
/**
|
919
|
+
* The squared radius of the planet in kilometers.
|
920
|
+
*/
|
921
|
+
get planetRadiusSquared(): number;
|
922
|
+
/**
|
923
|
+
* Offset applied to view points near the planet's surface. This should be greater than 0.
|
924
|
+
* It prevents rendering issues close to the planet's surface.
|
925
|
+
*/
|
926
|
+
get planetRadiusOffset(): number;
|
927
|
+
set planetRadiusOffset(value: number);
|
928
|
+
/**
|
929
|
+
* This is the {@link planetRadius} with the additional {@link planetRadiusOffset}, in kilometers.
|
930
|
+
*/
|
931
|
+
get planetRadiusWithOffset(): number;
|
932
|
+
/**
|
933
|
+
* The thickness of the atmosphere measured in kilometers.
|
934
|
+
*/
|
935
|
+
get atmosphereThickness(): number;
|
936
|
+
set atmosphereThickness(value: number);
|
937
|
+
/**
|
938
|
+
* The combined planet radius and atmosphere thickness in kilometers.
|
939
|
+
*/
|
940
|
+
get atmosphereRadius(): number;
|
941
|
+
/**
|
942
|
+
* The atmosphere radius squared in kilometers.
|
943
|
+
*/
|
944
|
+
get atmosphereRadiusSquared(): number;
|
945
|
+
/**
|
946
|
+
* Horizon distance from the planet's surface to the outer edge of the atmosphere in kilometers.
|
947
|
+
*/
|
948
|
+
get horizonDistanceToAtmosphereEdge(): number;
|
949
|
+
/**
|
950
|
+
* Horizon distance from the planet's surface to the outer edge of the atmosphere, squared, in kilometers.
|
951
|
+
*/
|
952
|
+
get horizonDistanceToAtmosphereEdgeSquared(): number;
|
953
|
+
/**
|
954
|
+
* The scale applied to {@link peakRayleighScattering}.
|
955
|
+
*/
|
956
|
+
get rayleighScatteringScale(): number;
|
957
|
+
set rayleighScatteringScale(value: number);
|
958
|
+
/**
|
959
|
+
* The Rayleigh scattering per kilometer at sea level for red, green, and blue wavelengths.
|
960
|
+
*/
|
961
|
+
get peakRayleighScattering(): BABYLON.Vector3;
|
962
|
+
set peakRayleighScattering(value: BABYLON.Vector3);
|
963
|
+
/**
|
964
|
+
* The Rayleigh scattering per kilometer at sea level for red, green, and blue wavelengths.
|
965
|
+
* This value cannot be set directly. It is inferred by scaling {@link peakRayleighScattering} by {@link rayleighScatteringScale}.
|
966
|
+
*/
|
967
|
+
get rayleighScattering(): BABYLON.Vector3;
|
968
|
+
/**
|
969
|
+
* The scale applied to {@link peakMieScattering}.
|
970
|
+
*/
|
971
|
+
get mieScatteringScale(): number;
|
972
|
+
set mieScatteringScale(value: number);
|
973
|
+
/**
|
974
|
+
* The Mie scattering per kilometer at sea level for red, green, and blue wavelengths.
|
975
|
+
*/
|
976
|
+
get peakMieScattering(): BABYLON.Vector3;
|
977
|
+
set peakMieScattering(value: BABYLON.Vector3);
|
978
|
+
/**
|
979
|
+
* The Mie scattering per kilometer at sea level for red, green, and blue wavelengths.
|
980
|
+
* This value cannot be set directly. It is inferred by scaling {@link mieScatteringScale} by {@link peakMieScattering}.
|
981
|
+
*/
|
982
|
+
get mieScattering(): BABYLON.Vector3;
|
983
|
+
/**
|
984
|
+
* The scale applied to {@link peakMieAbsorption}.
|
985
|
+
*/
|
986
|
+
get mieAbsorptionScale(): number;
|
987
|
+
set mieAbsorptionScale(value: number);
|
988
|
+
/**
|
989
|
+
* The Mie absorption per kilometer at sea level for red, green, and blue wavelengths.
|
990
|
+
*/
|
991
|
+
get peakMieAbsorption(): BABYLON.Vector3;
|
992
|
+
set peakMieAbsorption(value: BABYLON.Vector3);
|
993
|
+
/**
|
994
|
+
* The Mie absorption per kilometer at sea level for red, green, and blue wavelengths.
|
995
|
+
* This value cannot be set directly. It is inferred by scaling {@link mieAbsorptionScale} by {@link peakMieAbsorption}.
|
996
|
+
*/
|
997
|
+
get mieAbsorption(): BABYLON.Vector3;
|
998
|
+
/**
|
999
|
+
* The Mie extinction per kilometer at sea level for red, green, and blue wavelengths.
|
1000
|
+
* This value cannot be set directly. It is inferred by adding the {@link mieAbsorption} to the {@link mieScattering}.
|
1001
|
+
*/
|
1002
|
+
get mieExtinction(): BABYLON.Vector3;
|
1003
|
+
/**
|
1004
|
+
* The scale applied to {@link peakOzoneAbsorption}.
|
1005
|
+
*/
|
1006
|
+
get ozoneAbsorptionScale(): number;
|
1007
|
+
set ozoneAbsorptionScale(value: number);
|
1008
|
+
/**
|
1009
|
+
* The ozone absorption per kilometer measured at a height corresponding to it's peak concentration,
|
1010
|
+
* for red, green, and blue wavelengths.
|
1011
|
+
*/
|
1012
|
+
get peakOzoneAbsorption(): BABYLON.Vector3;
|
1013
|
+
set peakOzoneAbsorption(value: BABYLON.Vector3);
|
1014
|
+
/**
|
1015
|
+
* The ozone absorption per kilometer at sea level for red, green, and blue wavelengths.
|
1016
|
+
* This value cannot be set directly. It is inferred by scaling {@link peakOzoneAbsorption} by {@link ozoneAbsorptionScale}.
|
1017
|
+
*/
|
1018
|
+
get ozoneAbsorption(): BABYLON.Vector3;
|
1019
|
+
/**
|
1020
|
+
* Constructs the {@link AtmospherePhysicalProperties}.
|
1021
|
+
* @param options - The options for the {@link AtmospherePhysicalProperties}.
|
1022
|
+
*/
|
1023
|
+
constructor(options?: IAtmospherePhysicalPropertiesOptions);
|
1024
|
+
private _recomputeDimensionalParameters;
|
1025
|
+
private _recomputeRayleighScattering;
|
1026
|
+
private _recomputeMieScattering;
|
1027
|
+
private _recomputeMieAbsorption;
|
1028
|
+
private _recomputeMieExtinction;
|
1029
|
+
private _recomputeOzoneAbsorption;
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
|
1033
|
+
/**
|
1034
|
+
* Variables that are used to render the atmosphere and are computed per-camera.
|
1035
|
+
*/
|
1036
|
+
export class AtmospherePerCameraVariables {
|
1037
|
+
private _inverseViewProjectionMatrixWithoutTranslation;
|
1038
|
+
private _directionToLightRelativeToCameraGeocentricNormal;
|
1039
|
+
private _cosAngleLightToZenith;
|
1040
|
+
private _cameraRadius;
|
1041
|
+
private _clampedCameraRadius;
|
1042
|
+
private _cameraHeight;
|
1043
|
+
private _clampedCameraHeight;
|
1044
|
+
private _cameraPositionGlobal;
|
1045
|
+
private _clampedCameraPositionGlobal;
|
1046
|
+
private _cosCameraHorizonAngleFromZenith;
|
1047
|
+
private _sinCameraAtmosphereHorizonAngleFromNadir;
|
1048
|
+
private _cameraGeocentricNormal;
|
1049
|
+
private _cameraForward;
|
1050
|
+
private _cameraNearPlane;
|
1051
|
+
private _cameraPosition;
|
1052
|
+
private _viewport;
|
1053
|
+
private _lastViewMatrix;
|
1054
|
+
private _lastProjectionMatrix;
|
1055
|
+
private _inverseViewMatrixWithoutTranslation;
|
1056
|
+
private _inverseProjectionMatrix;
|
1057
|
+
/**
|
1058
|
+
* The inverse view projection matrix is used to unproject rays.
|
1059
|
+
* To avoid precision issues, the translation part of the matrix has been removed.
|
1060
|
+
*/
|
1061
|
+
get inverseViewProjectionMatrixWithoutTranslation(): BABYLON.IMatrixLike;
|
1062
|
+
/**
|
1063
|
+
* The direction to the light relative to the geocentric normal under the camera.
|
1064
|
+
*/
|
1065
|
+
get directionToLightRelativeToCameraGeocentricNormal(): BABYLON.IVector3Like;
|
1066
|
+
/**
|
1067
|
+
* The cosine of the angle between the light direction and zenith.
|
1068
|
+
*/
|
1069
|
+
get cosAngleLightToZenith(): number;
|
1070
|
+
/**
|
1071
|
+
* The distance from the camera to the planet origin in kilometers.
|
1072
|
+
*/
|
1073
|
+
get cameraRadius(): number;
|
1074
|
+
/**
|
1075
|
+
* The distance from the camera to the planet origin, clamped to the planet radius offset, in kilometers.
|
1076
|
+
*/
|
1077
|
+
get clampedCameraRadius(): number;
|
1078
|
+
/**
|
1079
|
+
* The height of the camera above the planet surface in kilometers.
|
1080
|
+
*/
|
1081
|
+
get cameraHeight(): number;
|
1082
|
+
/**
|
1083
|
+
* The height of the camera above the planet surface, clamped to the planet radius offset, in kilometers.
|
1084
|
+
*/
|
1085
|
+
get clampedCameraHeight(): number;
|
1086
|
+
/**
|
1087
|
+
* The camera position in global space kilometers.
|
1088
|
+
*/
|
1089
|
+
get cameraPositionGlobal(): BABYLON.IVector3Like;
|
1090
|
+
/**
|
1091
|
+
* The camera position, clamped to the planet radius offset, in global space kilometers.
|
1092
|
+
*/
|
1093
|
+
get clampedCameraPositionGlobal(): BABYLON.IVector3Like;
|
1094
|
+
/**
|
1095
|
+
* The cosine of the angle from the zenith to the horizon of the planet, measured from the camera position.
|
1096
|
+
*/
|
1097
|
+
get cosCameraHorizonAngleFromZenith(): number;
|
1098
|
+
/**
|
1099
|
+
* The sine of the angle from the nadir to the horizon of the atmosphere, measured from the camera position.
|
1100
|
+
*/
|
1101
|
+
get sinCameraAtmosphereHorizonAngleFromNadir(): number;
|
1102
|
+
/**
|
1103
|
+
* The geocentric normal of the camera in global space i.e., the normalization of {@link cameraPositionGlobal}.
|
1104
|
+
*/
|
1105
|
+
get cameraGeocentricNormal(): BABYLON.IVector3Like;
|
1106
|
+
/**
|
1107
|
+
* The camera's forward direction in world space.
|
1108
|
+
*/
|
1109
|
+
get cameraForward(): BABYLON.IVector3Like;
|
1110
|
+
/**
|
1111
|
+
* The distance to the near plane of the camera.
|
1112
|
+
*/
|
1113
|
+
get cameraNearPlane(): number;
|
1114
|
+
/**
|
1115
|
+
* The camera's position in world space.
|
1116
|
+
*/
|
1117
|
+
get cameraPosition(): BABYLON.IVector3Like;
|
1118
|
+
/**
|
1119
|
+
* The viewport for the camera.
|
1120
|
+
*/
|
1121
|
+
get viewport(): BABYLON.IVector4Like;
|
1122
|
+
/**
|
1123
|
+
* Updates the variables.
|
1124
|
+
* @param camera - The camera to update the variables for.
|
1125
|
+
* @param planetRadius - The radius of the planet in kilometers.
|
1126
|
+
* @param planetRadiusWithOffset - The radius of the planet with the offset in kilometers.
|
1127
|
+
* @param atmosphereRadius - The radius of the atmosphere in kilometers.
|
1128
|
+
* @param directionToLight - The direction to the light in world space.
|
1129
|
+
* @param originHeight - The height of the origin (distance from planet's surface) in kilometers.
|
1130
|
+
*/
|
1131
|
+
update(camera: BABYLON.Camera, planetRadius: number, planetRadiusWithOffset: number, atmosphereRadius: number, directionToLight: BABYLON.IVector3Like, originHeight: number): void;
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
|
1135
|
+
class AtmospherePBRMaterialDefines extends BABYLON.MaterialDefines {
|
1136
|
+
USE_AERIAL_PERSPECTIVE_LUT: boolean;
|
1137
|
+
APPLY_AERIAL_PERSPECTIVE_INTENSITY: boolean;
|
1138
|
+
APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS: boolean;
|
1139
|
+
/**
|
1140
|
+
* Constructs the {@link AtmospherePBRMaterialDefines}.
|
1141
|
+
* @param useAerialPerspectiveLut - Whether to use the aerial perspective LUT.
|
1142
|
+
*/
|
1143
|
+
constructor(useAerialPerspectiveLut: boolean);
|
1144
|
+
}
|
1145
|
+
/**
|
1146
|
+
* Adds shading logic to a PBRMaterial that provides radiance, diffuse sky irradiance, and aerial perspective from the atmosphere.
|
1147
|
+
*/
|
1148
|
+
export class AtmospherePBRMaterialPlugin extends BABYLON.MaterialPluginBase {
|
1149
|
+
private readonly _atmosphere;
|
1150
|
+
private readonly _isAerialPerspectiveEnabled;
|
1151
|
+
/**
|
1152
|
+
* Constructs the {@link AtmospherePBRMaterialPlugin}.
|
1153
|
+
* @param material - The material to apply the plugin to.
|
1154
|
+
* @param _atmosphere - The atmosphere to use for shading.
|
1155
|
+
* @param _isAerialPerspectiveEnabled - Whether to apply aerial perspective.
|
1156
|
+
*/
|
1157
|
+
constructor(material: BABYLON.Material, _atmosphere: Atmosphere, _isAerialPerspectiveEnabled?: boolean);
|
1158
|
+
/**
|
1159
|
+
* @override
|
1160
|
+
*/
|
1161
|
+
getUniformBuffersNames(_ubos: string[]): void;
|
1162
|
+
/**
|
1163
|
+
* @override
|
1164
|
+
*/
|
1165
|
+
getUniforms(): {
|
1166
|
+
ubo: {
|
1167
|
+
name: string;
|
1168
|
+
size: number;
|
1169
|
+
type: string;
|
1170
|
+
}[];
|
1171
|
+
fragment: string;
|
1172
|
+
externalUniforms: string[];
|
1173
|
+
};
|
1174
|
+
/**
|
1175
|
+
* @override
|
1176
|
+
*/
|
1177
|
+
isReadyForSubMesh(): boolean;
|
1178
|
+
/**
|
1179
|
+
* @override
|
1180
|
+
*/
|
1181
|
+
getActiveTextures(_activeTextures: BABYLON.BaseTexture[]): void;
|
1182
|
+
/**
|
1183
|
+
* @override
|
1184
|
+
*/
|
1185
|
+
bindForSubMesh(uniformBuffer: BABYLON.UniformBuffer): void;
|
1186
|
+
/**
|
1187
|
+
* @override
|
1188
|
+
*/
|
1189
|
+
prepareDefines(defines: AtmospherePBRMaterialDefines): void;
|
1190
|
+
/**
|
1191
|
+
* @override
|
1192
|
+
*/
|
1193
|
+
getSamplers(samplers: string[]): void;
|
1194
|
+
/**
|
1195
|
+
* @override
|
1196
|
+
*/
|
1197
|
+
getCustomCode(shaderType: string): BABYLON.Nullable<Record<string, string>>;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
|
1201
|
+
/**
|
1202
|
+
* Creation options for the {@link Atmosphere}.
|
1203
|
+
*/
|
1204
|
+
export interface IAtmosphereOptions {
|
1205
|
+
/**
|
1206
|
+
* The properties that define the atmosphere's composition and size.
|
1207
|
+
*/
|
1208
|
+
physicalProperties?: AtmospherePhysicalProperties;
|
1209
|
+
/**
|
1210
|
+
* An optional depth texture that will be used by the fullscreen passes that render the sky, aerial perspective, or globe atmosphere.
|
1211
|
+
* This enables deferred rendering scenarios, where atmospheric effects need to be composited onto geometry buffers.
|
1212
|
+
* Expects infinite far plane on the camera (camera.maxZ = 0) and a non-linear depth to be stored in the red channel.
|
1213
|
+
*/
|
1214
|
+
depthTexture?: BABYLON.BaseTexture;
|
1215
|
+
/**
|
1216
|
+
* Controls the overall brightness of the atmosphere rendering.
|
1217
|
+
* A value of 1.0 is physically correct.
|
1218
|
+
*/
|
1219
|
+
exposure?: number;
|
1220
|
+
/**
|
1221
|
+
* Whether the light values should be specified in linear space.
|
1222
|
+
* Set to true when using PBRMaterials, which expect linear light values.
|
1223
|
+
*/
|
1224
|
+
isLinearSpaceLight?: boolean;
|
1225
|
+
/**
|
1226
|
+
* Whether the composition of the sky should be in linear space.
|
1227
|
+
* Set to true for HDR rendering or when using image post-processes.
|
1228
|
+
*/
|
1229
|
+
isLinearSpaceComposition?: boolean;
|
1230
|
+
/**
|
1231
|
+
* Whether to apply approximate transmittance to dim surfaces behind the atmosphere.
|
1232
|
+
* When true, distant surfaces are dimmed using a grayscale approximation of transmittance.
|
1233
|
+
*/
|
1234
|
+
applyApproximateTransmittance?: boolean;
|
1235
|
+
/**
|
1236
|
+
* Whether to use the sky view LUT for compositing the sky.
|
1237
|
+
* When false, full ray marching is required (slower).
|
1238
|
+
*/
|
1239
|
+
isSkyViewLutEnabled?: boolean;
|
1240
|
+
/**
|
1241
|
+
* Whether to use the aerial perspective LUT.
|
1242
|
+
* When false, full ray marching is required for aerial perspective (slower).
|
1243
|
+
*/
|
1244
|
+
isAerialPerspectiveLutEnabled?: boolean;
|
1245
|
+
/**
|
1246
|
+
* Radiance bias applied to the aerial perspective.
|
1247
|
+
* Positive values brighten the aerial perspective, negative values darken it.
|
1248
|
+
* The default is 0 (no change).
|
1249
|
+
*/
|
1250
|
+
aerialPerspectiveRadianceBias?: number;
|
1251
|
+
/**
|
1252
|
+
* Scale factor for the amount of light transmitted into aerial perspective from the light source.
|
1253
|
+
* The default is 1 (no scaling).
|
1254
|
+
*/
|
1255
|
+
aerialPerspectiveTransmittanceScale?: number;
|
1256
|
+
/**
|
1257
|
+
* Amount of saturation applied to the aerial perspective.
|
1258
|
+
* Lower values make the aerial perspective more gray.
|
1259
|
+
* The default is 1 (no saturation change).
|
1260
|
+
*/
|
1261
|
+
aerialPerspectiveSaturation?: number;
|
1262
|
+
/**
|
1263
|
+
* Overall intensity multiplier for the aerial perspective effect.
|
1264
|
+
* Higher values increase haziness.
|
1265
|
+
* The default is 1 (no intensity change).
|
1266
|
+
*/
|
1267
|
+
aerialPerspectiveIntensity?: number;
|
1268
|
+
/**
|
1269
|
+
* Whether to use the diffuse sky irradiance LUT.
|
1270
|
+
*/
|
1271
|
+
isDiffuseSkyIrradianceLutEnabled?: boolean;
|
1272
|
+
/**
|
1273
|
+
* Higher values result in more desaturated diffuse irradiance.
|
1274
|
+
* The default is 0 (no desaturation).
|
1275
|
+
*/
|
1276
|
+
diffuseSkyIrradianceDesaturationFactor?: number;
|
1277
|
+
/**
|
1278
|
+
* Overall intensity multiplier for the diffuse irradiance.
|
1279
|
+
* The default is 1 (no intensity change).
|
1280
|
+
*/
|
1281
|
+
diffuseSkyIrradianceIntensity?: number;
|
1282
|
+
/**
|
1283
|
+
* Controls the intensity of the additional diffuse irradiance amount.
|
1284
|
+
*/
|
1285
|
+
additionalDiffuseSkyIrradianceIntensity?: number;
|
1286
|
+
/**
|
1287
|
+
* Controls the color of the additional diffuse irradiance amount.
|
1288
|
+
*/
|
1289
|
+
additionalDiffuseSkyIrradianceColor?: BABYLON.IColor3Like;
|
1290
|
+
/**
|
1291
|
+
* Higher values increase the contribution of multiple scattering to the overall atmosphere.
|
1292
|
+
* Default is 1 (no intensity change).
|
1293
|
+
*/
|
1294
|
+
multiScatteringIntensity?: number;
|
1295
|
+
/**
|
1296
|
+
* Average color of light reflected off the ground.
|
1297
|
+
* Affects the multiply scattered light contribution in the atmosphere.
|
1298
|
+
*/
|
1299
|
+
groundAlbedo?: BABYLON.IColor3Like;
|
1300
|
+
/**
|
1301
|
+
* Minimum color for multiple scattering.
|
1302
|
+
* Useful for creating a quick, but not physically accurate, night sky.
|
1303
|
+
*/
|
1304
|
+
minimumMultiScatteringColor?: BABYLON.IColor3Like;
|
1305
|
+
/**
|
1306
|
+
* Controls the intensity of the {@link minimumMultiScatteringColor}.
|
1307
|
+
* Useful for creating a quick, but not physically accurate, night sky.
|
1308
|
+
*/
|
1309
|
+
minimumMultiScatteringIntensity?: number;
|
1310
|
+
/**
|
1311
|
+
* Height in kilometers of the scene's origin relative to the planet surface.
|
1312
|
+
*/
|
1313
|
+
originHeight?: number;
|
1314
|
+
/**
|
1315
|
+
* The rendering group ID for the sky compositor.
|
1316
|
+
* When specified, the sky will only be rendered for this group.
|
1317
|
+
* If not specified, defaults to group 0.
|
1318
|
+
*/
|
1319
|
+
skyRenderingGroup?: number;
|
1320
|
+
/**
|
1321
|
+
* The rendering group ID for the aerial perspective compositor.
|
1322
|
+
* When specified, aerial perspective will only be rendered for this group.
|
1323
|
+
* If not specified, defaults to group 0.
|
1324
|
+
*/
|
1325
|
+
aerialPerspectiveRenderingGroup?: number;
|
1326
|
+
/**
|
1327
|
+
* The rendering group ID for the globe atmosphere compositor.
|
1328
|
+
* When specified, the globe atmosphere will only be rendered for this group.
|
1329
|
+
* If not specified, defaults to group 0.
|
1330
|
+
*/
|
1331
|
+
globeAtmosphereRenderingGroup?: number;
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
|
1335
|
+
/**
|
1336
|
+
* Renders a physically based atmosphere.
|
1337
|
+
* Use {@link IsSupported} to check if the atmosphere is supported before creating an instance.
|
1338
|
+
* @experimental
|
1339
|
+
*/
|
1340
|
+
export class Atmosphere implements BABYLON.IDisposable {
|
1341
|
+
readonly name: string;
|
1342
|
+
readonly scene: BABYLON.Scene;
|
1343
|
+
private readonly _directionToLight;
|
1344
|
+
private readonly _tempSceneAmbient;
|
1345
|
+
private readonly _engine;
|
1346
|
+
private _physicalProperties;
|
1347
|
+
private _transmittanceLut;
|
1348
|
+
private _diffuseSkyIrradianceLut;
|
1349
|
+
private _isSkyViewLutEnabled;
|
1350
|
+
private _isAerialPerspectiveLutEnabled;
|
1351
|
+
private _aerialPerspectiveTransmittanceScale;
|
1352
|
+
private _aerialPerspectiveSaturation;
|
1353
|
+
private _aerialPerspectiveIntensity;
|
1354
|
+
private _aerialPerspectiveRadianceBias;
|
1355
|
+
private _diffuseSkyIrradianceDesaturationFactor;
|
1356
|
+
private _additionalDiffuseSkyIrradianceIntensity;
|
1357
|
+
private _additionalDiffuseSkyIrradianceColor;
|
1358
|
+
private _additionalDiffuseSkyIrradiance;
|
1359
|
+
private _diffuseSkyIrradianceIntensity;
|
1360
|
+
private _multiScatteringIntensity;
|
1361
|
+
private _groundAlbedo;
|
1362
|
+
private _minimumMultiScatteringColor;
|
1363
|
+
private _minimumMultiScatteringIntensity;
|
1364
|
+
private _lights;
|
1365
|
+
private _atmosphereUbo;
|
1366
|
+
private _minimumMultiScattering;
|
1367
|
+
private _cameraAtmosphereVariables;
|
1368
|
+
private _isLinearSpaceComposition;
|
1369
|
+
private _isLinearSpaceLight;
|
1370
|
+
private _lightRadianceAtCamera;
|
1371
|
+
private _linearLightColor;
|
1372
|
+
private _originHeight;
|
1373
|
+
private _applyApproximateTransmittance;
|
1374
|
+
private _exposure;
|
1375
|
+
private _atmosphereUniformBufferAsArray;
|
1376
|
+
private _effectRenderer;
|
1377
|
+
private _skyRenderingGroup;
|
1378
|
+
private _aerialPerspectiveRenderingGroup;
|
1379
|
+
private _globeAtmosphereRenderingGroup;
|
1380
|
+
private _isEnabled;
|
1381
|
+
private _hasRenderedMultiScatteringLut;
|
1382
|
+
private _multiScatteringEffectWrapper;
|
1383
|
+
private _multiScatteringLutRenderTarget;
|
1384
|
+
private _aerialPerspectiveLutEffectWrapper;
|
1385
|
+
private _aerialPerspectiveLutEffectRenderer;
|
1386
|
+
private _aerialPerspectiveLutRenderTarget;
|
1387
|
+
private _skyViewLutEffectWrapper;
|
1388
|
+
private _skyViewLutEffectRenderer;
|
1389
|
+
private _skyViewLutRenderTarget;
|
1390
|
+
private _aerialPerspectiveCompositorEffectWrapper;
|
1391
|
+
private _skyCompositorEffectWrapper;
|
1392
|
+
private _globeAtmosphereCompositorEffectWrapper;
|
1393
|
+
private _onBeforeCameraRenderObserver;
|
1394
|
+
private _onBeforeDrawPhaseObserver;
|
1395
|
+
private _onAfterRenderingGroupObserver;
|
1396
|
+
/**
|
1397
|
+
* Checks if the {@link Atmosphere} is supported.
|
1398
|
+
* @param engine - The engine to check.
|
1399
|
+
* @returns True if the atmosphere is supported, false otherwise.
|
1400
|
+
*/
|
1401
|
+
static IsSupported(engine: BABYLON.AbstractEngine): boolean;
|
1402
|
+
/**
|
1403
|
+
* Called after the atmosphere variables have been updated for the specified camera.
|
1404
|
+
*/
|
1405
|
+
readonly onAfterUpdateVariablesForCameraObservable: BABYLON.Observable<BABYLON.Camera>;
|
1406
|
+
/**
|
1407
|
+
* Called immediately before the light variables are finalized.
|
1408
|
+
*/
|
1409
|
+
readonly onBeforeLightVariablesUpdateObservable: BABYLON.Observable<void>;
|
1410
|
+
/**
|
1411
|
+
* Called before the LUTs are rendered for this camera. This happens after the per-camera UBO update.
|
1412
|
+
*/
|
1413
|
+
readonly onBeforeRenderLutsForCameraObservable: BABYLON.Observable<void>;
|
1414
|
+
/**
|
1415
|
+
* Called after the LUTs were rendered.
|
1416
|
+
*/
|
1417
|
+
readonly onAfterRenderLutsForCameraObservable: BABYLON.Observable<void>;
|
1418
|
+
/**
|
1419
|
+
* If provided, this is the depth texture used for composition passes.
|
1420
|
+
* Expects an infinite far plane on the camera (camera.maxZ = 0) and the non-linear depth accessible in red channel.
|
1421
|
+
* @internal
|
1422
|
+
*/
|
1423
|
+
readonly depthTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
|
1424
|
+
/**
|
1425
|
+
* Controls the overall brightness of the atmosphere rendering.
|
1426
|
+
*/
|
1427
|
+
get exposure(): number;
|
1428
|
+
set exposure(value: number);
|
1429
|
+
/**
|
1430
|
+
* Affects the overall intensity of the multiple scattering.
|
1431
|
+
*/
|
1432
|
+
get multiScatteringIntensity(): number;
|
1433
|
+
set multiScatteringIntensity(value: number);
|
1434
|
+
/**
|
1435
|
+
* Affects the multiply scattered light contribution in the atmosphere by describing the average light color reflected off the ground.
|
1436
|
+
*/
|
1437
|
+
get groundAlbedo(): BABYLON.DeepImmutable<BABYLON.IColor3Like>;
|
1438
|
+
set groundAlbedo(value: BABYLON.DeepImmutable<BABYLON.IColor3Like>);
|
1439
|
+
/**
|
1440
|
+
* Can be used to clamp the multiple scattering to a minimum value.
|
1441
|
+
*/
|
1442
|
+
get minimumMultiScatteringColor(): BABYLON.DeepImmutable<BABYLON.IColor3Like>;
|
1443
|
+
set minimumMultiScatteringColor(value: BABYLON.DeepImmutable<BABYLON.IColor3Like>);
|
1444
|
+
/**
|
1445
|
+
* This is an additional scaling factor applied to the {@link minimumMultiScatteringColor}.
|
1446
|
+
*/
|
1447
|
+
get minimumMultiScatteringIntensity(): number;
|
1448
|
+
set minimumMultiScatteringIntensity(value: number);
|
1449
|
+
/**
|
1450
|
+
* Can be used to force the diffuse irradiance towards a gray color.
|
1451
|
+
*/
|
1452
|
+
get diffuseSkyIrradianceDesaturationFactor(): number;
|
1453
|
+
set diffuseSkyIrradianceDesaturationFactor(value: number);
|
1454
|
+
/**
|
1455
|
+
* This is an additional amount of irradiance added to the diffuse irradiance.
|
1456
|
+
*/
|
1457
|
+
get additionalDiffuseSkyIrradianceIntensity(): number;
|
1458
|
+
set additionalDiffuseSkyIrradianceIntensity(value: number);
|
1459
|
+
/**
|
1460
|
+
* This is the color for the additional amount of irradiance added to the diffuse irradiance.
|
1461
|
+
*/
|
1462
|
+
get additionalDiffuseSkyIrradianceColor(): BABYLON.DeepImmutable<BABYLON.IColor3Like>;
|
1463
|
+
set additionalDiffuseSkyIrradianceColor(value: BABYLON.DeepImmutable<BABYLON.IColor3Like>);
|
1464
|
+
/**
|
1465
|
+
* The final additional diffuse irradiance, taking into account the intensity and color.
|
1466
|
+
*/
|
1467
|
+
get additionalDiffuseSkyIrradiance(): BABYLON.DeepImmutable<BABYLON.IColor3Like>;
|
1468
|
+
/**
|
1469
|
+
* The intensity of the diffuse irradiance.
|
1470
|
+
*/
|
1471
|
+
get diffuseSkyIrradianceIntensity(): number;
|
1472
|
+
set diffuseSkyIrradianceIntensity(value: number);
|
1473
|
+
/**
|
1474
|
+
* True if the sky view LUT should be used for compositing the sky instead of a per-pixel ray march.
|
1475
|
+
*/
|
1476
|
+
get isSkyViewLutEnabled(): boolean;
|
1477
|
+
set isSkyViewLutEnabled(value: boolean);
|
1478
|
+
/**
|
1479
|
+
* Gets the sky view LUT render target or null if not enabled.
|
1480
|
+
* @returns The render target.
|
1481
|
+
*/
|
1482
|
+
get skyViewLutRenderTarget(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
|
1483
|
+
/**
|
1484
|
+
* True if the aerial perspective LUT should be used.
|
1485
|
+
* If false, full ray marching would be used instead.
|
1486
|
+
*/
|
1487
|
+
get isAerialPerspectiveLutEnabled(): boolean;
|
1488
|
+
set isAerialPerspectiveLutEnabled(value: boolean);
|
1489
|
+
/**
|
1490
|
+
* Gets the aerial perspective LUT render target or null if not enabled.
|
1491
|
+
* @returns The render target.
|
1492
|
+
*/
|
1493
|
+
get aerialPerspectiveLutRenderTarget(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
|
1494
|
+
/**
|
1495
|
+
* The intensity of the aerial perspective.
|
1496
|
+
*/
|
1497
|
+
get aerialPerspectiveIntensity(): number;
|
1498
|
+
set aerialPerspectiveIntensity(value: number);
|
1499
|
+
/**
|
1500
|
+
* The amount of light transmitted into aerial perspective.
|
1501
|
+
* A scale of 1 is physically correct.
|
1502
|
+
*/
|
1503
|
+
get aerialPerspectiveTransmittanceScale(): number;
|
1504
|
+
set aerialPerspectiveTransmittanceScale(value: number);
|
1505
|
+
/**
|
1506
|
+
* The amount of saturation applied to the aerial perspective.
|
1507
|
+
* Reducing to zero desaturates the aerial perspective completely.
|
1508
|
+
* A value of 1 has no effect.
|
1509
|
+
*/
|
1510
|
+
get aerialPerspectiveSaturation(): number;
|
1511
|
+
set aerialPerspectiveSaturation(value: number);
|
1512
|
+
/**
|
1513
|
+
* A radiance bias applied to aerial perspective.
|
1514
|
+
*/
|
1515
|
+
get aerialPerspectiveRadianceBias(): number;
|
1516
|
+
set aerialPerspectiveRadianceBias(value: number);
|
1517
|
+
/**
|
1518
|
+
* True if the composition should be in linear space (e.g. for HDR rendering).
|
1519
|
+
* Typically linear space is expected when ImageProcessing is enabled via PostProcesses.
|
1520
|
+
* False for non-linear output.
|
1521
|
+
*/
|
1522
|
+
get isLinearSpaceComposition(): boolean;
|
1523
|
+
set isLinearSpaceComposition(value: boolean);
|
1524
|
+
/**
|
1525
|
+
* True if the {@link light} value should be specified in linear space.
|
1526
|
+
* If using PBRMaterials, light value is expected to be linear.
|
1527
|
+
*/
|
1528
|
+
get isLinearSpaceLight(): boolean;
|
1529
|
+
set isLinearSpaceLight(value: boolean);
|
1530
|
+
/**
|
1531
|
+
* The lookup table for transmittance.
|
1532
|
+
*/
|
1533
|
+
get transmittanceLut(): BABYLON.Nullable<TransmittanceLut>;
|
1534
|
+
/**
|
1535
|
+
* Gets the multiple scattering LUT render target.
|
1536
|
+
* @returns The render target.
|
1537
|
+
*/
|
1538
|
+
get multiScatteringLutRenderTarget(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
|
1539
|
+
/**
|
1540
|
+
* The lookup table for diffuse sky irradiance, or null if not enabled.
|
1541
|
+
*/
|
1542
|
+
get diffuseSkyIrradianceLut(): BABYLON.Nullable<DiffuseSkyIrradianceLut>;
|
1543
|
+
/**
|
1544
|
+
* The properties used to describe the size and optical parameters of the atmosphere.
|
1545
|
+
*/
|
1546
|
+
get physicalProperties(): AtmospherePhysicalProperties;
|
1547
|
+
/**
|
1548
|
+
* The height in kilometers of the scene's origin.
|
1549
|
+
*/
|
1550
|
+
get originHeight(): number;
|
1551
|
+
set originHeight(value: number);
|
1552
|
+
/**
|
1553
|
+
* When atmospheric scattering is applied to surfaces, if this value is set to true,
|
1554
|
+
* a grayscale approximation of the transmittance is used to dim surfaces.
|
1555
|
+
*
|
1556
|
+
* When set to false, the atmospheric composition does not dim the surfaces behind it.
|
1557
|
+
* It is up to the client application to apply transmittance manually.
|
1558
|
+
*/
|
1559
|
+
get applyApproximateTransmittance(): boolean;
|
1560
|
+
set applyApproximateTransmittance(value: boolean);
|
1561
|
+
/**
|
1562
|
+
* The directional lights in the scene which represent the suns illuminating the atmosphere.
|
1563
|
+
* Each frame, the color and intensity of the lights are updated based on the camera position and the light's direction.
|
1564
|
+
*/
|
1565
|
+
get lights(): ReadonlyArray<BABYLON.DirectionalLight>;
|
1566
|
+
/**
|
1567
|
+
* The rendering group ID for the sky compositor.
|
1568
|
+
* The sky will only be rendered for this group.
|
1569
|
+
*/
|
1570
|
+
get skyRenderingGroup(): number;
|
1571
|
+
set skyRenderingGroup(value: number);
|
1572
|
+
/**
|
1573
|
+
* The rendering group ID for the aerial perspective compositor.
|
1574
|
+
* Aerial perspective will only be rendered for this group.
|
1575
|
+
*/
|
1576
|
+
get aerialPerspectiveRenderingGroup(): number;
|
1577
|
+
set aerialPerspectiveRenderingGroup(value: number);
|
1578
|
+
/**
|
1579
|
+
* The rendering group ID for the globe atmosphere compositor.
|
1580
|
+
* The globe atmosphere will only be rendered for this group.
|
1581
|
+
*/
|
1582
|
+
get globeAtmosphereRenderingGroup(): number;
|
1583
|
+
set globeAtmosphereRenderingGroup(value: number);
|
1584
|
+
/**
|
1585
|
+
* Gets the uniform buffer used to store the atmosphere's physical properties.
|
1586
|
+
*/
|
1587
|
+
get uniformBuffer(): BABYLON.UniformBuffer;
|
1588
|
+
/**
|
1589
|
+
* Gets the camera-related variables for this atmosphere. Updated each frame.
|
1590
|
+
*/
|
1591
|
+
get cameraAtmosphereVariables(): AtmospherePerCameraVariables;
|
1592
|
+
private _peakRayleighScatteringMmInternal;
|
1593
|
+
private _peakRayleighScatteringKm;
|
1594
|
+
private _peakMieScatteringMmInternal;
|
1595
|
+
private _peakMieScatteringKm;
|
1596
|
+
private _peakMieAbsorptionMmInternal;
|
1597
|
+
private _peakMieAbsorptionKm;
|
1598
|
+
private _peakOzoneAbsorptionMmInternal;
|
1599
|
+
private _peakOzoneAbsorptionKm;
|
1600
|
+
private get _planetRadius();
|
1601
|
+
private set _planetRadius(value);
|
1602
|
+
private get _planetRadiusOffset();
|
1603
|
+
private set _planetRadiusOffset(value);
|
1604
|
+
private get _atmosphereThickness();
|
1605
|
+
private set _atmosphereThickness(value);
|
1606
|
+
private get _rayleighScatteringScale();
|
1607
|
+
private set _rayleighScatteringScale(value);
|
1608
|
+
private get _peakRayleighScatteringMm();
|
1609
|
+
private set _peakRayleighScatteringMm(value);
|
1610
|
+
private get _mieScatteringScale();
|
1611
|
+
private set _mieScatteringScale(value);
|
1612
|
+
private get _peakMieScatteringMm();
|
1613
|
+
private set _peakMieScatteringMm(value);
|
1614
|
+
private get _mieAbsorptionScale();
|
1615
|
+
private set _mieAbsorptionScale(value);
|
1616
|
+
private get _peakMieAbsorptionMm();
|
1617
|
+
private set _peakMieAbsorptionMm(value);
|
1618
|
+
private get _ozoneAbsorptionScale();
|
1619
|
+
private set _ozoneAbsorptionScale(value);
|
1620
|
+
private get _peakOzoneAbsorptionMm();
|
1621
|
+
private set _peakOzoneAbsorptionMm(value);
|
1622
|
+
/**
|
1623
|
+
* Constructs the {@link Atmosphere}.
|
1624
|
+
* @param name - The name of this instance.
|
1625
|
+
* @param scene - The scene to which the atmosphere will be added.
|
1626
|
+
* @param lights - The light sources that illuminate the atmosphere. Currently only supports one light, and that light should be the first light in the scene.
|
1627
|
+
* @param options - The options used to create the atmosphere.
|
1628
|
+
*/
|
1629
|
+
constructor(name: string, scene: BABYLON.Scene, lights: BABYLON.DirectionalLight[], options?: IAtmosphereOptions);
|
1630
|
+
/**
|
1631
|
+
* @override
|
1632
|
+
*/
|
1633
|
+
dispose(): void;
|
1634
|
+
/**
|
1635
|
+
* True if the atmosphere is enabled.
|
1636
|
+
* @returns - True if the atmosphere is enabled.
|
1637
|
+
*/
|
1638
|
+
isEnabled(): boolean;
|
1639
|
+
/**
|
1640
|
+
* Sets the enabled state of the atmosphere.
|
1641
|
+
* @param enabled - True to enable the atmosphere, false to disable it.
|
1642
|
+
*/
|
1643
|
+
setEnabled(enabled: boolean): void;
|
1644
|
+
/**
|
1645
|
+
* The class name of the {@link Atmosphere}.
|
1646
|
+
* @returns - The class name of the atmosphere.
|
1647
|
+
*/
|
1648
|
+
getClassName(): string;
|
1649
|
+
/**
|
1650
|
+
* Gets the color of a light after being transmitted through the atmosphere to a point specified by its distance to the planet center and its geocentric normal.
|
1651
|
+
* NOTE, the result is always a linear space color.
|
1652
|
+
* @param directionToLight - The direction of the light.
|
1653
|
+
* @param pointRadius - The distance from the planet center to the point in kilometers.
|
1654
|
+
* @param pointGeocentricNormal - The geocentric normal at the point i.e., normalize(point - planet center).
|
1655
|
+
* @param result - The color to store the result in.
|
1656
|
+
* @returns The result color.
|
1657
|
+
*/
|
1658
|
+
getTransmittedColorToRef: <T extends BABYLON.IColor3Like>(directionToLight: BABYLON.IVector3Like, pointRadius: number, pointGeocentricNormal: BABYLON.IVector3Like, result: T) => T;
|
1659
|
+
/**
|
1660
|
+
* Gets the diffuse sky irradiance. Result is always in linear space.
|
1661
|
+
* @param directionToLight - The direction of the point to the light.
|
1662
|
+
* @param pointRadius - The distance from the planet center to the point in kilometers.
|
1663
|
+
* @param pointGeocentricNormal - The geocentric normal at the point: normalize(point - planet center).
|
1664
|
+
* @param lightIrradiance - The irradiance of the light.
|
1665
|
+
* @param result - The color to store the result in.
|
1666
|
+
* @returns The result color.
|
1667
|
+
*/
|
1668
|
+
getDiffuseSkyIrradianceToRef: <T extends BABYLON.IColor3Like>(directionToLight: BABYLON.IVector3Like, pointRadius: number, pointGeocentricNormal: BABYLON.IVector3Like, lightIrradiance: number, result: T) => T;
|
1669
|
+
/**
|
1670
|
+
* Creates a new {@link EffectWrapper} for the multiple scattering LUT
|
1671
|
+
* @returns The newly created {@link EffectWrapper}.
|
1672
|
+
*/
|
1673
|
+
private _createMultiScatteringEffectWrapper;
|
1674
|
+
/**
|
1675
|
+
* Draws the multiple scattering LUT using {@link EffectWrapper} and {@link EffectRenderer}.
|
1676
|
+
*/
|
1677
|
+
private _drawMultiScatteringLut;
|
1678
|
+
/**
|
1679
|
+
* Draws the aerial perspective compositor using {@link EffectWrapper} and {@link EffectRenderer}.
|
1680
|
+
*/
|
1681
|
+
private _drawAerialPerspectiveCompositor;
|
1682
|
+
/**
|
1683
|
+
* Draws the sky compositor using {@link EffectWrapper} and {@link EffectRenderer}.
|
1684
|
+
*/
|
1685
|
+
private _drawSkyCompositor;
|
1686
|
+
/**
|
1687
|
+
* Draws the globe atmosphere compositor using {@link EffectWrapper} and {@link EffectRenderer}.
|
1688
|
+
*/
|
1689
|
+
private _drawGlobeAtmosphereCompositor;
|
1690
|
+
private _disposeSkyCompositor;
|
1691
|
+
private _disposeAerialPerspectiveCompositor;
|
1692
|
+
private _disposeGlobeAtmosphereCompositor;
|
1693
|
+
/**
|
1694
|
+
* Updates the camera variables that are specific to the atmosphere.
|
1695
|
+
* @param camera - The camera to update the variables for.
|
1696
|
+
*/
|
1697
|
+
private _updatePerCameraVariables;
|
1698
|
+
/**
|
1699
|
+
* Renders the lookup tables, some of which can vary per-camera.
|
1700
|
+
* It is expected that updatePerCameraVariables was previously called.
|
1701
|
+
*/
|
1702
|
+
private _renderLutsForCamera;
|
1703
|
+
/**
|
1704
|
+
* Renders the lookup tables that do not depend on a camera position.
|
1705
|
+
*/
|
1706
|
+
renderGlobalLuts(): void;
|
1707
|
+
/**
|
1708
|
+
* Binds the atmosphere's uniform buffer to an {@link BABYLON.Effect}.
|
1709
|
+
* @param effect - The {@link BABYLON.Effect} to bind the uniform buffer to.
|
1710
|
+
*/
|
1711
|
+
bindUniformBufferToEffect(effect: BABYLON.Effect): void;
|
1712
|
+
/**
|
1713
|
+
* Updates the atmosphere's uniform buffer.
|
1714
|
+
*/
|
1715
|
+
private _updateUniformBuffer;
|
1716
|
+
/**
|
1717
|
+
* Draws the aerial perspective LUT using {@link EffectWrapper} and {@link EffectRenderer}.
|
1718
|
+
*/
|
1719
|
+
private _drawAerialPerspectiveLut;
|
1720
|
+
/**
|
1721
|
+
* Draws the sky view LUT using {@link EffectWrapper} and {@link EffectRenderer}.
|
1722
|
+
*/
|
1723
|
+
private _drawSkyViewLut;
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
|
1727
|
+
/** @internal */
|
1728
|
+
export var transmittancePixelShader: {
|
1729
|
+
name: string;
|
1730
|
+
shader: string;
|
1731
|
+
};
|
1732
|
+
|
1733
|
+
|
1734
|
+
/** @internal */
|
1735
|
+
export var skyViewPixelShader: {
|
1736
|
+
name: string;
|
1737
|
+
shader: string;
|
1738
|
+
};
|
1739
|
+
|
1740
|
+
|
1741
|
+
/** @internal */
|
1742
|
+
export var multiScatteringPixelShader: {
|
1743
|
+
name: string;
|
1744
|
+
shader: string;
|
1745
|
+
};
|
1746
|
+
|
1747
|
+
|
1748
|
+
/** @internal */
|
1749
|
+
export var fullscreenTriangleVertexShader: {
|
1750
|
+
name: string;
|
1751
|
+
shader: string;
|
1752
|
+
};
|
1753
|
+
|
1754
|
+
|
1755
|
+
/** @internal */
|
1756
|
+
export var diffuseSkyIrradiancePixelShader: {
|
1757
|
+
name: string;
|
1758
|
+
shader: string;
|
1759
|
+
};
|
1760
|
+
|
1761
|
+
|
1762
|
+
/** @internal */
|
1763
|
+
export var compositeSkyPixelShader: {
|
1764
|
+
name: string;
|
1765
|
+
shader: string;
|
1766
|
+
};
|
1767
|
+
|
1768
|
+
|
1769
|
+
/** @internal */
|
1770
|
+
export var compositeGlobeAtmospherePixelShader: {
|
1771
|
+
name: string;
|
1772
|
+
shader: string;
|
1773
|
+
};
|
1774
|
+
|
1775
|
+
|
1776
|
+
/** @internal */
|
1777
|
+
export var compositeAerialPerspectivePixelShader: {
|
1778
|
+
name: string;
|
1779
|
+
shader: string;
|
1780
|
+
};
|
1781
|
+
|
1782
|
+
|
1783
|
+
/** @internal */
|
1784
|
+
export var aerialPerspectivePixelShader: {
|
1785
|
+
name: string;
|
1786
|
+
shader: string;
|
1787
|
+
};
|
1788
|
+
|
1789
|
+
|
1790
|
+
/** @internal */
|
1791
|
+
export var depthFunctions: {
|
1792
|
+
name: string;
|
1793
|
+
shader: string;
|
1794
|
+
};
|
1795
|
+
|
1796
|
+
|
1797
|
+
/** @internal */
|
1798
|
+
export var atmosphereVertexDeclaration: {
|
1799
|
+
name: string;
|
1800
|
+
shader: string;
|
1801
|
+
};
|
1802
|
+
|
1803
|
+
|
1804
|
+
/** @internal */
|
1805
|
+
export var atmosphereUboDeclaration: {
|
1806
|
+
name: string;
|
1807
|
+
shader: string;
|
1808
|
+
};
|
1809
|
+
|
1810
|
+
|
1811
|
+
/** @internal */
|
1812
|
+
export var atmosphereFunctions: {
|
1813
|
+
name: string;
|
1814
|
+
shader: string;
|
1815
|
+
};
|
1816
|
+
|
1817
|
+
|
1818
|
+
/** @internal */
|
1819
|
+
export var atmosphereFragmentDeclaration: {
|
1820
|
+
name: string;
|
1821
|
+
shader: string;
|
1822
|
+
};
|
1823
|
+
|
1824
|
+
|
686
1825
|
|
687
1826
|
}
|
688
1827
|
|