Skip to content

Commit b34e329

Browse files
authored
Merge pull request #7231 from OmarShehata/ibl
Add doc for IBL example
2 parents 289e388 + eb39ee7 commit b34e329

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Apps/Sandcastle/gallery/Image-Based Lighting.html

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
var environmentMapURL = '../../SampleData/EnvironmentMap/kiara_6_afternoon_2k_ibl.ktx';
3333
var modelURL = '../../SampleData/models/Spheres/MetalRoughSpheres.glb';
3434

35+
// This environment map was processed using Google's Filament project. To process your own:
36+
// 1 - Download the Filament release (https://github.com/google/filament/releases).
37+
// 2 - Run `cmgen --type=ktx --deploy=/path/to/output /path/to/image.hdr`. Other formats are also supported. Run `cmgen --help` for all options.
38+
// 3 - Take the generated coefficients and the KTX file and load them in CesiumJS as shown below.
39+
3540
var L00 = new Cesium.Cartesian3( 0.170455150831422, 0.163151083190219, 0.196966760289763);
3641
var L1_1 = new Cesium.Cartesian3(-0.066550267689383, -0.022088055746048, 0.078835009246127);
3742
var L10 = new Cesium.Cartesian3( 0.038364097478591, 0.045714300098753, 0.063498904606215);

Source/Scene/Model.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ define([
11601160
*
11611161
* @memberof Model.prototype
11621162
*
1163+
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Image-Based Lighting.html|Sandcastle Image Based Lighting Demo}
11631164
* @type {Number}
11641165
* @default 1.0
11651166
*/
@@ -1178,18 +1179,22 @@ define([
11781179
},
11791180

11801181
/**
1181-
* The third order spherical harmonic coefficients used for the diffuse color of image-based lighting. When <code>undefined</code>, <code>diffuseIrradiance</code>
1182-
* will be used.
1182+
* The third order spherical harmonic coefficients used for the diffuse color of image-based lighting. When <code>undefined</code>, a diffuse irradiance
1183+
* computed from the atmosphere color is used.
11831184
* <p>
11841185
* There are nine <code>Cartesian3</code> coefficients.
1185-
* The order of the coefficients is: L<sub>00</sub>, L<sub>1-1</sub>, L<sub>10</sub>, L<sub>11</sub>, L<sub>2-2</sub>, L<sub>2-1</sub>, L<sub>20</sub>, L<sub>21<sub>, L<sub>22</sub>
1186+
* The order of the coefficients is: L<sub>00</sub>, L<sub>1-1</sub>, L<sub>10</sub>, L<sub>11</sub>, L<sub>2-2</sub>, L<sub>2-1</sub>, L<sub>20</sub>, L<sub>21</sub>, L<sub>22</sub>
11861187
* </p>
11871188
*
1189+
* These values can be obtained by preprocessing the environment map using the <code>cmgen</code> tool of
1190+
* {@link https://github.com/google/filament/releases | Google's Filament project}. This will also generate a KTX file that can be
1191+
* supplied to {@link Model#specularEnvironmentMaps}.
1192+
*
11881193
* @memberof Model.prototype
11891194
*
11901195
* @type {Cartesian3[]}
11911196
* @default undefined
1192-
*
1197+
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Image-Based Lighting.html|Sandcastle Image Based Lighting Demo}
11931198
* @see {@link https://graphics.stanford.edu/papers/envmap/envmap.pdf|An Efficient Representation for Irradiance Environment Maps}
11941199
*/
11951200
sphericalHarmonicCoefficients : {
@@ -1211,8 +1216,9 @@ define([
12111216
* A URL to a KTX file that contains a cube map of the specular lighting and the convoluted specular mipmaps.
12121217
*
12131218
* @memberof Model.prototype
1214-
*
1219+
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Image-Based Lighting.html|Sandcastle Image Based Lighting Demo}
12151220
* @type {String}
1221+
* @see Model#sphericalHarmonicCoefficients
12161222
* @default undefined
12171223
*/
12181224
specularEnvironmentMaps : {

0 commit comments

Comments
 (0)