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

CodeSandbox using react-three-fiber with shader-park #14

Open
moonraker22 opened this issue Mar 4, 2023 · 1 comment
Open

CodeSandbox using react-three-fiber with shader-park #14

moonraker22 opened this issue Mar 4, 2023 · 1 comment

Comments

@moonraker22
Copy link

I made a quick sandbox using r3f with shader-park. Not sure of the performance of using it like this but it works. If anyone knows any better ways please reply. Thanks 🙏🏼

Code Sandbox

@torinmb
Copy link
Member

torinmb commented Mar 4, 2023

Hey this is great! Thanks for sharing this. To speed up the performance in the shader park code you'll want to use setStepSize() and try and get it as close to .999 without changing the look of your piece. You'll also want to use setMaxIterations() and try to set it as close to 1 as possible. This will dramatically improve the performance. https://codesandbox.io/s/shader-park-r3f-forked-wpxn7f

I worked on making a DRI plugin, but it's not finished yet. My approach was to extend the ShaderMaterial, and make a ShaderParkMaterial, so you can just wrap any geometry around it in the HTML like this:

    <Sphere args={[1, 34, 34]} >
      <shaderParkMaterial ref={ref} />
    </Sphere>

Still not sure how to easily handle uniforms in this approach.
Here's my scrappy example: https://codesandbox.io/s/shader-park-r3f-u4r5hs?file=/shader-park-material.tsx:2332-2417
I like that in your approach you can still take advantage of createSculpture and the simplified uniform updates.

Also @CodinSegal has been working on a typescript r3f example as well w/ Next.js that might be helpful.

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

No branches or pull requests

2 participants