From c87e086009de31f39dee5a5872d844a1dc153a0e Mon Sep 17 00:00:00 2001
From: Casey Primozic
Date: Wed, 13 Sep 2023 22:03:42 -0700
Subject: [PATCH 1/5] Add some missing options to `MeshPhysicalMaterial` demo
* Add GUI options for some missing properties including sheen, ior, iridescence, and others to the material browser embedded on the docs pages for materials
---
docs/scenes/material-browser.html | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/docs/scenes/material-browser.html b/docs/scenes/material-browser.html
index 15477c806ece84..ca5531d7f2640a 100644
--- a/docs/scenes/material-browser.html
+++ b/docs/scenes/material-browser.html
@@ -530,7 +530,8 @@
envMaps: envMapKeysPBR[ 0 ],
map: diffuseMapKeys[ 0 ],
roughnessMap: roughnessMapKeys[ 0 ],
- alphaMap: alphaMapKeys[ 0 ]
+ alphaMap: alphaMapKeys[ 0 ],
+ metalnessMap: alphaMapKeys[ 0 ]
};
const folder = gui.addFolder( 'THREE.MeshStandardMaterial' );
@@ -548,8 +549,7 @@
folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
folder.add( data, 'roughnessMap', roughnessMapKeys ).onChange( updateTexture( material, 'roughnessMap', roughnessMaps ) );
folder.add( data, 'alphaMap', alphaMapKeys ).onChange( updateTexture( material, 'alphaMap', alphaMaps ) );
-
- // TODO metalnessMap
+ folder.add( data, 'metalnessMap', alphaMapKeys ).onChange( updateTexture( material, 'metalnessMap', alphaMaps ) );
}
@@ -561,7 +561,11 @@
envMaps: envMapKeys[ 0 ],
map: diffuseMapKeys[ 0 ],
roughnessMap: roughnessMapKeys[ 0 ],
- alphaMap: alphaMapKeys[ 0 ]
+ alphaMap: alphaMapKeys[ 0 ],
+ metalnessMap: alphaMapKeys[ 0 ],
+ sheenColor: 0xffffff,
+ specularColor: material.specularColor.getHex(),
+ iridescenceMap: alphaMapKeys[ 0 ]
};
const folder = gui.addFolder( 'THREE.MeshPhysicalMaterial' );
@@ -571,9 +575,17 @@
folder.add( material, 'roughness', 0, 1 );
folder.add( material, 'metalness', 0, 1 );
+ folder.add( material, 'ior', 1, 2.333 );
folder.add( material, 'reflectivity', 0, 1 );
+ folder.add( material, 'iridescence', 0, 1 );
+ folder.add( material, 'iridescenceIOR', 1, 2.333 );
+ folder.add( material, 'sheen', 0, 1 );
+ folder.add( material, 'sheenRoughness', 0, 1 );
+ folder.addColor( data, 'sheenColor' ).onChange( handleColorChange( material.sheenColor ) );
folder.add( material, 'clearcoat', 0, 1 ).step( 0.01 );
folder.add( material, 'clearcoatRoughness', 0, 1 ).step( 0.01 );
+ folder.add( material, 'specularIntensity', 0, 1);
+ folder.addColor( data, 'specularColor' ).onChange( handleColorChange( material.specularColor ) );
folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
folder.add( material, 'wireframe' );
folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
@@ -582,8 +594,8 @@
folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
folder.add( data, 'roughnessMap', roughnessMapKeys ).onChange( updateTexture( material, 'roughnessMap', roughnessMaps ) );
folder.add( data, 'alphaMap', alphaMapKeys ).onChange( updateTexture( material, 'alphaMap', alphaMaps ) );
-
- // TODO metalnessMap
+ folder.add( data, 'metalnessMap', alphaMapKeys ).onChange( updateTexture( material, 'metalnessMap', alphaMaps ) );
+ folder.add( data, 'iridescenceMap', alphaMapKeys ).onChange( updateTexture( material, 'iridescenceMap', alphaMaps ) );
}
@@ -678,10 +690,6 @@
guiMaterial( gui, mesh, material, geometry );
guiMeshPhysicalMaterial( gui, mesh, material, geometry );
- // only use scene environment
-
- light1.visible = false;
- light2.visible = false;
light3.visible = false;
return material;
From ba2778e98cea992f6d173935477b9cfe518ec9f3 Mon Sep 17 00:00:00 2001
From: Casey Primozic
Date: Thu, 14 Sep 2023 10:29:27 -0700
Subject: [PATCH 2/5] Use real default `sheenColor in material browser
---
docs/scenes/material-browser.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/scenes/material-browser.html b/docs/scenes/material-browser.html
index ca5531d7f2640a..6c40db7375c2bb 100644
--- a/docs/scenes/material-browser.html
+++ b/docs/scenes/material-browser.html
@@ -563,7 +563,7 @@
roughnessMap: roughnessMapKeys[ 0 ],
alphaMap: alphaMapKeys[ 0 ],
metalnessMap: alphaMapKeys[ 0 ],
- sheenColor: 0xffffff,
+ sheenColor: material.sheenColor.getHex(),
specularColor: material.specularColor.getHex(),
iridescenceMap: alphaMapKeys[ 0 ]
};
From 0f5088d53165c0ee9d903d40bc75eb2d554ba55c Mon Sep 17 00:00:00 2001
From: Casey Primozic
Date: Thu, 14 Sep 2023 11:07:42 -0700
Subject: [PATCH 3/5] Re-disable dirlights in `MeshPhysicalMaterial` material
browser
---
docs/scenes/material-browser.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/scenes/material-browser.html b/docs/scenes/material-browser.html
index 6c40db7375c2bb..803e6b7705c29c 100644
--- a/docs/scenes/material-browser.html
+++ b/docs/scenes/material-browser.html
@@ -690,6 +690,8 @@
guiMaterial( gui, mesh, material, geometry );
guiMeshPhysicalMaterial( gui, mesh, material, geometry );
+ light1.visible = false;
+ light2.visible = false;
light3.visible = false;
return material;
From 42b9643a59aac885d5abbf28959e6df9801e328f Mon Sep 17 00:00:00 2001
From: Casey Primozic
Date: Thu, 14 Sep 2023 11:18:58 -0700
Subject: [PATCH 4/5] Update docs to correct the default `sheenColor`
* Docs stated it was 0xfffff, but it's actually 0x000000
* Fixes https://github.com/mrdoob/three.js/issues/26757
---
docs/api/ar/materials/MeshPhysicalMaterial.html | 2 +-
docs/api/en/materials/MeshPhysicalMaterial.html | 2 +-
docs/api/fr/materials/MeshPhysicalMaterial.html | 2 +-
docs/api/it/materials/MeshPhysicalMaterial.html | 2 +-
docs/api/zh/materials/MeshPhysicalMaterial.html | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/api/ar/materials/MeshPhysicalMaterial.html b/docs/api/ar/materials/MeshPhysicalMaterial.html
index d7a66ad07dcb63..5f51448cbb96c1 100644
--- a/docs/api/ar/materials/MeshPhysicalMaterial.html
+++ b/docs/api/ar/materials/MeshPhysicalMaterial.html
@@ -186,7 +186,7 @@ [property:Texture sheenRoughnessMap]
[property:Color sheenColor]
- لون اللمعان. الافتراضي هو `0xffffff`، أبيض.
+ لون اللمعان. الافتراضي هو `0x000000`، أسود.
[property:Texture sheenColorMap]
diff --git a/docs/api/en/materials/MeshPhysicalMaterial.html b/docs/api/en/materials/MeshPhysicalMaterial.html
index d6b2529f55977f..8d505fb36def0a 100644
--- a/docs/api/en/materials/MeshPhysicalMaterial.html
+++ b/docs/api/en/materials/MeshPhysicalMaterial.html
@@ -227,7 +227,7 @@
[property:Texture sheenRoughnessMap]
[property:Color sheenColor]
- The sheen tint. Default is `0xffffff`, white.
+ The sheen tint. Default is `0x000000`, black.
[property:Texture sheenColorMap]
diff --git a/docs/api/fr/materials/MeshPhysicalMaterial.html b/docs/api/fr/materials/MeshPhysicalMaterial.html
index 6c53a737bf4e91..a95791af67dff4 100644
--- a/docs/api/fr/materials/MeshPhysicalMaterial.html
+++ b/docs/api/fr/materials/MeshPhysicalMaterial.html
@@ -161,7 +161,7 @@
[property:Texture sheenRoughnessMap]
[property:Color sheenColor]
- La teinte brillante. La valeur par défaut est `0xffffff`, white.
+ La teinte brillante. La valeur par défaut est `0x000000`, noire.
[property:Texture sheenColorMap]
diff --git a/docs/api/it/materials/MeshPhysicalMaterial.html b/docs/api/it/materials/MeshPhysicalMaterial.html
index 3234d46871b9d7..7596b235cf43c8 100644
--- a/docs/api/it/materials/MeshPhysicalMaterial.html
+++ b/docs/api/it/materials/MeshPhysicalMaterial.html
@@ -166,7 +166,7 @@ [property:Texture sheenRoughnessMap]
[property:Color sheenColor]
- La tinta brillante. Il valore predefinito è `0xffffff`, bianco.
+ La tinta brillante. Il valore predefinito è `0x000000`, nera.
[property:Texture sheenColorMap]
diff --git a/docs/api/zh/materials/MeshPhysicalMaterial.html b/docs/api/zh/materials/MeshPhysicalMaterial.html
index 8779fa4b0535a7..f66cfa0a936e96 100644
--- a/docs/api/zh/materials/MeshPhysicalMaterial.html
+++ b/docs/api/zh/materials/MeshPhysicalMaterial.html
@@ -149,7 +149,7 @@ [property:Texture sheenRoughnessMap]
[property:Color sheenColor]
- 光泽颜色,默认为*0xffffff*白色。
+ 光泽颜色,默认为*0x000000*黑色。
[property:Texture sheenColorMap]
From f262559b74eceef019bf552f4350dbe4ad6a2107 Mon Sep 17 00:00:00 2001
From: Casey Primozic
Date: Thu, 14 Sep 2023 11:22:52 -0700
Subject: [PATCH 5/5] Add back deleted comment
---
docs/scenes/material-browser.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/scenes/material-browser.html b/docs/scenes/material-browser.html
index 803e6b7705c29c..ca4d2689e2c1e4 100644
--- a/docs/scenes/material-browser.html
+++ b/docs/scenes/material-browser.html
@@ -690,6 +690,8 @@
guiMaterial( gui, mesh, material, geometry );
guiMeshPhysicalMaterial( gui, mesh, material, geometry );
+ // only use scene environment
+
light1.visible = false;
light2.visible = false;
light3.visible = false;