-
-
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
9f29687
commit 1250852
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
docs/.vitepress/theme/components/three/UnrealBloomThreeDemo.vue
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,52 @@ | ||
<script setup lang="ts"> | ||
import { TresCanvas } from '@tresjs/core' | ||
import { EffectComposer, UnrealBloom } from '@tresjs/post-processing/three' | ||
import { Color } from 'three' | ||
import { reactive } from 'vue' | ||
import { useRouteDisposal } from '../../composables/useRouteDisposal' | ||
const gl = { | ||
clearColor: '#121212', | ||
shadows: true, | ||
alpha: false, | ||
} | ||
const bloomParams = reactive({ | ||
radius: 0.5, | ||
strength: 0.9, | ||
threshold: 0.5, | ||
}) | ||
// Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components | ||
const { effectComposer } = useRouteDisposal() | ||
</script> | ||
|
||
<template> | ||
<TresCanvas v-bind="gl"> | ||
<TresPerspectiveCamera | ||
:position="[5, 5, 5]" | ||
:look-at="[0, 0, 0]" | ||
/> | ||
<TresMesh> | ||
<TresSphereGeometry :args="[2, 32, 32]" /> | ||
<TresMeshStandardMaterial | ||
color="hotpink" | ||
:emissive="new Color('hotpink')" | ||
:emissive-intensity="1.2" | ||
/> | ||
</TresMesh> | ||
<TresGridHelper /> | ||
|
||
<TresAmbientLight :intensity="2" /> | ||
<TresDirectionalLight | ||
:position="[3, 3, 3]" | ||
:intensity="1" | ||
/> | ||
<Suspense> | ||
<EffectComposer ref="effectComposer"> | ||
<UnrealBloom v-bind="bloomParams" /> | ||
</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 @@ | ||
# Unreal Bloom | ||
|
||
<DocsDemo> | ||
<UnrealBloomThreeDemo /> | ||
</DocsDemo> | ||
|
||
Unreal Bloom is an effect that simulates the bloom effect seen in many modern video games. It creates a glow around bright areas of the scene, giving it a more vibrant and dynamic look. | ||
|
||
## Usage | ||
|
||
```vue | ||
<script setup lang="ts"> | ||
import { EffectComposer, UnrealBloom } from '@tresjs/post-processing/three' | ||
</script> | ||
<template> | ||
<EffectComposer> | ||
<UnrealBloom :radius="0.5" :strength="1.5" :threshold="0.8" /> | ||
</EffectComposer> | ||
</template> | ||
``` | ||
|
||
## Props | ||
|
||
| Prop | Description | Default | | ||
|------------|---------------------------------------------------------------------------------------------------|---------| | ||
| `radius` | The radius of the bloom effect. | `0` | | ||
| `strength` | The strength of the bloom effect. | `1` | | ||
| `threshold`| The threshold luminance for the bloom effect. | `0` | |