Switch viewport to a bright CAD/3D-design-tool look
Replaced the dark showroom scene (gradient sky, mirror-style reflections, bloom glow) with a clean white background, light studio ground, and a visible reference grid (GridHelper) - the classic modeling-software viewport aesthetic. Dropped the bloom postprocessing pass entirely since it blew out badly against the white background and doesn't fit a technical viewport anyway; tuned taillight/trim materials back down to plain (non-bloom) emissive levels.
This commit is contained in:
parent
20f61a48ed
commit
a670211258
2 changed files with 13 additions and 45 deletions
56
app.js
56
app.js
|
|
@ -2,10 +2,6 @@ import * as THREE from "three";
|
||||||
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
||||||
import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js";
|
import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js";
|
||||||
import { RoundedBoxGeometry } from "three/addons/geometries/RoundedBoxGeometry.js";
|
import { RoundedBoxGeometry } from "three/addons/geometries/RoundedBoxGeometry.js";
|
||||||
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
|
||||||
import { RenderPass } from "three/addons/postprocessing/RenderPass.js";
|
|
||||||
import { UnrealBloomPass } from "three/addons/postprocessing/UnrealBloomPass.js";
|
|
||||||
import { OutputPass } from "three/addons/postprocessing/OutputPass.js";
|
|
||||||
|
|
||||||
const searchInput = document.getElementById("searchInput");
|
const searchInput = document.getElementById("searchInput");
|
||||||
const suggestionsBox = document.getElementById("suggestions");
|
const suggestionsBox = document.getElementById("suggestions");
|
||||||
|
|
@ -370,7 +366,7 @@ function updateActiveSuggestion(items) {
|
||||||
|
|
||||||
// ---------- 3D Szene ----------
|
// ---------- 3D Szene ----------
|
||||||
|
|
||||||
let renderer, scene, camera, controls, trunkGroup, composer, bloomPass;
|
let renderer, scene, camera, controls, trunkGroup;
|
||||||
let carpetTexBase = null;
|
let carpetTexBase = null;
|
||||||
let boxTexBase = null;
|
let boxTexBase = null;
|
||||||
let currentTub = null; // Geometrie-Kenndaten des aktuell gewählten Kofferraums
|
let currentTub = null; // Geometrie-Kenndaten des aktuell gewählten Kofferraums
|
||||||
|
|
@ -397,9 +393,8 @@ function setupScene() {
|
||||||
const pmrem = new THREE.PMREMGenerator(renderer);
|
const pmrem = new THREE.PMREMGenerator(renderer);
|
||||||
scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;
|
scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;
|
||||||
|
|
||||||
// Dezenter Himmel-Gradient als Hintergrund: ohne ihn hat der Spiegelboden nichts Helles zum
|
// Heller, neutraler Hintergrund wie in einer 3D-Design-/CAD-Software
|
||||||
// Reflektieren und wirkt komplett schwarz.
|
scene.background = new THREE.Color(0xf3f4f6);
|
||||||
scene.background = createSkyGradientTexture();
|
|
||||||
|
|
||||||
controls = new OrbitControls(camera, renderer.domElement);
|
controls = new OrbitControls(camera, renderer.domElement);
|
||||||
controls.enableDamping = true;
|
controls.enableDamping = true;
|
||||||
|
|
@ -408,7 +403,7 @@ function setupScene() {
|
||||||
controls.maxDistance = 8;
|
controls.maxDistance = 8;
|
||||||
controls.maxPolarAngle = Math.PI * 0.49;
|
controls.maxPolarAngle = Math.PI * 0.49;
|
||||||
|
|
||||||
const hemi = new THREE.HemisphereLight(0xcfd8e8, 0x14151a, 1.5);
|
const hemi = new THREE.HemisphereLight(0xffffff, 0xd8dbe0, 1.5);
|
||||||
scene.add(hemi);
|
scene.add(hemi);
|
||||||
|
|
||||||
const key = new THREE.DirectionalLight(0xfff6e8, 1.8);
|
const key = new THREE.DirectionalLight(0xfff6e8, 1.8);
|
||||||
|
|
@ -440,27 +435,19 @@ function setupScene() {
|
||||||
carpetTexBase = createNoiseTexture("#2c2d30", 190, 40, 0.11);
|
carpetTexBase = createNoiseTexture("#2c2d30", 190, 40, 0.11);
|
||||||
boxTexBase = createNoiseTexture("#46474b", 210, 35, 0.1);
|
boxTexBase = createNoiseTexture("#46474b", 210, 35, 0.1);
|
||||||
|
|
||||||
// Matter Studioboden (großzügig bemessen, damit der Rand nicht ins Bild ragt).
|
// Heller Boden mit Referenzgitter, wie im Viewport einer 3D-Design-Software.
|
||||||
// Liegt unterhalb der tiefsten Unterboden-Mulde, sonst würde er sie überdecken.
|
// Liegt unterhalb der tiefsten Unterboden-Mulde, sonst würde er sie überdecken.
|
||||||
const groundY = -0.4;
|
const groundY = -0.4;
|
||||||
const groundGeo = new THREE.CircleGeometry(18, 64);
|
const groundGeo = new THREE.CircleGeometry(18, 64);
|
||||||
const ground = new THREE.Mesh(groundGeo, new THREE.MeshStandardMaterial({ color: 0x121317, roughness: 1 }));
|
const ground = new THREE.Mesh(groundGeo, new THREE.MeshStandardMaterial({ color: 0xf7f7f9, roughness: 1 }));
|
||||||
ground.rotation.x = -Math.PI / 2;
|
ground.rotation.x = -Math.PI / 2;
|
||||||
ground.position.y = groundY;
|
ground.position.y = groundY;
|
||||||
ground.receiveShadow = true;
|
ground.receiveShadow = true;
|
||||||
scene.add(ground);
|
scene.add(ground);
|
||||||
|
|
||||||
// Bloom-Postprocessing für dezentes Aufleuchten an Rückleuchten und Zierring
|
const grid = new THREE.GridHelper(6, 24, 0xb9bcc3, 0xdcdee2);
|
||||||
composer = new EffectComposer(renderer);
|
grid.position.y = groundY + 0.001;
|
||||||
composer.addPass(new RenderPass(scene, camera));
|
scene.add(grid);
|
||||||
bloomPass = new UnrealBloomPass(
|
|
||||||
new THREE.Vector2(viewerEl.clientWidth || 800, viewerEl.clientHeight || 600),
|
|
||||||
0.55, // strength
|
|
||||||
0.5, // radius
|
|
||||||
0.82 // threshold
|
|
||||||
);
|
|
||||||
composer.addPass(bloomPass);
|
|
||||||
composer.addPass(new OutputPass());
|
|
||||||
|
|
||||||
setupDragging();
|
setupDragging();
|
||||||
|
|
||||||
|
|
@ -478,31 +465,12 @@ function onResize() {
|
||||||
camera.aspect = w / h;
|
camera.aspect = w / h;
|
||||||
camera.updateProjectionMatrix();
|
camera.updateProjectionMatrix();
|
||||||
renderer.setSize(w, h);
|
renderer.setSize(w, h);
|
||||||
if (composer) composer.setSize(w, h);
|
|
||||||
if (bloomPass) bloomPass.setSize(w, h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
controls.update();
|
controls.update();
|
||||||
composer.render();
|
renderer.render(scene, camera);
|
||||||
}
|
|
||||||
|
|
||||||
// Dezenter vertikaler Verlauf als Szenenhintergrund (dient auch als Reflexionsquelle für den Spiegelboden)
|
|
||||||
function createSkyGradientTexture() {
|
|
||||||
const canvas = document.createElement("canvas");
|
|
||||||
canvas.width = 8;
|
|
||||||
canvas.height = 256;
|
|
||||||
const ctx = canvas.getContext("2d");
|
|
||||||
const grad = ctx.createLinearGradient(0, 0, 0, 256);
|
|
||||||
grad.addColorStop(0, "#2f3648");
|
|
||||||
grad.addColorStop(0.5, "#1c212b");
|
|
||||||
grad.addColorStop(1, "#0e1015");
|
|
||||||
ctx.fillStyle = grad;
|
|
||||||
ctx.fillRect(0, 0, 8, 256);
|
|
||||||
const tex = new THREE.CanvasTexture(canvas);
|
|
||||||
tex.colorSpace = THREE.SRGBColorSpace;
|
|
||||||
return tex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prozedurale Stoff-/Filz-Textur (feines Rauschen um eine Basisfarbe)
|
// Prozedurale Stoff-/Filz-Textur (feines Rauschen um eine Basisfarbe)
|
||||||
|
|
@ -582,7 +550,7 @@ function buildRearAssembly(bw, tw, h, zBack) {
|
||||||
const paintMat = paintMaterial(BODY_PAINT_COLOR);
|
const paintMat = paintMaterial(BODY_PAINT_COLOR);
|
||||||
const trimMat = new THREE.MeshStandardMaterial({ color: 0x1c1d20, roughness: 0.85 });
|
const trimMat = new THREE.MeshStandardMaterial({ color: 0x1c1d20, roughness: 0.85 });
|
||||||
const lightMat = new THREE.MeshPhysicalMaterial({
|
const lightMat = new THREE.MeshPhysicalMaterial({
|
||||||
color: 0x7a0f14, emissive: 0xff2233, emissiveIntensity: 1.1, metalness: 0.3, roughness: 0.3, clearcoat: 0.8,
|
color: 0x7a0f14, emissive: 0x660000, emissiveIntensity: 0.4, metalness: 0.3, roughness: 0.3, clearcoat: 0.8,
|
||||||
});
|
});
|
||||||
|
|
||||||
const zA = zBack;
|
const zA = zBack;
|
||||||
|
|
@ -903,7 +871,7 @@ function buildSubGroup(wM, hM, dM) {
|
||||||
const trim = new THREE.Mesh(
|
const trim = new THREE.Mesh(
|
||||||
new THREE.TorusGeometry(driverRadius * 1.08, driverRadius * 0.035, 12, 40),
|
new THREE.TorusGeometry(driverRadius * 1.08, driverRadius * 0.035, 12, 40),
|
||||||
new THREE.MeshStandardMaterial({
|
new THREE.MeshStandardMaterial({
|
||||||
color: 0xff8a3d, emissive: 0xff8a3d, emissiveIntensity: 0.5, roughness: 0.4, metalness: 0.5,
|
color: 0xff8a3d, roughness: 0.4, metalness: 0.5,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
trim.rotation.x = Math.PI / 2;
|
trim.rotation.x = Math.PI / 2;
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,7 @@ main {
|
||||||
|
|
||||||
.viewer-wrap {
|
.viewer-wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: radial-gradient(circle at 50% 30%, #232935, #12151a 75%);
|
background: #f3f4f6;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue