From b75dd045728a7dbf9f9509c103d2fa4bca70e20c Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 20 Aug 2019 17:14:30 -0700 Subject: [PATCH] MeshPhysicalMaterial: Renamed clearCoat* to clearcoat*. --- .../en/materials/MeshPhysicalMaterial.html | 8 +- .../zh/materials/MeshPhysicalMaterial.html | 8 +- docs/scenes/material-browser.html | 4 +- editor/js/Sidebar.Material.js | 100 +++++++++--------- editor/js/Strings.js | 8 +- examples/js/loaders/LWOLoader.js | 4 +- examples/js/shaders/TranslucentShader.js | 2 +- examples/jsm/loaders/LWOLoader.js | 4 +- examples/jsm/loaders/sea3d/SEA3DLoader.js | 4 +- .../nodes/bsdfs/BlinnShininessExponentNode.js | 4 +- .../nodes/materials/StandardNodeMaterial.js | 6 +- .../jsm/nodes/materials/nodes/StandardNode.js | 66 ++++++------ examples/jsm/shaders/TranslucentShader.js | 2 +- .../webgl_materials_clearcoat_normalmap.html | 18 ++-- examples/webgl_materials_nodes.html | 40 +++---- .../webgl_materials_variations_physical.html | 12 +-- src/loaders/MaterialLoader.js | 8 +- src/materials/Material.js | 10 +- src/materials/MeshPhysicalMaterial.d.ts | 16 +-- src/materials/MeshPhysicalMaterial.js | 24 ++--- src/renderers/WebGLRenderer.js | 12 +-- .../clearcoat_normal_fragment_begin.glsl.js | 2 +- .../clearcoat_normal_fragment_maps.glsl.js | 8 +- .../clearcoat_normalmap_pars_fragment.glsl.js | 4 +- .../shaders/ShaderChunk/common.glsl.js | 2 +- .../ShaderChunk/lights_fragment_begin.glsl.js | 4 +- .../ShaderChunk/lights_fragment_end.glsl.js | 2 +- .../ShaderChunk/lights_fragment_maps.glsl.js | 2 +- .../lights_physical_fragment.glsl.js | 4 +- .../lights_physical_pars_fragment.glsl.js | 36 +++---- src/renderers/shaders/ShaderLib.js | 8 +- .../ShaderLib/meshphysical_frag.glsl.js | 4 +- src/renderers/webgl/WebGLProgram.js | 6 +- src/renderers/webgl/WebGLPrograms.js | 6 +- 34 files changed, 224 insertions(+), 224 deletions(-) diff --git a/docs/api/en/materials/MeshPhysicalMaterial.html b/docs/api/en/materials/MeshPhysicalMaterial.html index baaa85da0ec07a..ef3f3437e5baec 100644 --- a/docs/api/en/materials/MeshPhysicalMaterial.html +++ b/docs/api/en/materials/MeshPhysicalMaterial.html @@ -55,13 +55,13 @@

[name]( [param:Object parameters] )

Properties

See the base [page:Material] and [page:MeshStandardMaterial] classes for common properties.

-

[property:Float clearCoat]

+

[property:Float clearcoat]

- ClearCoat level, from *0.0* to *1.0*. Default is *0.0*. + Clearcoat level, from *0.0* to *1.0*. Default is *0.0*.

-

[property:Float clearCoatRoughness]

-

How rough the clearCoat appears, from *0.0* to *1.0*. Default is *0.0*.

+

[property:Float clearcoatRoughness]

+

How rough the clearcoat appears, from *0.0* to *1.0*. Default is *0.0*.

[property:Boolean isMeshPhysicalMaterial]

diff --git a/docs/api/zh/materials/MeshPhysicalMaterial.html b/docs/api/zh/materials/MeshPhysicalMaterial.html index a30017b2ca3c96..91ecc813f4d3fc 100644 --- a/docs/api/zh/materials/MeshPhysicalMaterial.html +++ b/docs/api/zh/materials/MeshPhysicalMaterial.html @@ -50,13 +50,13 @@

[name]( [param:Object parameters] )

属性(Properties)

共有属性请参见其基类[page:Material]。

-

[property:Float clearCoat]

+

[property:Float clearcoat]

- ClearCoat级别,从*0.0*到*1.0*。默认值为*0.0*。 + Clearcoat级别,从*0.0*到*1.0*。默认值为*0.0*。

-

[property:Float clearCoatRoughness]

-

clearCoat看起来的粗糙程度,从*0.0*到*1.0*。默认值为*0.0*。

+

[property:Float clearcoatRoughness]

+

clearcoat看起来的粗糙程度,从*0.0*到*1.0*。默认值为*0.0*。

[property:Boolean isMeshPhysicalMaterial]

用于检查此类或派生类是否为Lambert网格材质。默认值为 *true*。

diff --git a/docs/scenes/material-browser.html b/docs/scenes/material-browser.html index 70b1cd8dfee665..1e84cefec11eb8 100644 --- a/docs/scenes/material-browser.html +++ b/docs/scenes/material-browser.html @@ -595,8 +595,8 @@ folder.add( material, 'roughness', 0, 1 ); folder.add( material, 'metalness', 0, 1 ); folder.add( material, 'reflectivity', 0, 1 ); - folder.add( material, 'clearCoat', 0, 1 ).step( 0.01 ); - folder.add( material, 'clearCoatRoughness', 0, 1 ).step( 0.01 ); + folder.add( material, 'clearcoat', 0, 1 ).step( 0.01 ); + folder.add( material, 'clearcoatRoughness', 0, 1 ).step( 0.01 ); folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) ); folder.add( material, 'wireframe' ); folder.add( material, 'wireframeLinewidth', 0, 10 ); diff --git a/editor/js/Sidebar.Material.js b/editor/js/Sidebar.Material.js index 5bd92126594453..2769b5342d0a0c 100644 --- a/editor/js/Sidebar.Material.js +++ b/editor/js/Sidebar.Material.js @@ -225,25 +225,25 @@ Sidebar.Material = function ( editor ) { container.add( materialShininessRow ); - // clearCoat + // clearcoat - var materialClearCoatRow = new UI.Row(); - var materialClearCoat = new UI.Number( 1 ).setWidth( '60px' ).setRange( 0, 1 ).onChange( update ); + var materialClearcoatRow = new UI.Row(); + var materialClearcoat = new UI.Number( 1 ).setWidth( '60px' ).setRange( 0, 1 ).onChange( update ); - materialClearCoatRow.add( new UI.Text( strings.getKey( 'sidebar/material/clearcoat' ) ).setWidth( '90px' ) ); - materialClearCoatRow.add( materialClearCoat ); + materialClearcoatRow.add( new UI.Text( strings.getKey( 'sidebar/material/clearcoat' ) ).setWidth( '90px' ) ); + materialClearcoatRow.add( materialClearcoat ); - container.add( materialClearCoatRow ); + container.add( materialClearcoatRow ); - // clearCoatRoughness + // clearcoatRoughness - var materialClearCoatRoughnessRow = new UI.Row(); - var materialClearCoatRoughness = new UI.Number( 1 ).setWidth( '60px' ).setRange( 0, 1 ).onChange( update ); + var materialClearcoatRoughnessRow = new UI.Row(); + var materialClearcoatRoughness = new UI.Number( 1 ).setWidth( '60px' ).setRange( 0, 1 ).onChange( update ); - materialClearCoatRoughnessRow.add( new UI.Text( strings.getKey( 'sidebar/material/clearcoatroughness' ) ).setWidth( '90px' ) ); - materialClearCoatRoughnessRow.add( materialClearCoatRoughness ); + materialClearcoatRoughnessRow.add( new UI.Text( strings.getKey( 'sidebar/material/clearcoatroughness' ) ).setWidth( '90px' ) ); + materialClearcoatRoughnessRow.add( materialClearcoatRoughness ); - container.add( materialClearCoatRoughnessRow ); + container.add( materialClearcoatRoughnessRow ); // vertex colors @@ -353,19 +353,19 @@ Sidebar.Material = function ( editor ) { // clearcoat normal map - var materialClearCoatNormalMapRow = new UI.Row(); - var materialClearCoatNormalMapEnabled = new UI.Checkbox( false ).onChange( update ); - var materialClearCoatNormalMap = new UI.Texture().onChange( update ); - var materialClearCoatNormalScaleX = new UI.Number( 1 ).setWidth( '30px' ).onChange( update ); - var materialClearCoatNormalScaleY = new UI.Number( 1 ).setWidth( '30px' ).onChange( update ); + var materialClearcoatNormalMapRow = new UI.Row(); + var materialClearcoatNormalMapEnabled = new UI.Checkbox( false ).onChange( update ); + var materialClearcoatNormalMap = new UI.Texture().onChange( update ); + var materialClearcoatNormalScaleX = new UI.Number( 1 ).setWidth( '30px' ).onChange( update ); + var materialClearcoatNormalScaleY = new UI.Number( 1 ).setWidth( '30px' ).onChange( update ); - materialClearCoatNormalMapRow.add( new UI.Text( strings.getKey( 'sidebar/material/clearcoatnormalmap' ) ).setWidth( '90px' ) ); - materialClearCoatNormalMapRow.add( materialClearCoatNormalMapEnabled ); - materialClearCoatNormalMapRow.add( materialClearCoatNormalMap ); - materialClearCoatNormalMapRow.add( materialClearCoatNormalScaleX ); - materialClearCoatNormalMapRow.add( materialClearCoatNormalScaleY ); + materialClearcoatNormalMapRow.add( new UI.Text( strings.getKey( 'sidebar/material/clearcoatnormalmap' ) ).setWidth( '90px' ) ); + materialClearcoatNormalMapRow.add( materialClearcoatNormalMapEnabled ); + materialClearcoatNormalMapRow.add( materialClearcoatNormalMap ); + materialClearcoatNormalMapRow.add( materialClearcoatNormalScaleX ); + materialClearcoatNormalMapRow.add( materialClearcoatNormalScaleY ); - container.add( materialClearCoatNormalMapRow ); + container.add( materialClearcoatNormalMapRow ); // displacement map @@ -654,15 +654,15 @@ Sidebar.Material = function ( editor ) { } - if ( material.clearCoat !== undefined && Math.abs( material.clearCoat - materialClearCoat.getValue() ) >= 0.01 ) { + if ( material.clearcoat !== undefined && Math.abs( material.clearcoat - materialClearcoat.getValue() ) >= 0.01 ) { - editor.execute( new SetMaterialValueCommand( editor, currentObject, 'clearCoat', materialClearCoat.getValue(), currentMaterialSlot ) ); + editor.execute( new SetMaterialValueCommand( editor, currentObject, 'clearcoat', materialClearcoat.getValue(), currentMaterialSlot ) ); } - if ( material.clearCoatRoughness !== undefined && Math.abs( material.clearCoatRoughness - materialClearCoatRoughness.getValue() ) >= 0.01 ) { + if ( material.clearcoatRoughness !== undefined && Math.abs( material.clearcoatRoughness - materialClearcoatRoughness.getValue() ) >= 0.01 ) { - editor.execute( new SetMaterialValueCommand( editor, currentObject, 'clearCoatRoughness', materialClearCoatRoughness.getValue(), currentMaterialSlot ) ); + editor.execute( new SetMaterialValueCommand( editor, currentObject, 'clearcoatRoughness', materialClearcoatRoughness.getValue(), currentMaterialSlot ) ); } @@ -817,34 +817,34 @@ Sidebar.Material = function ( editor ) { } - if ( material.clearCoatNormalMap !== undefined ) { + if ( material.clearcoatNormalMap !== undefined ) { - var clearCoatNormalMapEnabled = materialClearCoatNormalMapEnabled.getValue() === true; + var clearcoatNormalMapEnabled = materialClearcoatNormalMapEnabled.getValue() === true; if ( objectHasUvs ) { - var clearCoatNormalMap = clearCoatNormalMapEnabled ? materialClearCoatNormalMap.getValue() : null; + var clearcoatNormalMap = clearcoatNormalMapEnabled ? materialClearcoatNormalMap.getValue() : null; - if ( material.clearCoatNormalMap !== clearCoatNormalMap ) { + if ( material.clearcoatNormalMap !== clearcoatNormalMap ) { - editor.execute( new SetMaterialMapCommand( editor, currentObject, 'clearCoatNormalMap', clearCoatNormalMap, currentMaterialSlot ) ); + editor.execute( new SetMaterialMapCommand( editor, currentObject, 'clearcoatNormalMap', clearcoatNormalMap, currentMaterialSlot ) ); } - if ( material.clearCoatNormalScale.x !== materialClearCoatNormalScaleX.getValue() || - material.clearCoatNormalScale.y !== materialClearCoatNormalScaleY.getValue() ) { + if ( material.clearcoatNormalScale.x !== materialClearcoatNormalScaleX.getValue() || + material.clearcoatNormalScale.y !== materialClearcoatNormalScaleY.getValue() ) { var value = [ - materialClearCoatNormalScaleX.getValue(), - materialClearCoatNormalScaleY.getValue() + materialClearcoatNormalScaleX.getValue(), + materialClearcoatNormalScaleY.getValue() ]; - editor.execute( new SetMaterialVectorCommand( editor, currentObject, 'clearCoatNormalScale', value, currentMaterialSlot ) ); + editor.execute( new SetMaterialVectorCommand( editor, currentObject, 'clearcoatNormalScale', value, currentMaterialSlot ) ); } } else { - if ( clearCoatNormalMapEnabled ) textureWarning = true; + if ( clearcoatNormalMapEnabled ) textureWarning = true; } @@ -1159,8 +1159,8 @@ Sidebar.Material = function ( editor ) { 'emissive': materialEmissiveRow, 'specular': materialSpecularRow, 'shininess': materialShininessRow, - 'clearCoat': materialClearCoatRow, - 'clearCoatRoughness': materialClearCoatRoughnessRow, + 'clearcoat': materialClearcoatRow, + 'clearcoatRoughness': materialClearcoatRoughnessRow, 'vertexShader': materialProgramRow, 'vertexColors': materialVertexColorsRow, 'depthPacking': materialDepthPackingRow, @@ -1287,15 +1287,15 @@ Sidebar.Material = function ( editor ) { } - if ( material.clearCoat !== undefined ) { + if ( material.clearcoat !== undefined ) { - materialClearCoat.setValue( material.clearCoat ); + materialClearcoat.setValue( material.clearcoat ); } - if ( material.clearCoatRoughness !== undefined ) { + if ( material.clearcoatRoughness !== undefined ) { - materialClearCoatRoughness.setValue( material.clearCoatRoughness ); + materialClearcoatRoughness.setValue( material.clearcoatRoughness ); } @@ -1382,18 +1382,18 @@ Sidebar.Material = function ( editor ) { } - if ( material.clearCoatNormalMap !== undefined ) { + if ( material.clearcoatNormalMap !== undefined ) { - materialClearCoatNormalMapEnabled.setValue( material.clearCoatNormalMap !== null ); + materialClearcoatNormalMapEnabled.setValue( material.clearcoatNormalMap !== null ); - if ( material.clearCoatNormalMap !== null || resetTextureSelectors ) { + if ( material.clearcoatNormalMap !== null || resetTextureSelectors ) { - materialClearCoatNormalMap.setValue( material.clearCoatNormalMap ); + materialClearcoatNormalMap.setValue( material.clearcoatNormalMap ); } - materialClearCoatNormalScaleX.setValue( material.clearCoatNormalScale.x ); - materialClearCoatNormalScaleY.setValue( material.clearCoatNormalScale.y ); + materialClearcoatNormalScaleX.setValue( material.clearcoatNormalScale.x ); + materialClearcoatNormalScaleY.setValue( material.clearcoatNormalScale.y ); } diff --git a/editor/js/Strings.js b/editor/js/Strings.js index 5d2f44f10caa76..648ec95866ef01 100644 --- a/editor/js/Strings.js +++ b/editor/js/Strings.js @@ -224,8 +224,8 @@ var Strings = function ( config ) { 'sidebar/material/emissive': 'Emissive', 'sidebar/material/specular': 'Specular', 'sidebar/material/shininess': 'Shininess', - 'sidebar/material/clearcoat': 'ClearCoat', - 'sidebar/material/clearcoatroughness': 'ClearCoat Roughness', + 'sidebar/material/clearcoat': 'Clearcoat', + 'sidebar/material/clearcoatroughness': 'Clearcoat Roughness', 'sidebar/material/vertexcolors': 'Vertex Colors', 'sidebar/material/vertexcolors/no': 'No', 'sidebar/material/vertexcolors/face': 'Face', @@ -236,7 +236,7 @@ var Strings = function ( config ) { 'sidebar/material/alphamap': 'Alpha Map', 'sidebar/material/bumpmap': 'Bump Map', 'sidebar/material/normalmap': 'Normal Map', - 'sidebar/material/clearcoatnormalmap': 'ClearCoat Normal Map', + 'sidebar/material/clearcoatnormalmap': 'Clearcoat Normal Map', 'sidebar/material/displacemap': 'Displace Map', 'sidebar/material/roughmap': 'Rough. Map', 'sidebar/material/metalmap': 'Metal. Map', @@ -508,7 +508,7 @@ var Strings = function ( config ) { 'sidebar/material/alphamap': '透明贴图', 'sidebar/material/bumpmap': '凹凸贴图', 'sidebar/material/normalmap': '法线贴图', - 'sidebar/material/clearcoatnormalmap': 'ClearCoat Normal Map', + 'sidebar/material/clearcoatnormalmap': 'Clearcoat Normal Map', 'sidebar/material/displacemap': '置换贴图', 'sidebar/material/roughmap': '粗糙贴图', 'sidebar/material/metalmap': '金属贴图', diff --git a/examples/js/loaders/LWOLoader.js b/examples/js/loaders/LWOLoader.js index 9006257d9ab584..bbbe153c161fb4 100644 --- a/examples/js/loaders/LWOLoader.js +++ b/examples/js/loaders/LWOLoader.js @@ -2593,11 +2593,11 @@ MaterialParser.prototype = { if ( attributes.Clearcoat && attributes.Clearcoat.value > 0 ) { - params.clearCoat = attributes.Clearcoat.value; + params.clearcoat = attributes.Clearcoat.value; if ( attributes[ 'Clearcoat Gloss' ] ) { - params.clearCoatRoughness = 0.5 * ( 1 - attributes[ 'Clearcoat Gloss' ].value ); + params.clearcoatRoughness = 0.5 * ( 1 - attributes[ 'Clearcoat Gloss' ].value ); } diff --git a/examples/js/shaders/TranslucentShader.js b/examples/js/shaders/TranslucentShader.js index d3839290aeb5ef..619d71a71e9706 100644 --- a/examples/js/shaders/TranslucentShader.js +++ b/examples/js/shaders/TranslucentShader.js @@ -187,7 +187,7 @@ THREE.TranslucentShader = { " #if defined( RE_IndirectSpecular )", " vec3 radiance = vec3( 0.0 );", - " vec3 clearCoatRadiance = vec3( 0.0 );", + " vec3 clearcoatRadiance = vec3( 0.0 );", " #endif", THREE.ShaderChunk[ "lights_fragment_end" ], diff --git a/examples/jsm/loaders/LWOLoader.js b/examples/jsm/loaders/LWOLoader.js index f636d94208c98b..ca1ab0f2578ebb 100644 --- a/examples/jsm/loaders/LWOLoader.js +++ b/examples/jsm/loaders/LWOLoader.js @@ -2622,11 +2622,11 @@ MaterialParser.prototype = { if ( attributes.Clearcoat && attributes.Clearcoat.value > 0 ) { - params.clearCoat = attributes.Clearcoat.value; + params.clearcoat = attributes.Clearcoat.value; if ( attributes[ 'Clearcoat Gloss' ] ) { - params.clearCoatRoughness = 0.5 * ( 1 - attributes[ 'Clearcoat Gloss' ].value ); + params.clearcoatRoughness = 0.5 * ( 1 - attributes[ 'Clearcoat Gloss' ].value ); } diff --git a/examples/jsm/loaders/sea3d/SEA3DLoader.js b/examples/jsm/loaders/sea3d/SEA3DLoader.js index 12a31e0ad17ef5..be616594e67eb5 100644 --- a/examples/jsm/loaders/sea3d/SEA3DLoader.js +++ b/examples/jsm/loaders/sea3d/SEA3DLoader.js @@ -2715,8 +2715,8 @@ SEA3D.prototype.materialTechnique = techniques[ SEA3DSDK.Material.CLEAR_COAT ] = function ( mat, tech ) { - mat.clearCoat = tech.strength; - mat.clearCoatRoughness = tech.roughness; + mat.clearcoat = tech.strength; + mat.clearcoatRoughness = tech.roughness; }; diff --git a/examples/jsm/nodes/bsdfs/BlinnShininessExponentNode.js b/examples/jsm/nodes/bsdfs/BlinnShininessExponentNode.js index b21e7d0ca3ead8..f618711e884ba9 100644 --- a/examples/jsm/nodes/bsdfs/BlinnShininessExponentNode.js +++ b/examples/jsm/nodes/bsdfs/BlinnShininessExponentNode.js @@ -16,9 +16,9 @@ BlinnShininessExponentNode.prototype.nodeType = "BlinnShininessExponent"; BlinnShininessExponentNode.prototype.generate = function ( builder, output ) { - if ( builder.isCache( 'clearCoat' ) ) { + if ( builder.isCache( 'clearcoat' ) ) { - return builder.format( 'Material_ClearCoat_BlinnShininessExponent( material )', this.type, output ); + return builder.format( 'Material_Clearcoat_BlinnShininessExponent( material )', this.type, output ); } else { diff --git a/examples/jsm/nodes/materials/StandardNodeMaterial.js b/examples/jsm/nodes/materials/StandardNodeMaterial.js index 68b96b1ccc59bb..734dda918e4d61 100644 --- a/examples/jsm/nodes/materials/StandardNodeMaterial.js +++ b/examples/jsm/nodes/materials/StandardNodeMaterial.js @@ -25,9 +25,9 @@ NodeUtils.addShortcuts( StandardNodeMaterial.prototype, 'fragment', [ 'roughness', 'metalness', 'reflectivity', - 'clearCoat', - 'clearCoatRoughness', - 'clearCoatNormal', + 'clearcoat', + 'clearcoatRoughness', + 'clearcoatNormal', 'normal', 'emissive', 'ambient', diff --git a/examples/jsm/nodes/materials/nodes/StandardNode.js b/examples/jsm/nodes/materials/nodes/StandardNode.js index b9223c09237590..8b72aa2dbe574e 100644 --- a/examples/jsm/nodes/materials/nodes/StandardNode.js +++ b/examples/jsm/nodes/materials/nodes/StandardNode.js @@ -33,7 +33,7 @@ StandardNode.prototype.build = function ( builder ) { var code; - builder.define( this.clearCoat || this.clearCoatRoughness || this.clearCoatNormal ? 'PHYSICAL' : 'STANDARD' ); + builder.define( this.clearcoat || this.clearcoatRoughness || this.clearcoatNormal ? 'PHYSICAL' : 'STANDARD' ); builder.requires.lights = true; @@ -131,13 +131,13 @@ StandardNode.prototype.build = function ( builder ) { gamma: true }; - var contextClearCoatEnvironment = { + var contextClearcoatEnvironment = { bias: RoughnessToBlinnExponentNode, - viewNormal: new ExpressionNode('clearCoatNormal', 'v3'), + viewNormal: new ExpressionNode('clearcoatNormal', 'v3'), gamma: true }; - var useClearCoat = ! builder.isDefined( 'STANDARD' ); + var useClearcoat = ! builder.isDefined( 'STANDARD' ); // analyze all nodes to reuse generate codes @@ -151,9 +151,9 @@ StandardNode.prototype.build = function ( builder ) { if ( this.normal ) this.normal.analyze( builder ); - if ( this.clearCoat ) this.clearCoat.analyze( builder ); - if ( this.clearCoatRoughness ) this.clearCoatRoughness.analyze( builder ); - if ( this.clearCoatNormal ) this.clearCoatNormal.analyze( builder ); + if ( this.clearcoat ) this.clearcoat.analyze( builder ); + if ( this.clearcoatRoughness ) this.clearcoatRoughness.analyze( builder ); + if ( this.clearcoatNormal ) this.clearcoatNormal.analyze( builder ); if ( this.reflectivity ) this.reflectivity.analyze( builder ); @@ -193,9 +193,9 @@ StandardNode.prototype.build = function ( builder ) { var normal = this.normal ? this.normal.flow( builder, 'v3' ) : undefined; - var clearCoat = this.clearCoat ? this.clearCoat.flow( builder, 'f' ) : undefined; - var clearCoatRoughness = this.clearCoatRoughness ? this.clearCoatRoughness.flow( builder, 'f' ) : undefined; - var clearCoatNormal = this.clearCoatNormal ? this.clearCoatNormal.flow( builder, 'v3' ) : undefined; + var clearcoat = this.clearcoat ? this.clearcoat.flow( builder, 'f' ) : undefined; + var clearcoatRoughness = this.clearcoatRoughness ? this.clearcoatRoughness.flow( builder, 'f' ) : undefined; + var clearcoatNormal = this.clearcoatNormal ? this.clearcoatNormal.flow( builder, 'v3' ) : undefined; var reflectivity = this.reflectivity ? this.reflectivity.flow( builder, 'f' ) : undefined; @@ -222,7 +222,7 @@ StandardNode.prototype.build = function ( builder ) { } - var clearCoatEnv = useClearCoat && environment ? this.environment.flow( builder, 'c', { cache: 'clearCoat', context: contextClearCoatEnvironment, slot: 'environment' } ) : undefined; + var clearcoatEnv = useClearcoat && environment ? this.environment.flow( builder, 'c', { cache: 'clearcoat', context: contextClearcoatEnvironment, slot: 'environment' } ) : undefined; var sheen = this.sheen ? this.sheen.flow( builder, 'c' ) : undefined; @@ -304,11 +304,11 @@ StandardNode.prototype.build = function ( builder ) { } - if ( clearCoatNormal ) { + if ( clearcoatNormal ) { output.push( - clearCoatNormal.code, - 'clearCoatNormal = ' + clearCoatNormal.result + ';' + clearcoatNormal.code, + 'clearcoatNormal = ' + clearcoatNormal.result + ';' ); } @@ -320,29 +320,29 @@ StandardNode.prototype.build = function ( builder ) { 'material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );' ); - if ( clearCoat ) { + if ( clearcoat ) { output.push( - clearCoat.code, - 'material.clearCoat = saturate( ' + clearCoat.result + ' );' + clearcoat.code, + 'material.clearcoat = saturate( ' + clearcoat.result + ' );' ); - } else if ( useClearCoat ) { + } else if ( useClearcoat ) { - output.push( 'material.clearCoat = 0.0;' ); + output.push( 'material.clearcoat = 0.0;' ); } - if ( clearCoatRoughness ) { + if ( clearcoatRoughness ) { output.push( - clearCoatRoughness.code, - 'material.clearCoatRoughness = clamp( ' + clearCoatRoughness.result + ', 0.04, 1.0 );' + clearcoatRoughness.code, + 'material.clearcoatRoughness = clamp( ' + clearcoatRoughness.result + ', 0.04, 1.0 );' ); - } else if ( useClearCoat ) { + } else if ( useClearcoat ) { - output.push( 'material.clearCoatRoughness = 0.0;' ); + output.push( 'material.clearcoatRoughness = 0.0;' ); } @@ -438,11 +438,11 @@ StandardNode.prototype.build = function ( builder ) { } - if ( clearCoatEnv ) { + if ( clearcoatEnv ) { output.push( - clearCoatEnv.code, - "clearCoatRadiance += " + clearCoatEnv.result + ";" + clearcoatEnv.code, + "clearcoatRadiance += " + clearcoatEnv.result + ";" ); } @@ -509,9 +509,9 @@ StandardNode.prototype.copy = function ( source ) { if ( source.normal ) this.normal = source.normal; - if ( source.clearCoat ) this.clearCoat = source.clearCoat; - if ( source.clearCoatRoughness ) this.clearCoatRoughness = source.clearCoatRoughness; - if ( source.clearCoatNormal ) this.clearCoatNormal = source.clearCoatNormal; + if ( source.clearcoat ) this.clearcoat = source.clearcoat; + if ( source.clearcoatRoughness ) this.clearcoatRoughness = source.clearcoatRoughness; + if ( source.clearcoatNormal ) this.clearcoatNormal = source.clearcoatNormal; if ( source.reflectivity ) this.reflectivity = source.reflectivity; @@ -555,9 +555,9 @@ StandardNode.prototype.toJSON = function ( meta ) { if ( this.normal ) data.normal = this.normal.toJSON( meta ).uuid; - if ( this.clearCoat ) data.clearCoat = this.clearCoat.toJSON( meta ).uuid; - if ( this.clearCoatRoughness ) data.clearCoatRoughness = this.clearCoatRoughness.toJSON( meta ).uuid; - if ( this.clearCoatNormal ) data.clearCoatNormal = this.clearCoatNormal.toJSON( meta ).uuid; + if ( this.clearcoat ) data.clearcoat = this.clearcoat.toJSON( meta ).uuid; + if ( this.clearcoatRoughness ) data.clearcoatRoughness = this.clearcoatRoughness.toJSON( meta ).uuid; + if ( this.clearcoatNormal ) data.clearcoatNormal = this.clearcoatNormal.toJSON( meta ).uuid; if ( this.reflectivity ) data.reflectivity = this.reflectivity.toJSON( meta ).uuid; diff --git a/examples/jsm/shaders/TranslucentShader.js b/examples/jsm/shaders/TranslucentShader.js index 9a4000b669ffc5..43ad2d5dd04cbe 100644 --- a/examples/jsm/shaders/TranslucentShader.js +++ b/examples/jsm/shaders/TranslucentShader.js @@ -194,7 +194,7 @@ var TranslucentShader = { " #if defined( RE_IndirectSpecular )", " vec3 radiance = vec3( 0.0 );", - " vec3 clearCoatRadiance = vec3( 0.0 );", + " vec3 clearcoatRadiance = vec3( 0.0 );", " #endif", ShaderChunk[ "lights_fragment_end" ], diff --git a/examples/webgl_materials_clearcoat_normalmap.html b/examples/webgl_materials_clearcoat_normalmap.html index cd7dcf34591852..1bfb9bcc53cba1 100644 --- a/examples/webgl_materials_clearcoat_normalmap.html +++ b/examples/webgl_materials_clearcoat_normalmap.html @@ -87,12 +87,12 @@ var normalMap2 = textureLoader.load( "textures/water/Water_1_M_Normal.jpg" ); - var clearCoatNormaMap = textureLoader.load( "textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png" ); + var clearcoatNormaMap = textureLoader.load( "textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png" ); // var material = new THREE.MeshPhysicalMaterial( { - clearCoat: 1.0, + clearcoat: 1.0, envMap: hdrCubeRenderTarget.texture, map: diffuse } ); @@ -105,7 +105,7 @@ // normalmap var material = new THREE.MeshPhysicalMaterial( { - clearCoat: 1.0, + clearcoat: 1.0, envMap: hdrCubeRenderTarget.texture, map: diffuse, normalMap: normalMap @@ -118,12 +118,12 @@ // clearcoat var material = new THREE.MeshPhysicalMaterial( { - clearCoat: 1.0, + clearcoat: 1.0, metalness: 0.0, color: 0xff0000, envMap: hdrCubeRenderTarget.texture, - clearCoatNormalMap: clearCoatNormaMap, - clearCoatNormalScale: new THREE.Vector2( 2.0, 2.0 ) + clearcoatNormalMap: clearcoatNormaMap, + clearcoatNormalScale: new THREE.Vector2( 2.0, 2.0 ) } ); var mesh = new THREE.Mesh( geometry, material ); mesh.position.x = - 100; @@ -133,14 +133,14 @@ // clearcoat + normalmap var material = new THREE.MeshPhysicalMaterial( { - clearCoat: 1.0, + clearcoat: 1.0, metalness: 1.0, color: 0xff0000, envMap: hdrCubeRenderTarget.texture, normalMap: normalMap2, normalScale: new THREE.Vector2( 0.15, 0.15 ), - clearCoatNormalMap: clearCoatNormaMap, - clearCoatNormalScale: new THREE.Vector2( 2.0, 2.0 ) + clearcoatNormalMap: clearcoatNormaMap, + clearcoatNormalScale: new THREE.Vector2( 2.0, 2.0 ) } ); var mesh = new THREE.Mesh( geometry, material ); mesh.position.x = 100; diff --git a/examples/webgl_materials_nodes.html b/examples/webgl_materials_nodes.html index fb8b371c3ffb58..c87c7e0aab0f43 100644 --- a/examples/webgl_materials_nodes.html +++ b/examples/webgl_materials_nodes.html @@ -740,9 +740,9 @@ //mtl.roughness = // roughness (float) //mtl.metalness = // metalness (float) //mtl.reflectivity = // reflectivity (float) - //mtl.clearCoat = // clearCoat (float) - //mtl.clearCoatRoughness = // clearCoatRoughness (float) - //mtl.clearCoatNormal = // clearCoatNormal (vec3) + //mtl.clearcoat = // clearcoat (float) + //mtl.clearcoatRoughness = // clearcoatRoughness (float) + //mtl.clearcoatNormal = // clearcoatNormal (vec3) //mtl.normal = // normal (vec3) //mtl.emissive = // emissive color (vec3) //mtl.ambient = // ambient color (vec3) @@ -755,7 +755,7 @@ var mask = new Nodes.SwitchNode( new Nodes.TextureNode( getTexture( "decalDiffuse" ) ), 'w' ); var normalScale = new Nodes.FloatNode( .3 ); - var clearCoatNormalScale = new Nodes.FloatNode( .1 ); + var clearcoatNormalScale = new Nodes.FloatNode( .1 ); var roughnessA = new Nodes.FloatNode( .5 ); var metalnessA = new Nodes.FloatNode( .5 ); @@ -764,8 +764,8 @@ var metalnessB = new Nodes.FloatNode( 1 ); var reflectivity = new Nodes.FloatNode( 0 ); - var clearCoat = new Nodes.FloatNode( 1 ); - var clearCoatRoughness = new Nodes.FloatNode( 1 ); + var clearcoat = new Nodes.FloatNode( 1 ); + var clearcoatRoughness = new Nodes.FloatNode( 1 ); var roughness = new Nodes.MathNode( roughnessA, @@ -787,9 +787,9 @@ Nodes.OperatorNode.MUL ); - var clearCoatNormalMask = new Nodes.OperatorNode( + var clearcoatNormalMask = new Nodes.OperatorNode( mask, - clearCoatNormalScale, + clearcoatNormalScale, Nodes.OperatorNode.MUL ); @@ -797,10 +797,10 @@ mtl.roughness = roughness; mtl.metalness = metalness; mtl.reflectivity = reflectivity; - mtl.clearCoat = clearCoat; - mtl.clearCoatRoughness = clearCoatRoughness; - mtl.clearCoatNormal = new Nodes.NormalMapNode( new Nodes.TextureNode( getTexture( "grassNormal" ) ) ); - mtl.clearCoatNormal.scale = clearCoatNormalMask; + mtl.clearcoat = clearcoat; + mtl.clearcoatRoughness = clearcoatRoughness; + mtl.clearcoatNormal = new Nodes.NormalMapNode( new Nodes.TextureNode( getTexture( "grassNormal" ) ) ); + mtl.clearcoatNormal.scale = clearcoatNormalMask; mtl.environment = new Nodes.CubeTextureNode( cubemap ); mtl.normal = new Nodes.NormalMapNode( new Nodes.TextureNode( getTexture( "grassNormal" ) ) ); mtl.normal.scale = normalMask; @@ -819,21 +819,21 @@ }, false, 0, 1 ); - addGui( 'clearCoat', clearCoat.value, function ( val ) { + addGui( 'clearcoat', clearcoat.value, function ( val ) { - clearCoat.value = val; + clearcoat.value = val; }, false, 0, 1 ); - addGui( 'clearCoatRoughness', clearCoatRoughness.value, function ( val ) { + addGui( 'clearcoatRoughness', clearcoatRoughness.value, function ( val ) { - clearCoatRoughness.value = val; + clearcoatRoughness.value = val; }, false, 0, 1 ); - addGui( 'clearCoatNormalScale', clearCoatNormalScale.value, function ( val ) { + addGui( 'clearcoatNormalScale', clearcoatNormalScale.value, function ( val ) { - clearCoatNormalScale.value = val; + clearcoatNormalScale.value = val; }, false, 0, 1 ); @@ -2236,8 +2236,8 @@ mtl.metalness = new Nodes.FloatNode( 0 ); mtl.roughness = new Nodes.FloatNode( 1 ); mtl.reflectivity = new Nodes.FloatNode( 0 ); - mtl.clearCoat = new Nodes.FloatNode( .2 ); - mtl.clearCoatRoughness = new Nodes.FloatNode( .3 ); + mtl.clearcoat = new Nodes.FloatNode( .2 ); + mtl.clearcoatRoughness = new Nodes.FloatNode( .3 ); mtl.environment = new Nodes.CubeTextureNode( cubemap ); } else { diff --git a/examples/webgl_materials_variations_physical.html b/examples/webgl_materials_variations_physical.html index 6ef1f047f6cea2..8773a7e42942ea 100644 --- a/examples/webgl_materials_variations_physical.html +++ b/examples/webgl_materials_variations_physical.html @@ -96,8 +96,8 @@ color: diffuseColor, metalness: 0, roughness: 0.5, - clearCoat: 1.0 - alpha, - clearCoatRoughness: 1.0 - beta, + clearcoat: 1.0 - alpha, + clearcoatRoughness: 1.0 - beta, reflectivity: 1.0 - gamma, envMap: ( index % 2 ) == 1 ? hdrCubeRenderTarget.texture : null } ); @@ -148,11 +148,11 @@ } - addLabel( "+clearCoat", new THREE.Vector3( - 350, 0, 0 ) ); - addLabel( "-clearCoat", new THREE.Vector3( 350, 0, 0 ) ); + addLabel( "+clearcoat", new THREE.Vector3( - 350, 0, 0 ) ); + addLabel( "-clearcoat", new THREE.Vector3( 350, 0, 0 ) ); - addLabel( "+clearCoatRoughness", new THREE.Vector3( 0, - 300, 0 ) ); - addLabel( "-clearCoatRoughness", new THREE.Vector3( 0, 300, 0 ) ); + addLabel( "+clearcoatRoughness", new THREE.Vector3( 0, - 300, 0 ) ); + addLabel( "-clearcoatRoughness", new THREE.Vector3( 0, 300, 0 ) ); addLabel( "+reflectivity", new THREE.Vector3( 0, 0, - 300 ) ); addLabel( "-reflectivity", new THREE.Vector3( 0, 0, 300 ) ); diff --git a/src/loaders/MaterialLoader.js b/src/loaders/MaterialLoader.js index 8810f7aefbb359..94c76b9c6de6ca 100644 --- a/src/loaders/MaterialLoader.js +++ b/src/loaders/MaterialLoader.js @@ -61,8 +61,8 @@ Object.assign( MaterialLoader.prototype, { if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); if ( json.specular !== undefined ) material.specular.setHex( json.specular ); if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.clearCoat !== undefined ) material.clearCoat = json.clearCoat; - if ( json.clearCoatRoughness !== undefined ) material.clearCoatRoughness = json.clearCoatRoughness; + if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat; + if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness; if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; if ( json.fog !== undefined ) material.fog = json.fog; if ( json.flatShading !== undefined ) material.flatShading = json.flatShading; @@ -229,8 +229,8 @@ Object.assign( MaterialLoader.prototype, { if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap ); - if ( json.clearCoatNormalMap !== undefined ) material.clearCoatNormalMap = getTexture( json.clearCoatNormalMap ); - if ( json.clearCoatNormalScale !== undefined ) material.clearCoatNormalScale = new Vector2().fromArray( json.clearCoatNormalScale ); + if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap ); + if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale ); return material; diff --git a/src/materials/Material.js b/src/materials/Material.js index 4c12282e5fb18e..c7a2e44c86afa8 100644 --- a/src/materials/Material.js +++ b/src/materials/Material.js @@ -172,13 +172,13 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex(); if ( this.shininess !== undefined ) data.shininess = this.shininess; - if ( this.clearCoat !== undefined ) data.clearCoat = this.clearCoat; - if ( this.clearCoatRoughness !== undefined ) data.clearCoatRoughness = this.clearCoatRoughness; + if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat; + if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness; - if ( this.clearCoatNormalMap && this.clearCoatNormalMap.isTexture ) { + if ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) { - data.clearCoatNormalMap = this.clearCoatNormalMap.toJSON( meta ).uuid; - data.clearCoatNormalScale = this.clearCoatNormalScale.toArray(); + data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid; + data.clearcoatNormalScale = this.clearcoatNormalScale.toArray(); } diff --git a/src/materials/MeshPhysicalMaterial.d.ts b/src/materials/MeshPhysicalMaterial.d.ts index 5a5800fff5122e..07399cc9ef221d 100644 --- a/src/materials/MeshPhysicalMaterial.d.ts +++ b/src/materials/MeshPhysicalMaterial.d.ts @@ -9,13 +9,13 @@ import { Color } from './../math/Color'; export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialParameters { reflectivity?: number; - clearCoat?: number; - clearCoatRoughness?: number; + clearcoat?: number; + clearcoatRoughness?: number; sheen?: Color; - clearCoatNormalScale?: Vector2; - clearCoatNormalMap?: Texture; + clearcoatNormalScale?: Vector2; + clearcoatNormalMap?: Texture; } export class MeshPhysicalMaterial extends MeshStandardMaterial { @@ -24,12 +24,12 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial { defines: any; reflectivity: number; - clearCoat: number; - clearCoatRoughness: number; + clearcoat: number; + clearcoatRoughness: number; sheen: Color | null; - clearCoatNormalScale: Vector2; - clearCoatNormalMap: Texture | null; + clearcoatNormalScale: Vector2; + clearcoatNormalMap: Texture | null; } diff --git a/src/materials/MeshPhysicalMaterial.js b/src/materials/MeshPhysicalMaterial.js index 60c20f2313d900..7940c7bd7a7796 100644 --- a/src/materials/MeshPhysicalMaterial.js +++ b/src/materials/MeshPhysicalMaterial.js @@ -7,13 +7,13 @@ import { Color } from '../math/Color.js'; * * parameters = { * reflectivity: - * clearCoat: - * clearCoatRoughness: + * clearcoat: + * clearcoatRoughness: * * sheen: * - * clearCoatNormalScale: , - * clearCoatNormalMap: new THREE.Texture( ), + * clearcoatNormalScale: , + * clearcoatNormalMap: new THREE.Texture( ), * } */ @@ -27,13 +27,13 @@ function MeshPhysicalMaterial( parameters ) { this.reflectivity = 0.5; // maps to F0 = 0.04 - this.clearCoat = 0.0; - this.clearCoatRoughness = 0.0; + this.clearcoat = 0.0; + this.clearcoatRoughness = 0.0; this.sheen = null; // null will disable sheen bsdf - this.clearCoatNormalScale = new Vector2( 1, 1 ); - this.clearCoatNormalMap = null; + this.clearcoatNormalScale = new Vector2( 1, 1 ); + this.clearcoatNormalMap = null; this.setValues( parameters ); @@ -52,14 +52,14 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) { this.reflectivity = source.reflectivity; - this.clearCoat = source.clearCoat; - this.clearCoatRoughness = source.clearCoatRoughness; + this.clearcoat = source.clearcoat; + this.clearcoatRoughness = source.clearcoatRoughness; 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 ); + this.clearcoatNormalMap = source.clearcoatNormalMap; + this.clearcoatNormalScale.copy( source.clearcoatNormalScale ); return this; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index a1561ec461a588..c357ef45a41df8 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -2269,18 +2269,18 @@ function WebGLRenderer( parameters ) { uniforms.reflectivity.value = material.reflectivity; // also part of uniforms common - uniforms.clearCoat.value = material.clearCoat; - uniforms.clearCoatRoughness.value = material.clearCoatRoughness; + uniforms.clearcoat.value = material.clearcoat; + uniforms.clearcoatRoughness.value = material.clearcoatRoughness; if ( material.sheen ) uniforms.sheen.value.copy( material.sheen ); - if ( material.clearCoatNormalMap ) { + if ( material.clearcoatNormalMap ) { - uniforms.clearCoatNormalScale.value.copy( material.clearCoatNormalScale ); - uniforms.clearCoatNormalMap.value = material.clearCoatNormalMap; + uniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale ); + uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap; if ( material.side === BackSide ) { - uniforms.clearCoatNormalScale.value.negate(); + uniforms.clearcoatNormalScale.value.negate(); } diff --git a/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js b/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js index 05f3c7738364e1..cdf968a551114c 100644 --- a/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js @@ -1,7 +1,7 @@ export default /* glsl */` #ifdef PHYSICAL - vec3 clearCoatNormal = geometryNormal; + vec3 clearcoatNormal = geometryNormal; #endif `; diff --git a/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js b/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js index 7c0483cff58153..d6ea42a110434d 100644 --- a/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js @@ -3,14 +3,14 @@ export default /* glsl */` #ifdef USE_TANGENT - mat3 vTBN = mat3( tangent, bitangent, clearCoatNormal ); + mat3 vTBN = mat3( tangent, bitangent, clearcoatNormal ); vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; - mapN.xy = clearCoatNormalScale * mapN.xy; - clearCoatNormal = normalize( vTBN * mapN ); + mapN.xy = clearcoatNormalScale * mapN.xy; + clearcoatNormal = normalize( vTBN * mapN ); #else - clearCoatNormal = perturbNormal2Arb( - vViewPosition, clearCoatNormal, clearCoatNormalScale, clearCoatNormalMap ); + clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap ); #endif diff --git a/src/renderers/shaders/ShaderChunk/clearcoat_normalmap_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/clearcoat_normalmap_pars_fragment.glsl.js index 05f33b8447c391..d4f32b0fb7e858 100644 --- a/src/renderers/shaders/ShaderChunk/clearcoat_normalmap_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clearcoat_normalmap_pars_fragment.glsl.js @@ -1,8 +1,8 @@ export default /* glsl */` #ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearCoatNormalMap; - uniform vec2 clearCoatNormalScale; + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; #endif `; diff --git a/src/renderers/shaders/ShaderChunk/common.glsl.js b/src/renderers/shaders/ShaderChunk/common.glsl.js index 5445f66fc6051f..6266a24e6a0051 100644 --- a/src/renderers/shaders/ShaderChunk/common.glsl.js +++ b/src/renderers/shaders/ShaderChunk/common.glsl.js @@ -40,7 +40,7 @@ struct GeometricContext { vec3 normal; vec3 viewDir; #ifdef PHYSICAL - vec3 clearCoatNormal; + vec3 clearcoatNormal; #endif }; diff --git a/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js b/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js index 5d7b2d422c3229..b6cc6c91bdc505 100644 --- a/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js @@ -22,7 +22,7 @@ geometry.viewDir = normalize( vViewPosition ); #ifdef PHYSICAL - geometry.clearCoatNormal = clearCoatNormal; + geometry.clearcoatNormal = clearcoatNormal; #endif @@ -127,7 +127,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); - vec3 clearCoatRadiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); #endif `; diff --git a/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js b/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js index 5405840e2d9583..fa80028b62543d 100644 --- a/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js @@ -7,7 +7,7 @@ export default /* glsl */` #if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight ); + RE_IndirectSpecular( radiance, irradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif `; diff --git a/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js b/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js index 13adcb7bb4e4ca..0d16b0d5ca458c 100644 --- a/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js @@ -29,7 +29,7 @@ export default /* glsl */` #ifdef PHYSICAL - clearCoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearCoatNormal, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel ); + clearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, Material_Clearcoat_BlinnShininessExponent( material ), maxMipLevel ); #endif diff --git a/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js index 6fd8ef9198e6ac..533d3e48076fa7 100644 --- a/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js @@ -6,8 +6,8 @@ material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 ); material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor ); - material.clearCoat = saturate( clearCoat ); // Burley clearcoat model - material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 ); + material.clearcoat = saturate( clearcoat ); // Burley clearcoat model + material.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 ); #endif #ifdef USE_SHEEN material.sheenColor = sheen; diff --git a/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js index 78f1dacc072332..f486d01687987c 100644 --- a/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js @@ -6,8 +6,8 @@ struct PhysicalMaterial { vec3 specularColor; #ifdef PHYSICAL - float clearCoat; - float clearCoatRoughness; + float clearcoat; + float clearcoatRoughness; #endif #ifdef USE_SHEEN @@ -20,7 +20,7 @@ struct PhysicalMaterial { #define DEFAULT_SPECULAR_COEFFICIENT 0.04 // Clear coat directional hemishperical reflectance (this approximation should be improved) -float clearCoatDHRApprox( const in float roughness, const in float dotNL ) { +float clearcoatDHRApprox( const in float roughness, const in float dotNL ) { return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) ); @@ -82,7 +82,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC #ifdef PHYSICAL - float ccDotNL = saturate( dot( geometry.clearCoatNormal, directLight.direction ) ); + float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = ccDotNL * directLight.color; @@ -92,28 +92,28 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC #endif - float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, ccDotNL ); + float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); - reflectedLight.directSpecular += ccIrradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearCoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness ); + reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); #else - float clearCoatDHR = 0.0; + float clearcoatDHR = 0.0; #endif #ifdef USE_SHEEN - reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_Sheen( + reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen( material.specularRoughness, directLight.direction, geometry, material.sheenColor ); #else - reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness); + reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness); #endif - reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); + reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { @@ -121,24 +121,24 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricCo } -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef PHYSICAL - float ccDotNV = saturate( dot( geometry.clearCoatNormal, geometry.viewDir ) ); + float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); - reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearCoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness ); + reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); float ccDotNL = ccDotNV; - float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, ccDotNL ); + float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); #else - float clearCoatDHR = 0.0; + float clearcoatDHR = 0.0; #endif - float clearCoatInv = 1.0 - clearCoatDHR; + float clearcoatInv = 1.0 - clearcoatDHR; // Both indirect specular and diffuse light accumulate here // if energy preservation enabled, and PMREM provided. @@ -151,7 +151,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); - reflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering; + reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering; reflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; @@ -163,7 +163,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical #define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness ) -#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness ) +#define Material_Clearcoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearcoatRoughness ) // ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { diff --git a/src/renderers/shaders/ShaderLib.js b/src/renderers/shaders/ShaderLib.js index d32c6a2e69890d..55ababdbaf5f2c 100644 --- a/src/renderers/shaders/ShaderLib.js +++ b/src/renderers/shaders/ShaderLib.js @@ -273,11 +273,11 @@ ShaderLib.physical = { uniforms: mergeUniforms( [ ShaderLib.standard.uniforms, { - clearCoat: { value: 0 }, - clearCoatRoughness: { value: 0 }, + clearcoat: { value: 0 }, + clearcoatRoughness: { value: 0 }, sheen: { value: new Color( 0x000000 ) }, - clearCoatNormalScale: { value: new Vector2( 1, 1 ) }, - clearCoatNormalMap: { value: null }, + clearcoatNormalScale: { value: new Vector2( 1, 1 ) }, + clearcoatNormalMap: { value: null }, } ] ), diff --git a/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js b/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js index 2ccbe0ba9fd56c..27962a66e55a9b 100644 --- a/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js +++ b/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js @@ -8,8 +8,8 @@ uniform float metalness; uniform float opacity; #ifdef PHYSICAL - uniform float clearCoat; - uniform float clearCoatRoughness; + uniform float clearcoat; + uniform float clearcoatRoughness; #endif #ifdef USE_SHEEN diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js index 057d1cf3ecbd64..7472af1488987d 100644 --- a/src/renderers/webgl/WebGLProgram.js +++ b/src/renderers/webgl/WebGLProgram.js @@ -120,7 +120,7 @@ function generateExtensions( extensions, parameters, rendererExtensions ) { extensions = extensions || {}; var chunks = [ - ( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || ( parameters.normalMap && ! parameters.objectSpaceNormalMap ) || parameters.clearCoatNormalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '', + ( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || ( parameters.normalMap && ! parameters.objectSpaceNormalMap ) || parameters.clearcoatNormalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '', ( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '', ( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '', ( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : '' @@ -391,7 +391,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters, parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', ( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '', - parameters.clearCoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', + parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', @@ -509,7 +509,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters, parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', ( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '', - parameters.clearCoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', + parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', diff --git a/src/renderers/webgl/WebGLPrograms.js b/src/renderers/webgl/WebGLPrograms.js index bc63ba1ffd5712..23c2e862ad084d 100644 --- a/src/renderers/webgl/WebGLPrograms.js +++ b/src/renderers/webgl/WebGLPrograms.js @@ -29,7 +29,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { var parameterNames = [ "precision", "supportsVertexTextures", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", - "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "clearCoatNormalMap", "displacementMap", "specularMap", + "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "vertexTangents", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", @@ -154,7 +154,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { bumpMap: !! material.bumpMap, normalMap: !! material.normalMap, objectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap, - clearCoatNormalMap: !! material.clearCoatNormalMap, + clearcoatNormalMap: !! material.clearcoatNormalMap, displacementMap: !! material.displacementMap, roughnessMap: !! material.roughnessMap, metalnessMap: !! material.metalnessMap, @@ -169,7 +169,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { vertexTangents: ( material.normalMap && material.vertexTangents ), vertexColors: material.vertexColors, - vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearCoatNormalMap, + vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap, fog: !! fog, useFog: material.fog,