|
1 | | -import { EffectComposer, ToneMapping } from '@react-three/postprocessing'; |
| 1 | +import { EffectComposer, ToneMapping, TiltShift2 } from '@react-three/postprocessing'; |
2 | 2 | import { useFrame, useThree } from '@react-three/fiber'; |
3 | 3 | import { useRef, useEffect } from 'react'; |
4 | 4 | import * as THREE from 'three'; |
@@ -190,6 +190,27 @@ export default function SceneComponent() { |
190 | 190 | adaptationRate: { value: 1, min: 0, max: 100, step: 0.01 }, |
191 | 191 | }); |
192 | 192 |
|
| 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 | + |
193 | 214 | // Sky & Atmosphere Controls |
194 | 215 | const { turbidity, rayleigh, mieCoefficient, mieDirectionalG } = useControls( |
195 | 216 | 'Scene - Sky & Atmosphere', |
@@ -282,6 +303,13 @@ export default function SceneComponent() { |
282 | 303 | averageLuminance={averageLuminance} |
283 | 304 | adaptationRate={adaptationRate} |
284 | 305 | /> |
| 306 | + <TiltShift2 |
| 307 | + blur={tiltShiftEnabled ? blur : 0} |
| 308 | + taper={tiltShiftEnabled ? taper : 0} |
| 309 | + start={[startX, startY]} |
| 310 | + end={[endX, endY]} |
| 311 | + samples={samples} |
| 312 | + /> |
285 | 313 | </EffectComposer> |
286 | 314 | <Tiles3D url={`${import.meta.env.VITE_TILES_URL}/tileset.json`} /> |
287 | 315 | <CloudsComponent /> |
|
0 commit comments