-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3755b76
commit 9f29687
Showing
4 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<script lang="ts" setup> | ||
import { OrbitControls } from '@tresjs/cientos' | ||
import { TresCanvas } from '@tresjs/core' | ||
import { EffectComposer, SMAA } from '@tresjs/post-processing/three' | ||
import { useRouteDisposal } from '../../composables/useRouteDisposal' | ||
// Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components | ||
const { effectComposer } = useRouteDisposal() | ||
</script> | ||
|
||
<template> | ||
<TresCanvas | ||
:alpha="false" | ||
:shadows="true" | ||
> | ||
<TresPerspectiveCamera | ||
:position="[3, 2, 4]" | ||
:look-at="[0, 0, 0]" | ||
/> | ||
<OrbitControls /> | ||
<TresMesh | ||
:position="[1, 0.5, 1]" | ||
> | ||
<TresBoxGeometry /> | ||
<TresMeshNormalMaterial | ||
wireframe | ||
/> | ||
</TresMesh> | ||
<TresMesh | ||
:position="[-1.5, 0.75, 0]" | ||
> | ||
<TresConeGeometry :args="[1, 1.5, 4, 1, false, Math.PI * 0.25]" /> | ||
<TresMeshNormalMaterial /> | ||
<TresMeshNormalMaterial | ||
wireframe | ||
/> | ||
</TresMesh> | ||
|
||
<TresGridHelper /> | ||
<TresAmbientLight :intensity="0.9" /> | ||
<TresDirectionalLight | ||
:position="[-10, 5, 8]" | ||
:intensity="1" | ||
/> | ||
|
||
<Suspense> | ||
<EffectComposer ref="effectComposer"> | ||
<SMAA /> | ||
</EffectComposer> | ||
</Suspense> | ||
</TresCanvas> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SMAA | ||
|
||
<DocsDemo> | ||
<SMAAThreeDemo /> | ||
</DocsDemo> | ||
|
||
SMAA (Subpixel Morphological Antialiasing) is an antialiasing technique that aims to reduce the visual defects that occur when high-frequency detail is displayed on a lower-resolution screen. This effect can be used to smooth out jagged edges in your 3D scenes. | ||
|
||
## Usage | ||
|
||
```vue | ||
<script setup lang="ts"> | ||
import { EffectComposer, SMAA } from '@tresjs/post-processing/three' | ||
</script> | ||
<template> | ||
<EffectComposer> | ||
<SMAA :width="1024" :height="768" /> | ||
<Output /> | ||
</EffectComposer> | ||
</template> | ||
``` | ||
|
||
## Props | ||
|
||
| Prop | Description | Default | | ||
|---------|---------------------------------------------------------------------------------------------------|---------------------------------| | ||
| `width` | The width of the render target. If not provided, it defaults to the width of the renderer. | | | ||
| `height`| The height of the render target. If not provided, it defaults to the height of the renderer. | | |