Skip to content

Commit cab6732

Browse files
committed
Added Tilt Shift effect controls to SceneComponent
- Integrated Tilt Shift effect with adjustable parameters including blur, taper, and sample settings. - Updated rendering pipeline to include TiltShift2 component for enhanced visual effects. - Maintained existing scene controls while expanding customization options for users.
1 parent 53a80c2 commit cab6732

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

apps/web2/src/SceneComponent.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EffectComposer, ToneMapping } from '@react-three/postprocessing';
1+
import { EffectComposer, ToneMapping, TiltShift2 } from '@react-three/postprocessing';
22
import { useFrame, useThree } from '@react-three/fiber';
33
import { useRef, useEffect } from 'react';
44
import * as THREE from 'three';
@@ -190,6 +190,27 @@ export default function SceneComponent() {
190190
adaptationRate: { value: 1, min: 0, max: 100, step: 0.01 },
191191
});
192192

193+
// Tilt Shift Controls
194+
const {
195+
tiltShiftEnabled,
196+
blur,
197+
taper,
198+
startX,
199+
startY,
200+
endX,
201+
endY,
202+
samples,
203+
} = useControls('Scene - Tilt Shift', {
204+
tiltShiftEnabled: false,
205+
blur: { value: 0.5, min: 0, max: 2, step: 0.01 },
206+
taper: { value: 1.5, min: 0, max: 2, step: 0.01 },
207+
startX: { value: 0.0, min: 0, max: 1, step: 0.01 },
208+
startY: { value: 0.3, min: 0, max: 1, step: 0.01 },
209+
endX: { value: 1.0, min: 0, max: 1, step: 0.01 },
210+
endY: { value: 0.7, min: 0, max: 1, step: 0.01 },
211+
samples: { value: 5, min: 1, max: 20, step: 1 },
212+
});
213+
193214
// Sky & Atmosphere Controls
194215
const { turbidity, rayleigh, mieCoefficient, mieDirectionalG } = useControls(
195216
'Scene - Sky & Atmosphere',
@@ -282,6 +303,13 @@ export default function SceneComponent() {
282303
averageLuminance={averageLuminance}
283304
adaptationRate={adaptationRate}
284305
/>
306+
<TiltShift2
307+
blur={tiltShiftEnabled ? blur : 0}
308+
taper={tiltShiftEnabled ? taper : 0}
309+
start={[startX, startY]}
310+
end={[endX, endY]}
311+
samples={samples}
312+
/>
285313
</EffectComposer>
286314
<Tiles3D url={`${import.meta.env.VITE_TILES_URL}/tileset.json`} />
287315
<CloudsComponent />

0 commit comments

Comments
 (0)