Skip to content

Commit

Permalink
MeshPhysicalMaterial: Renamed sheenColor to sheen.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Aug 20, 2019
1 parent d8d0e02 commit 3e9af1f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/nodes/materials/StandardNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ NodeUtils.addShortcuts( StandardNodeMaterial.prototype, 'fragment', [
'environment',
'mask',
'position',
'sheenColor'
'sheen'
] );

export { StandardNodeMaterial };
12 changes: 6 additions & 6 deletions examples/jsm/nodes/materials/nodes/StandardNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ StandardNode.prototype.build = function ( builder ) {

}

if ( this.sheenColor ) this.sheenColor.analyze( builder );
if ( this.sheen ) this.sheen.analyze( builder );

// build code

Expand Down Expand Up @@ -224,7 +224,7 @@ StandardNode.prototype.build = function ( builder ) {

var clearCoatEnv = useClearCoat && environment ? this.environment.flow( builder, 'c', { cache: 'clearCoat', context: contextClearCoatEnvironment, slot: 'environment' } ) : undefined;

var sheenColor = this.sheenColor ? this.sheenColor.flow( builder, 'c' ) : undefined;
var sheen = this.sheen ? this.sheen.flow( builder, 'c' ) : undefined;

builder.requires.transparent = alpha !== undefined;

Expand Down Expand Up @@ -346,9 +346,9 @@ StandardNode.prototype.build = function ( builder ) {

}

if ( sheenColor ) {
if ( sheen ) {

output.push( 'material.sheenColor = ' + sheenColor.result + ';' );
output.push( 'material.sheenColor = ' + sheen.result + ';' );

}

Expand Down Expand Up @@ -525,7 +525,7 @@ StandardNode.prototype.copy = function ( source ) {

if ( source.environment ) this.environment = source.environment;

if ( source.sheenColor ) this.sheenColor = source.sheenColor;
if ( source.sheen ) this.sheen = source.sheen;

return this;

Expand Down Expand Up @@ -571,7 +571,7 @@ StandardNode.prototype.toJSON = function ( meta ) {

if ( this.environment ) data.environment = this.environment.toJSON( meta ).uuid;

if ( this.sheenColor ) data.sheenColor = this.sheenColor.toJSON( meta ).uuid;
if ( this.sheen ) data.sheen = this.sheen.toJSON( meta ).uuid;

}

Expand Down
12 changes: 6 additions & 6 deletions examples/webgl_materials_sheen.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
nodeMaterial: true,
color: new THREE.Color( 255, 0, 127 ),
sheenBRDF: true,
sheenColor: new THREE.Color( 10, 10, 10 ), // corresponds to .04 reflectance
sheen: new THREE.Color( 10, 10, 10 ), // corresponds to .04 reflectance
roughness: .9,
exposure: 2,
};
Expand Down Expand Up @@ -121,7 +121,7 @@
gui.add( params, 'nodeMaterial' );
gui.addColor( params, 'color' );
gui.add( params, 'sheenBRDF' );
gui.addColor( params, 'sheenColor' );
gui.addColor( params, 'sheen' );
gui.add( params, 'roughness', 0, 1 );
gui.add( params, 'exposure', 0, 3 );
gui.open();
Expand Down Expand Up @@ -156,8 +156,8 @@

//

material.sheenColor = params.sheenBRDF
? new THREE.Color().copy( params.sheenColor ).multiplyScalar( 1 / 255 )
material.sheen = params.sheenBRDF
? new THREE.Color().copy( params.sheen ).multiplyScalar( 1 / 255 )
: null;

material.color.copy( params.color ).multiplyScalar( 1 / 255 );
Expand All @@ -167,8 +167,8 @@

//

nodeMaterial.sheenColor = params.sheenBRDF
? new Nodes.ColorNode( material.sheenColor )
nodeMaterial.sheen = params.sheenBRDF
? new Nodes.ColorNode( material.sheen )
: undefined;

nodeMaterial.color.value.copy( material.color );
Expand Down
4 changes: 2 additions & 2 deletions src/materials/MeshPhysicalMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface MeshPhysicalMaterialParameters
clearCoat?: number;
clearCoatRoughness?: number;

sheenColor?: Color;
sheen?: Color;

clearCoatNormalScale?: Vector2;
clearCoatNormalMap?: Texture;
Expand All @@ -27,7 +27,7 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial {
clearCoat: number;
clearCoatRoughness: number;

sheenColor: Color | null;
sheen: Color | null;

clearCoatNormalScale: Vector2;
clearCoatNormalMap: Texture | null;
Expand Down
6 changes: 3 additions & 3 deletions src/materials/MeshPhysicalMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function MeshPhysicalMaterial( parameters ) {
this.clearCoat = 0.0;
this.clearCoatRoughness = 0.0;

this.sheenColor = null; // null will disable sheen bsdf
this.sheen = null; // null will disable sheen bsdf

this.clearCoatNormalScale = new Vector2( 1, 1 );
this.clearCoatNormalMap = null;
Expand All @@ -55,8 +55,8 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
this.clearCoat = source.clearCoat;
this.clearCoatRoughness = source.clearCoatRoughness;

if ( source.sheenColor ) this.sheenColor = ( this.sheenColor || new Color() ).copy( source.sheenColor );
else this.sheenColor = null;
if ( source.sheen ) this.sheen = ( this.sheen || new Color() ).copy( source.sheen );
else this.sheen = null;

this.clearCoatNormalMap = source.clearCoatNormalMap;
this.clearCoatNormalScale.copy( source.clearCoatNormalScale );
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2271,7 +2271,7 @@ function WebGLRenderer( parameters ) {

uniforms.clearCoat.value = material.clearCoat;
uniforms.clearCoatRoughness.value = material.clearCoatRoughness;
if ( material.sheenColor ) uniforms.sheenColor.value.copy( material.sheenColor );
if ( material.sheen ) uniforms.sheen.value.copy( material.sheen );

if ( material.clearCoatNormalMap ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
material.sheenColor = sheen;
#endif
`;
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ ShaderLib.physical = {
{
clearCoat: { value: 0 },
clearCoatRoughness: { value: 0 },
sheenColor: { value: new Color( 0x000000 ) },
sheen: { value: new Color( 0x000000 ) },
clearCoatNormalScale: { value: new Vector2( 1, 1 ) },
clearCoatNormalMap: { value: null },
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ uniform float opacity;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform vec3 sheen;
#endif
varying vec3 vViewPosition;
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgl/WebGLPrograms.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {

gradientMap: !! material.gradientMap,

sheen: !! material.sheenColor,
sheen: !! material.sheen,

combine: material.combine,

Expand Down

0 comments on commit 3e9af1f

Please sign in to comment.