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:
Maaxxs 2026-09-01 10:56:29 +02:00
parent 20f61a48ed
commit a670211258
2 changed files with 13 additions and 45 deletions

56
app.js
View file

@ -2,10 +2,6 @@ import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.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 suggestionsBox = document.getElementById("suggestions");
@ -370,7 +366,7 @@ function updateActiveSuggestion(items) {
// ---------- 3D Szene ----------
let renderer, scene, camera, controls, trunkGroup, composer, bloomPass;
let renderer, scene, camera, controls, trunkGroup;
let carpetTexBase = null;
let boxTexBase = null;
let currentTub = null; // Geometrie-Kenndaten des aktuell gewählten Kofferraums
@ -397,9 +393,8 @@ function setupScene() {
const pmrem = new THREE.PMREMGenerator(renderer);
scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;
// Dezenter Himmel-Gradient als Hintergrund: ohne ihn hat der Spiegelboden nichts Helles zum
// Reflektieren und wirkt komplett schwarz.
scene.background = createSkyGradientTexture();
// Heller, neutraler Hintergrund wie in einer 3D-Design-/CAD-Software
scene.background = new THREE.Color(0xf3f4f6);
controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
@ -408,7 +403,7 @@ function setupScene() {
controls.maxDistance = 8;
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);
const key = new THREE.DirectionalLight(0xfff6e8, 1.8);
@ -440,27 +435,19 @@ function setupScene() {
carpetTexBase = createNoiseTexture("#2c2d30", 190, 40, 0.11);
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.
const groundY = -0.4;
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.position.y = groundY;
ground.receiveShadow = true;
scene.add(ground);
// Bloom-Postprocessing für dezentes Aufleuchten an Rückleuchten und Zierring
composer = new EffectComposer(renderer);
composer.addPass(new RenderPass(scene, camera));
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());
const grid = new THREE.GridHelper(6, 24, 0xb9bcc3, 0xdcdee2);
grid.position.y = groundY + 0.001;
scene.add(grid);
setupDragging();
@ -478,31 +465,12 @@ function onResize() {
camera.aspect = w / h;
camera.updateProjectionMatrix();
renderer.setSize(w, h);
if (composer) composer.setSize(w, h);
if (bloomPass) bloomPass.setSize(w, h);
}
function animate() {
requestAnimationFrame(animate);
controls.update();
composer.render();
}
// 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;
renderer.render(scene, camera);
}
// 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 trimMat = new THREE.MeshStandardMaterial({ color: 0x1c1d20, roughness: 0.85 });
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;
@ -903,7 +871,7 @@ function buildSubGroup(wM, hM, dM) {
const trim = new THREE.Mesh(
new THREE.TorusGeometry(driverRadius * 1.08, driverRadius * 0.035, 12, 40),
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;

View file

@ -368,7 +368,7 @@ main {
.viewer-wrap {
position: relative;
background: radial-gradient(circle at 50% 30%, #232935, #12151a 75%);
background: #f3f4f6;
border: 1px solid var(--border);
border-radius: 14px;
overflow: hidden;