Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need help, How can we pass custom effect? #86

Open
pilishen opened this issue Nov 28, 2023 · 4 comments
Open

need help, How can we pass custom effect? #86

pilishen opened this issue Nov 28, 2023 · 4 comments
Assignees

Comments

@pilishen
Copy link

pilishen commented Nov 28, 2023

thanks for this great package, it's so elagant, really appreciate

I'm having difficulty in passing custom shader effect into the EffectComposer, is it possible currently?

<Suspense>
       <EffectComposer ref="composer">
            <Bloom   />
       </EffectComposer>
</Suspense>

Suppose besides Bloom Effect, i still want to pass another shader effect, how could i achieve that?

import { ShaderPass } from 'postprocessing';
import Shader from './shader.js

<script setup>
    const shaderEffect = new ShaderPass(Shader)
    const composer  = ref()

   onMounted(()=>{
        if (composer.value) {
            composer.value.addPass(shaderEffect)
            composer.value.render()
          }
    })
</script>

That's my first attempt, but it didn't work, any help? thanks

@alvarosabu alvarosabu self-assigned this Nov 28, 2023
@alvarosabu
Copy link
Member

@pilishen I will try to prepare an example to show how you would approach Custom Shaders and most probably add docs about it. Thanks for raising this question.

@pilishen
Copy link
Author

@pilishen I will try to prepare an example to show how you would approach Custom Shaders and most probably add docs about it. Thanks for raising this question.

glad to hear that, thanks, you're awesome~ @alvarosabu

@alvarosabu alvarosabu assigned Tinoooo and unassigned alvarosabu Dec 18, 2023
@AntoninRousset
Copy link
Contributor

To make it easy to add custom effects, could you export useEffect composable?
As in #105.

@Tinoooo
Copy link
Contributor

Tinoooo commented Apr 4, 2024

useEffect is now exposed. So passing custom effects should work by creating an own component that uses the composable. The Pixelation component should be a good reference. @pilishen Let me know if this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants