diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index daed9210..72deebef 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -61,6 +61,7 @@ export default defineConfig({ { text: 'Hue & Saturation', link: '/guide/pmndrs/hue-saturation' }, { text: 'Lens Distortion', link: '/guide/pmndrs/lens-distortion' }, { text: 'Grid', link: '/guide/pmndrs/grid' }, + { text: 'Texture', link: '/guide/pmndrs/texture' }, { text: 'ASCII', link: '/guide/pmndrs/ascii' }, { text: 'FXAA', link: '/guide/pmndrs/fxaa' }, { text: 'SMAA', link: '/guide/pmndrs/smaa' }, diff --git a/docs/.vitepress/theme/components/pmdrs/TextureDemo.vue b/docs/.vitepress/theme/components/pmdrs/TextureDemo.vue new file mode 100644 index 00000000..bdaf5a3a --- /dev/null +++ b/docs/.vitepress/theme/components/pmdrs/TextureDemo.vue @@ -0,0 +1,121 @@ + + + diff --git a/docs/components.d.ts b/docs/components.d.ts index 4f521f37..29cb3605 100644 --- a/docs/components.d.ts +++ b/docs/components.d.ts @@ -43,6 +43,7 @@ declare module 'vue' { ShockWaveDemo: typeof import('./.vitepress/theme/components/pmdrs/ShockWaveDemo.vue')['default'] SMAADemo: typeof import('./.vitepress/theme/components/pmdrs/SMAADemo.vue')['default'] SMAAThreeDemo: typeof import('./.vitepress/theme/components/three/SMAAThreeDemo.vue')['default'] + TextureDemo: typeof import('./.vitepress/theme/components/pmdrs/TextureDemo.vue')['default'] TiltShiftDemo: typeof import('./.vitepress/theme/components/pmdrs/TiltShiftDemo.vue')['default'] ToneMappingDemo: typeof import('./.vitepress/theme/components/pmdrs/ToneMappingDemo.vue')['default'] UnrealBloomThreeDemo: typeof import('./.vitepress/theme/components/three/UnrealBloomThreeDemo.vue')['default'] diff --git a/docs/guide/pmndrs/texture.md b/docs/guide/pmndrs/texture.md new file mode 100644 index 00000000..5172c98f --- /dev/null +++ b/docs/guide/pmndrs/texture.md @@ -0,0 +1,85 @@ +# Texture + + + + + +
+ Demo code + + <<< @/.vitepress/theme/components/pmdrs/TextureDemo.vue{0} +
+ +The `TextureEffect` component is part of the [`postprocessing`](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/TextureEffect.js~TextureEffect.html) package. +It allows rendering a texture with customizable options to create various visual effects. + +## Usage + +The `` component is easy to use and provides customizable options to suit different visual styles. + +:::info +This component is designed to work with a provided texture and **does not** include built-in functionality to modify the texture itself.

+If you need to adjust properties such as **rotation**, **repeat**, or **other attributes**, you should modify them directly the texture *(See usage example below)* that you pass to the `` component. +::: + +```vue{2,16-20,41-45} + + + +``` + +## Props + +| Prop | Description | Default | +| ------------- | ----------------------------------------------------------------------------------------------- | --------------------------- | +| blendFunction | Defines how the effect blends with the original scene. See the [`BlendFunction`](https://pmndrs.github.io/postprocessing/public/docs/variable/index.html#static-variable-BlendFunction) options. | `BlendFunction.NORMAL` | +| texture | The texture used for the effect. See the [`Texture`](https://threejs.org/docs/#api/en/textures/Texture) documentation | `null` | +| opacity | The opacity of the texture. | `1.0` | + +## Further Reading + +For more details, see the [TextureEffect documentation](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/TextureEffect.js~TextureEffect.html). diff --git a/playground/src/pages/postprocessing/texture.vue b/playground/src/pages/postprocessing/texture.vue new file mode 100644 index 00000000..f53ec165 --- /dev/null +++ b/playground/src/pages/postprocessing/texture.vue @@ -0,0 +1,102 @@ + + + diff --git a/playground/src/router.ts b/playground/src/router.ts index 696e1e76..4fb9e614 100644 --- a/playground/src/router.ts +++ b/playground/src/router.ts @@ -52,6 +52,7 @@ export const postProcessingRoutes = [ makeRoute('Scanline', '📽️', false), makeRoute('Color Depth', '🔳', false), makeRoute('Grid', '#️⃣', false), + makeRoute('Texture', '🧩', false), makeRoute('ASCII', '🔡', false), makeRoute('SMAA', '📐', false), makeRoute('FXAA', '📐', false), diff --git a/src/core/pmndrs/TexturePmndrs.vue b/src/core/pmndrs/TexturePmndrs.vue new file mode 100644 index 00000000..4a3aa614 --- /dev/null +++ b/src/core/pmndrs/TexturePmndrs.vue @@ -0,0 +1,57 @@ + diff --git a/src/core/pmndrs/index.ts b/src/core/pmndrs/index.ts index 0ad9e9f3..99ff091a 100644 --- a/src/core/pmndrs/index.ts +++ b/src/core/pmndrs/index.ts @@ -30,6 +30,7 @@ import FishEyePmndrs, { type FishEyePmndrsProps } from './FishEyePmndrs.vue' import BrightnessContrastPmndrs, { type BrightnessContrastPmndrsProps } from './BrightnessContrastPmndrs.vue' import SMAAPmndrs, { type SMAAPmndrsProps } from './SMAAPmndrs.vue' import FXAAPmndrs, { type FXAAPmndrsProps } from './FXAAPmndrs.vue' +import TexturePmndrs, { type TexturePmndrsProps } from './TexturePmndrs.vue' import ASCIIPmndrs, { type ASCIIPmndrsProps } from './ASCIIPmndrs.vue' export { @@ -63,6 +64,7 @@ export { BrightnessContrastPmndrs, SMAAPmndrs, FXAAPmndrs, + TexturePmndrs, ASCIIPmndrs, BloomPmndrsProps, DepthOfFieldPmndrsProps, @@ -93,5 +95,6 @@ export { BrightnessContrastPmndrsProps, SMAAPmndrsProps, FXAAPmndrsProps, + TexturePmndrsProps, ASCIIPmndrsProps, }