mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-11 06:34:30 +00:00
The single biggest fidelity lever from the charrette. Core had only three.module.min.js (no postprocessing addons), so this vendors the r170 EffectComposer/RenderPass/UnrealBloomPass/OutputPass + their shader deps into static/vendor/three/addons/, with every `from 'three'` rewritten to the SAME vendored three (../../three.module.min.js) so the addons share the plugin's three instance (a CDN copy would be a second, non-interoperable module). highway_3d wiring: - Lazy-loads the addons only when the new `bloom` setting is on (dynamic import), builds EffectComposer(RenderPass → UnrealBloomPass(strength .65/radius .5/ threshold .82 — high so only emissive gems + the hit flash bloom) → OutputPass). - Render loop uses composer.render() with ACES tone-mapping when bloom is active, else the unchanged direct ren.render() with NoToneMapping (bloom-off = today's look). - Perf-gated: OFF in splitscreen; graceful fallback to direct render if the modules or composer fail; composer.setSize on canvas resize; disposed on teardown. - settings.html: "Glow bloom" toggle (default on). Verified the import chain resolves + renders via a same-origin module-load test (EffectComposer built + a bloom frame rendered, three r170). Charrette status: 7/8 (only #5's early/late timing tint remains — a notedetect verdict-field change, outside the highway). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Q9BpGYqUaga9ZJyS3dDPq
65 lines
1.1 KiB
JavaScript
65 lines
1.1 KiB
JavaScript
import {
|
|
Color
|
|
} from '../../three.module.min.js';
|
|
|
|
/**
|
|
* Luminosity
|
|
* http://en.wikipedia.org/wiki/Luminosity
|
|
*/
|
|
|
|
const LuminosityHighPassShader = {
|
|
|
|
name: 'LuminosityHighPassShader',
|
|
|
|
shaderID: 'luminosityHighPass',
|
|
|
|
uniforms: {
|
|
|
|
'tDiffuse': { value: null },
|
|
'luminosityThreshold': { value: 1.0 },
|
|
'smoothWidth': { value: 1.0 },
|
|
'defaultColor': { value: new Color( 0x000000 ) },
|
|
'defaultOpacity': { value: 0.0 }
|
|
|
|
},
|
|
|
|
vertexShader: /* glsl */`
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vUv = uv;
|
|
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
|
|
}`,
|
|
|
|
fragmentShader: /* glsl */`
|
|
|
|
uniform sampler2D tDiffuse;
|
|
uniform vec3 defaultColor;
|
|
uniform float defaultOpacity;
|
|
uniform float luminosityThreshold;
|
|
uniform float smoothWidth;
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vec4 texel = texture2D( tDiffuse, vUv );
|
|
|
|
float v = luminance( texel.xyz );
|
|
|
|
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
|
|
|
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
|
|
|
gl_FragColor = mix( outputColor, texel, alpha );
|
|
|
|
}`
|
|
|
|
};
|
|
|
|
export { LuminosityHighPassShader };
|