Skip to content

Commit ee29432

Browse files
committed
fix: separate post-processing components by quality level
1 parent a5634d1 commit ee29432

1 file changed

Lines changed: 84 additions & 29 deletions

File tree

apps/hub/src/world/SceneManager.tsx

Lines changed: 84 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,51 +54,106 @@ function LoadingFallback() {
5454
// Post Processing
5555
// ============================================================================
5656

57-
function PostProcessing() {
58-
const quality = useWorldStore((state) => state.quality);
59-
60-
// Disable effects on low quality
61-
if (quality === 'low') return null;
62-
57+
function PostProcessingLow() {
6358
return (
64-
<EffectComposer multisampling={quality === 'ultra' ? 8 : 4}>
65-
{/* Bloom for glow effects */}
59+
<EffectComposer multisampling={0}>
60+
<Bloom
61+
intensity={0.4}
62+
luminanceThreshold={0.3}
63+
luminanceSmoothing={0.9}
64+
/>
65+
</EffectComposer>
66+
);
67+
}
68+
69+
function PostProcessingMedium() {
70+
return (
71+
<EffectComposer multisampling={4}>
72+
<Bloom
73+
intensity={0.6}
74+
luminanceThreshold={0.2}
75+
luminanceSmoothing={0.9}
76+
mipmapBlur
77+
/>
78+
<Vignette
79+
offset={0.3}
80+
darkness={0.6}
81+
blendFunction={BlendFunction.NORMAL}
82+
/>
83+
</EffectComposer>
84+
);
85+
}
86+
87+
function PostProcessingHigh() {
88+
return (
89+
<EffectComposer multisampling={4}>
6690
<Bloom
6791
intensity={0.8}
6892
luminanceThreshold={0.2}
6993
luminanceSmoothing={0.9}
7094
mipmapBlur
7195
/>
72-
73-
{/* Chromatic aberration for holographic feel */}
74-
{quality !== 'medium' ? (
75-
<ChromaticAberration
76-
blendFunction={BlendFunction.NORMAL}
77-
offset={new Vector2(0.0005, 0.0005)}
78-
radialModulation={false}
79-
modulationOffset={0}
80-
/>
81-
) : null}
82-
83-
{/* Vignette for focus */}
96+
<ChromaticAberration
97+
blendFunction={BlendFunction.NORMAL}
98+
offset={new Vector2(0.0005, 0.0005)}
99+
radialModulation={false}
100+
modulationOffset={0}
101+
/>
84102
<Vignette
85103
offset={0.3}
86104
darkness={0.6}
87105
blendFunction={BlendFunction.NORMAL}
88106
/>
89-
90-
{/* Depth of field - ultra quality only */}
91-
{quality === 'ultra' ? (
92-
<DepthOfField
93-
focusDistance={0.01}
94-
focalLength={0.02}
95-
bokehScale={2}
96-
/>
97-
) : null}
98107
</EffectComposer>
99108
);
100109
}
101110

111+
function PostProcessingUltra() {
112+
return (
113+
<EffectComposer multisampling={8}>
114+
<Bloom
115+
intensity={0.8}
116+
luminanceThreshold={0.2}
117+
luminanceSmoothing={0.9}
118+
mipmapBlur
119+
/>
120+
<ChromaticAberration
121+
blendFunction={BlendFunction.NORMAL}
122+
offset={new Vector2(0.0005, 0.0005)}
123+
radialModulation={false}
124+
modulationOffset={0}
125+
/>
126+
<Vignette
127+
offset={0.3}
128+
darkness={0.6}
129+
blendFunction={BlendFunction.NORMAL}
130+
/>
131+
<DepthOfField
132+
focusDistance={0.01}
133+
focalLength={0.02}
134+
bokehScale={2}
135+
/>
136+
</EffectComposer>
137+
);
138+
}
139+
140+
function PostProcessing() {
141+
const quality = useWorldStore((state) => state.quality);
142+
143+
switch (quality) {
144+
case 'low':
145+
return <PostProcessingLow />;
146+
case 'medium':
147+
return <PostProcessingMedium />;
148+
case 'high':
149+
return <PostProcessingHigh />;
150+
case 'ultra':
151+
return <PostProcessingUltra />;
152+
default:
153+
return <PostProcessingMedium />;
154+
}
155+
}
156+
102157
// ============================================================================
103158
// Scene Content
104159
// ============================================================================

0 commit comments

Comments
 (0)