Make metal default for rubber duck

This commit is contained in:
Diego Marcos Segura
2025-05-28 15:56:16 -07:00
parent c0897dcfe2
commit 3192bbdf93
+5 -6
View File
@@ -2,7 +2,6 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Forge • Environment Mapping</title> <title>Forge • Environment Mapping</title>
<style> <style>
body { body {
@@ -28,7 +27,7 @@
</head> </head>
<body> <body>
<label><input type="checkbox" onchange="toggleMetal(this)" autocomplete="off"> Metal</label> <label><input type="checkbox" onchange="toggleMetal(this)" autocomplete="off"> Plastic</label>
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
@@ -107,8 +106,8 @@
// Set some reflectivity in the materials of the duck // Set some reflectivity in the materials of the duck
obj.material.envMap = envMap; obj.material.envMap = envMap;
obj.material.original_color = obj.material.color.clone(); obj.material.original_color = obj.material.color.clone();
obj.material.metalness = 0.0; obj.material.metalness = 1.0;
obj.material.roughness = 0.2; obj.material.roughness = 0.02;
} }
}); });
} }
@@ -118,8 +117,8 @@
window.toggleMetal = function toggleMetal(el) { window.toggleMetal = function toggleMetal(el) {
const metal = el.checked; const metal = el.checked;
for (let obj of duck.children) { for (let obj of duck.children) {
obj.material.metalness = metal ? 1.0 : 0.0; obj.material.metalness = metal ? 0.0 : 1.0;
obj.material.roughness = metal ? 0.02 : 0.2; obj.material.roughness = metal ? 0.2 : 0.02;
} }
} }
</script> </script>