-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
e15c060
commit 70b86ad
Showing
14 changed files
with
206 additions
and
14 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,11 @@ | ||
<script setup lang="ts"> | ||
import { useGLTF } from '@tresjs/cientos' | ||
const { nodes } | ||
= await useGLTF('https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/blender-cube.glb', { draco: true }) | ||
const model = nodes.Cube | ||
</script> | ||
|
||
<template> | ||
<primitive :object="model" /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script setup lang="ts"> | ||
import { TresCanvas } from '@tresjs/core' | ||
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three' | ||
import { OrbitControls } from '@tresjs/cientos' | ||
import { EffectComposer, Vignette, DepthOfField } from '@tresjs/post-processing' | ||
import BlenderCube from './BlenderCube.vue' | ||
const gl = { | ||
clearColor: '#4f4f4f', | ||
shadows: true, | ||
alpha: false, | ||
shadowMapType: BasicShadowMap, | ||
outputColorSpace: SRGBColorSpace, | ||
toneMapping: NoToneMapping, | ||
} | ||
</script> | ||
|
||
<template> | ||
<TresLeches /> | ||
<TresCanvas v-bind="gl"> | ||
<TresPerspectiveCamera :position="[3, 3, 3]" /> | ||
<OrbitControls /> | ||
<Suspense> | ||
<BlenderCube /> | ||
</Suspense> | ||
<EffectComposer> | ||
<DepthOfField | ||
:focus-distance="0" | ||
:focal-length="0.02" | ||
:bokeh-scale="2" | ||
/> | ||
<Vignette | ||
:darkness="0.9" | ||
:offset="0.3" | ||
/> | ||
</EffectComposer> | ||
<TresAmbientLight :intensity="1" /> | ||
</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,37 @@ | ||
# Vignette | ||
|
||
<DocsDemo> | ||
<VignetteDemo /> | ||
</DocsDemo> | ||
|
||
Vignette is an effect that darkens the edges of the scene to make the center pop. | ||
|
||
## Usage | ||
|
||
```vue | ||
<script setup lang="ts"> | ||
import { EffectComposer, Vignette } from '@tresjs/post-processing' | ||
</script> | ||
<template> | ||
<EffectComposer> | ||
<Vignette | ||
:darkness="0.9" | ||
:offset="0.2" | ||
/> | ||
</EffectComposer> | ||
</template> | ||
``` | ||
|
||
## Props | ||
|
||
| Prop | Description | Default | | ||
| ------------- | ----------------------------------------------------------- | -------------------------- | | ||
| technique | Whether the noise should be multiplied with the input color. | VignetteTechnique.DEFAULT | | ||
| blendFunction | The blend function to use. | BlendFunction.NORMAL | | ||
| offset | The offset value. | 0.5 | | ||
| darkness | The darkness value. | 0.5 | | ||
|
||
|
||
## Further Reading | ||
see [postprocessing docs](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/VignetteEffect.js~VignetteEffect.html) |
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
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,11 @@ | ||
<script setup lang="ts"> | ||
import { useGLTF } from '@tresjs/cientos' | ||
const { nodes } | ||
= await useGLTF('https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/blender-cube.glb', { draco: true }) | ||
const model = nodes.Cube | ||
</script> | ||
|
||
<template> | ||
<primitive :object="model" /> | ||
</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,56 @@ | ||
<script setup lang="ts"> | ||
import { TresCanvas } from '@tresjs/core' | ||
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three' | ||
import { OrbitControls } from '@tresjs/cientos' | ||
import { EffectComposer, Vignette, DepthOfField } from '@tresjs/post-processing' | ||
import { TresLeches, useControls } from '@tresjs/leches' | ||
import BlenderCube from '../components/BlenderCube.vue' | ||
import '@tresjs/leches/styles' | ||
const gl = { | ||
clearColor: '#4f4f4f', | ||
shadows: true, | ||
alpha: false, | ||
shadowMapType: BasicShadowMap, | ||
outputColorSpace: SRGBColorSpace, | ||
toneMapping: NoToneMapping, | ||
} | ||
const { darkness, offset } = useControls({ | ||
offset: { | ||
value: 0.3, | ||
min: 0, | ||
max: 1, | ||
step: 0.01, | ||
}, | ||
darkness: { | ||
value: 0.9, | ||
min: 0, | ||
max: 1, | ||
step: 0.01, | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<TresLeches /> | ||
<TresCanvas v-bind="gl"> | ||
<TresPerspectiveCamera :position="[3, 3, 3]" /> | ||
<OrbitControls /> | ||
<Suspense> | ||
<BlenderCube /> | ||
</Suspense> | ||
<EffectComposer> | ||
<DepthOfField | ||
:focus-distance="0" | ||
:focal-length="0.02" | ||
:bokeh-scale="2" | ||
/> | ||
<Vignette | ||
:darkness="darkness.value" | ||
:offset="offset.value" | ||
/> | ||
</EffectComposer> | ||
<TresAmbientLight :intensity="1" /> | ||
</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,34 @@ | ||
<script lang="ts" setup> | ||
import { BlendFunction, VignetteEffect, VignetteTechnique } from 'postprocessing' | ||
import { useEffect } from '../composables/effect' | ||
import { makePropWatchersUsingAllProps } from '../../util/prop' | ||
import { omit } from '../../util/object' | ||
export interface VignetteProps { | ||
/** | ||
* Whether the noise should be multiplied with the input color. | ||
*/ | ||
technique?: VignetteTechnique | ||
blendFunction?: BlendFunction | ||
offset: number | ||
darkness: number | ||
} | ||
const props = withDefaults(defineProps<VignetteProps>(), { | ||
technique: VignetteTechnique.DEFAULT, | ||
blendFunction: BlendFunction.NORMAL, | ||
offset: 0.5, | ||
darkness: 0.5, | ||
}) | ||
const { pass, effect } = useEffect(() => new VignetteEffect(props)) | ||
defineExpose({ pass, effect }) // to allow users to modify pass and effect via template ref | ||
makePropWatchersUsingAllProps( | ||
omit(props, ['blendFunction']), | ||
effect, | ||
() => new VignetteEffect(), | ||
) | ||
</script> | ||
|
||
<template></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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import Bloom from './core/effects/Bloom.vue' | ||
import DepthOfField from './core/effects/DepthOfField.vue' | ||
import EffectComposer from './core/EffectComposer.vue' | ||
import Glitch from './core/effects/Glitch.vue' | ||
import Outline from './core/effects/Outline.vue' | ||
import Pixelation from './core/effects/Pixelation.vue' | ||
import DepthOfField from './core/effects/DepthOfField.vue' | ||
|
||
import EffectComposer from './core/EffectComposer.vue' | ||
import Vignette from './core/effects/Vignette.vue' | ||
|
||
export { | ||
Bloom, | ||
DepthOfField, | ||
EffectComposer, | ||
Glitch, | ||
Outline, | ||
Pixelation, | ||
DepthOfField, | ||
EffectComposer, | ||
Vignette, | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.