Skip to content
Permalink
Browse files

Merge pull request #6426 from sebavan/master

Rename indice to index of refraction
  • Loading branch information...
sebavan committed May 31, 2019
2 parents 2f6322e + 35d42c0 commit 17de6fe4be1f45d1b04735ff5152873901ec6070
@@ -139,7 +139,7 @@ export class PBRMaterialPropertyGridComponent extends React.Component<IPBRMateri
<div className="fragment">
<SliderLineComponent label="Intensity" target={material.clearCoat} propertyName="intensity" minimum={0} maximum={1} step={0.01} onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
<SliderLineComponent label="Roughness" target={material.clearCoat} propertyName="roughness" minimum={0} maximum={1} step={0.01} onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
<SliderLineComponent label="IOR" target={material.clearCoat} propertyName="indiceOfRefraction" minimum={1.0} maximum={3} step={0.01} onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
<SliderLineComponent label="IOR" target={material.clearCoat} propertyName="indexOfRefraction" minimum={1.0} maximum={3} step={0.01} onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
<TextureLinkLineComponent label="Texture" texture={material.clearCoat.texture} material={material} onSelectionChangedObservable={this.props.onSelectionChangedObservable} onDebugSelectionChangeObservable={this._onDebugSelectionChangeObservable} />
<TextureLinkLineComponent label="Bump" texture={material.clearCoat.bumpTexture} material={material} onSelectionChangedObservable={this.props.onSelectionChangedObservable} onDebugSelectionChangeObservable={this._onDebugSelectionChangeObservable} />
{
@@ -120,13 +120,7 @@ window.preparePBR = function() {
"albedoColorLevel": 1
});
});

registerRangeUI("pbr", "indiceOfRefraction", 0, 2, function(value) {
pbr.indexOfRefraction = value;
}, function() {
return pbr.indexOfRefraction;
});


registerRangeUI("pbr", "alpha", 0, 1, function(value) {
pbr.alpha = value;
}, function() {
@@ -38,7 +38,7 @@ export class PBRClearCoatConfiguration {
* This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence
* The default fits with a polyurethane material.
*/
private static readonly _DefaultIndiceOfRefraction = 1.5;
private static readonly _DefaultIndexOfRefraction = 1.5;

@serialize()
private _isEnabled = false;
@@ -61,15 +61,15 @@ export class PBRClearCoatConfiguration {
public roughness: number = 0;

@serialize()
private _indiceOfRefraction = PBRClearCoatConfiguration._DefaultIndiceOfRefraction;
private _indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;
/**
* Defines the indice of refraction of the clear coat.
* Defines the index of refraction of the clear coat.
* This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence
* The default fits with a polyurethane material.
* Changing the default value is more performance intensive.
*/
@expandToProperty("_markAllSubMeshesAsTexturesDirty")
public indiceOfRefraction = PBRClearCoatConfiguration._DefaultIndiceOfRefraction;
public indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;

@serializeAsTexture()
private _texture: Nullable<BaseTexture> = null;
@@ -201,7 +201,7 @@ export class PBRClearCoatConfiguration {
defines.CLEARCOAT_BUMP = false;
}

defines.CLEARCOAT_DEFAULTIOR = this._indiceOfRefraction === PBRClearCoatConfiguration._DefaultIndiceOfRefraction;
defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;

if (this._isTintEnabled) {
defines.CLEARCOAT_TINT = true;
@@ -265,10 +265,10 @@ export class PBRClearCoatConfiguration {
uniformBuffer.updateFloat2("vClearCoatParams", this.intensity, this.roughness);

// Clear Coat Refraction params
const a = 1 - this._indiceOfRefraction;
const b = 1 + this._indiceOfRefraction;
const a = 1 - this._indexOfRefraction;
const b = 1 + this._indexOfRefraction;
const f0 = Math.pow((-a / b), 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.
const eta = 1 / this._indiceOfRefraction;
const eta = 1 / this._indexOfRefraction;
uniformBuffer.updateFloat4("vClearCoatRefractionParams", f0, eta, a, b);

if (this._isTintEnabled) {
@@ -114,7 +114,7 @@ export class PBRSubSurfaceConfiguration {

private _indexOfRefraction = 1;
/**
* Defines the indice of refraction used in the material.
* Defines the index of refraction used in the material.
* https://en.wikipedia.org/wiki/List_of_refractive_indices
*/
@serialize()
@@ -371,7 +371,7 @@ export class StandardMaterial extends PushMaterial {
public roughness: number;

/**
* In case of refraction, define the value of the indice of refraction.
* In case of refraction, define the value of the index of refraction.
* @see http://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions
*/
@serialize()

0 comments on commit 17de6fe

Please sign in to comment.
You can’t perform that action at this time.