diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 09bd028f..8791f06f 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -48,22 +48,23 @@ export default defineConfig({ { text: 'Pmndrs', items: [ + { text: 'Barrel blur', link: '/guide/pmndrs/barrel-blur' }, { text: 'Bloom', link: '/guide/pmndrs/bloom' }, + { text: 'Chromatic Aberration', link: '/guide/pmndrs/chromatic-aberration' }, { text: 'Depth of Field', link: '/guide/pmndrs/depth-of-field' }, + { text: 'Dot Screen', link: '/guide/pmndrs/dot-screen' }, { text: 'Glitch', link: '/guide/pmndrs/glitch' }, + { text: 'Hue & Saturation', link: '/guide/pmndrs/hue-saturation' }, + { text: 'Lens Distortion', link: '/guide/pmndrs/lens-distortion' }, { text: 'Noise', link: '/guide/pmndrs/noise' }, { text: 'Outline', link: '/guide/pmndrs/outline' }, - { text: 'Tone Mapping', link: '/guide/pmndrs/tone-mapping' }, - { text: 'Chromatic Aberration', link: '/guide/pmndrs/chromatic-aberration' }, - { text: 'Sepia', link: '/guide/pmndrs/sepia' }, + { text: 'Pixelation', link: '/guide/pmndrs/pixelation' }, { text: 'Scanline', link: '/guide/pmndrs/scanline' }, + { text: 'Sepia', link: '/guide/pmndrs/sepia' }, { text: 'Shock Wave', link: '/guide/pmndrs/shock-wave' }, - { text: 'Pixelation', link: '/guide/pmndrs/pixelation' }, - { text: 'Vignette', link: '/guide/pmndrs/vignette' }, - { text: 'Barrel blur', link: '/guide/pmndrs/barrel-blur' }, - { text: 'Hue & Saturation', link: '/guide/pmndrs/hue-saturation' }, { text: 'Tilt Shift', link: '/guide/pmndrs/tilt-shift' }, - { text: 'Dot Screen', link: '/guide/pmndrs/dot-screen' }, + { text: 'Tone Mapping', link: '/guide/pmndrs/tone-mapping' }, + { text: 'Vignette', link: '/guide/pmndrs/vignette' }, ], }, { diff --git a/docs/.vitepress/theme/components/pmdrs/LensDistortionDemo.vue b/docs/.vitepress/theme/components/pmdrs/LensDistortionDemo.vue new file mode 100644 index 00000000..c8210fbc --- /dev/null +++ b/docs/.vitepress/theme/components/pmdrs/LensDistortionDemo.vue @@ -0,0 +1,68 @@ + + + diff --git a/docs/components.d.ts b/docs/components.d.ts index 2bb9120c..97053511 100644 --- a/docs/components.d.ts +++ b/docs/components.d.ts @@ -20,6 +20,7 @@ declare module 'vue' { HalftoneThreeDemo: typeof import('./.vitepress/theme/components/three/HalftoneThreeDemo.vue')['default'] HueSaturation: typeof import('./.vitepress/theme/components/pmdrs/HueSaturationDemo.vue')['default'] HueSaturationDemo: typeof import('./.vitepress/theme/components/pmdrs/HueSaturationDemo.vue')['default'] + LensDistortionDemo: typeof import('./.vitepress/theme/components/pmdrs/LensDistortionDemo.vue')['default'] LoveVueThreeJS: typeof import('./.vitepress/theme/components/LoveVueThreeJS.vue')['default'] NoiseDemo: typeof import('./.vitepress/theme/components/pmdrs/NoiseDemo.vue')['default'] OutlineDemo: typeof import('./.vitepress/theme/components/pmdrs/OutlineDemo.vue')['default'] diff --git a/docs/guide/pmndrs/lens-distortion.md b/docs/guide/pmndrs/lens-distortion.md new file mode 100644 index 00000000..20ba9699 --- /dev/null +++ b/docs/guide/pmndrs/lens-distortion.md @@ -0,0 +1,85 @@ +# Lens Distortion + + + + + +The `LensDistortion` effect is part of the [`postprocessing`](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/LensDistortionEffect.js~LensDistortionEffect.html) package. It allows you to apply a lens distortion effect to your scene, providing flexibility for creating realistic camera effects. + +## Usage + +The `` component is straightforward to use and provides customizable options to fine-tune the distortion effect of your visuals. + +```vue{3,12-17,52-56} + + + +``` + +## Props + +| Prop | Description | Default | +| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| **distortion** | The distortion effect strength.
Accepts `Vector2` or `[number, number]`. | `[0.0, 0.0]` | +| **principalPoint** | The center point.
Accepts `Vector2` or `[number, number]`. | `[0.0, 0.0]` | +| **focalLength** | The focal length.
Accepts `Vector2` or `[number, number]`. | `[1.0, 1.0]` | +| **skew** | The skew value. | `0` | + +## Further Reading + +For more details, see the [LensDistortion documentation](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/LensDistortionEffect.js~LensDistortionEffect.html). diff --git a/docs/public/lens-distortion/room-map.png b/docs/public/lens-distortion/room-map.png new file mode 100644 index 00000000..53604bfb Binary files /dev/null and b/docs/public/lens-distortion/room-map.png differ diff --git a/docs/public/lens-distortion/room-normal.png b/docs/public/lens-distortion/room-normal.png new file mode 100644 index 00000000..279c5019 Binary files /dev/null and b/docs/public/lens-distortion/room-normal.png differ diff --git a/playground/src/pages/postprocessing/lens-distortion.vue b/playground/src/pages/postprocessing/lens-distortion.vue new file mode 100644 index 00000000..b87d33fd --- /dev/null +++ b/playground/src/pages/postprocessing/lens-distortion.vue @@ -0,0 +1,54 @@ + + + diff --git a/playground/src/router.ts b/playground/src/router.ts index a8190415..919cee17 100644 --- a/playground/src/router.ts +++ b/playground/src/router.ts @@ -43,6 +43,7 @@ export const postProcessingRoutes = [ makeRoute('Bloom', '🌼', false), makeRoute('Noise', '📟', false), makeRoute('Chromatic Aberration', '🌈', false), + makeRoute('Lens Distortion', '🔍', false), makeRoute('Sepia', '🌅', false), makeRoute('Scanline', '📺', false), makeRoute('Shock Wave', '🌊', false), diff --git a/src/core/pmndrs/LensDistortionPmndrs.vue b/src/core/pmndrs/LensDistortionPmndrs.vue new file mode 100644 index 00000000..9f81a245 --- /dev/null +++ b/src/core/pmndrs/LensDistortionPmndrs.vue @@ -0,0 +1,48 @@ + diff --git a/src/core/pmndrs/index.ts b/src/core/pmndrs/index.ts index 1fa0bb61..dce515f1 100644 --- a/src/core/pmndrs/index.ts +++ b/src/core/pmndrs/index.ts @@ -14,6 +14,7 @@ import ToneMappingPmndrs, { type ToneMappingPmndrsProps } from './ToneMappingPmn import ChromaticAberrationPmndrs, { type ChromaticAberrationPmndrsProps } from './ChromaticAberrationPmndrs.vue' import HueSaturationPmndrs, { type HueSaturationPmndrsProps } from './HueSaturationPmndrs.vue' import ScanlinePmndrs, { type ScanlinePmndrsProps } from './ScanlinePmndrs.vue' +import LensDistortionPmndrs, { type LensDistortionPmndrsProps } from './LensDistortionPmndrs.vue' import ShockWavePmndrs, { type ShockWavePmndrsProps } from './ShockWavePmndrs.vue' import DepthPickingPassPmndrs, { type DepthPickingPassPmndrsProps } from './DepthPickingPassPmndrs.vue' import TiltShiftPmndrs, { type TiltShiftPmndrsProps } from './TiltShiftPmndrs.vue' @@ -37,6 +38,7 @@ export { ChromaticAberrationPmndrs, HueSaturationPmndrs, ScanlinePmndrs, + LensDistortionPmndrs, ShockWavePmndrs, DepthPickingPassPmndrs, TiltShiftPmndrs, @@ -56,6 +58,7 @@ export { ChromaticAberrationPmndrsProps, HueSaturationPmndrsProps, ScanlinePmndrsProps, + LensDistortionPmndrsProps, ShockWavePmndrsProps, DepthPickingPassPmndrsProps, TiltShiftPmndrsProps,