Feature: add postprocessing and tune it

This commit is contained in:
Dejvino
2025-11-22 14:41:09 +01:00
parent ed47fb9fdc
commit 87a524b013
8 changed files with 55 additions and 11 deletions
+4 -4
View File
@@ -17,14 +17,14 @@ export class LightBall extends SceneFeature {
init() {
// --- Ball Properties ---
const ballRadius = 0.4;
const ballRadius = 0.2;
const lightIntensity = 5.0;
const lightColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0x00ffff, 0xff00ff]; // Red, Green, Blue, Yellow
const lightColors = [0xff2222, 0x11ff11, 0x2222ff, 0xffff11, 0x00ffff, 0xff00ff]; // Red, Green, Blue, Yellow
lightColors.forEach(color => {
// --- Create the Ball ---
const ballGeometry = new THREE.SphereGeometry(ballRadius, 32, 32);
const ballMaterial = new THREE.MeshBasicMaterial({ color: color, emissive: color, emissiveIntensity: 1.0 });
const ballMaterial = new THREE.MeshBasicMaterial({ color: color, emissive: color, emissiveIntensity: 1.2 });
const ball = new THREE.Mesh(ballGeometry, ballMaterial);
ball.castShadow = false;
ball.receiveShadow = false;
@@ -40,7 +40,7 @@ export class LightBall extends SceneFeature {
);
light.position.copy(ball.position);
state.scene.add(ball);
//state.scene.add(ball);
state.scene.add(light);
this.lightBalls.push({
@@ -42,7 +42,7 @@ export class MedievalMusicians extends SceneFeature {
// 3. Process the entire canvas to make background transparent
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
const threshold = 20; // Adjust this for more/less color tolerance
const threshold = 25; // Adjust this for more/less color tolerance
for (let i = 0; i < data.length; i += 4) {
const r = data[i];
@@ -85,8 +85,8 @@ export class MedievalMusicians extends SceneFeature {
// Get the pure texture color
vec4 texColor = texture2D(vibrancyMap, vMapUv);
// Mix the final lit color with the pure texture color to keep it vibrant
float vibrancy = 0.6; // 0.0 = full lighting, 1.0 = full texture color
gl_FragColor.rgb = mix(gl_FragColor.rgb, texColor.rgb, vibrancy);
float vibrancy = 0.3; // 0.0 = full lighting, 1.0 = full texture color
gl_FragColor.rgb = mix(gl_FragColor.rgb, texColor.rgb, vibrancy) + texColor.rgb * 0.2;
`
);
};
+1
View File
@@ -15,6 +15,7 @@ import { Dancers } from './dancers.js';
import { MusicVisualizer } from './music-visualizer.js';
import { RoseWindowLight } from './rose-window-light.js';
import { RoseWindowLightshafts } from './rose-window-lightshafts.js';
import { StainedGlass } from './stained-glass-window.js';
// Scene Features ^^^
// --- Scene Modeling Function ---