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

fix(MeshRefractionMaterial): minimize shader bandwidth #1303

Conversation

CodyJasonBennett
Copy link
Member

Fixes #1297 by removing unneeded varyings and inlining expressions where applicable.

@vercel
Copy link

vercel bot commented Feb 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
drei ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 23, 2023 at 5:13AM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 20, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1fbe76a:

Sandbox Source
romantic-currying-0d8ghb Configuration
Ground reflections and video textures Configuration
arc-x-pmndrs-colors Configuration

Copy link
Contributor

@gydence gydence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you again for this quick PR! I left a few suggestions. I had started a branch for this but I'm still getting familiar with react so I never could have done it this quickly, and with a test to boot!

src/materials/MeshRefractionMaterial.tsx Outdated Show resolved Hide resolved
src/materials/MeshRefractionMaterial.tsx Outdated Show resolved Hide resolved
src/materials/MeshRefractionMaterial.tsx Outdated Show resolved Hide resolved
src/materials/MeshRefractionMaterial.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@gydence gydence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from 16 to 6/7 varying slots and way fewer inverses!

#endif

#ifdef USE_INSTANCING
vModelMatrixInverse = inverse(modelMatrix * vInstanceMatrix);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some additional savings you could pass in inverse(modelMatrix) as a uniform too 😄

@CodyJasonBennett CodyJasonBennett merged commit d719bb5 into pmndrs:master Feb 23, 2023
@CodyJasonBennett CodyJasonBennett deleted the fix/refractionmaterial-bandwidth branch February 23, 2023 05:23
@github-actions
Copy link

🎉 This PR is included in version 9.56.26 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Reduce varying count in MeshRefractionMaterial
2 participants