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

Usage with InstancedMesh #2

Open
fluxxus opened this issue Apr 7, 2024 · 2 comments
Open

Usage with InstancedMesh #2

fluxxus opened this issue Apr 7, 2024 · 2 comments

Comments

@fluxxus
Copy link

fluxxus commented Apr 7, 2024

Hey,

please correct me if I am wrong, but it seems that your material is not working with InstancedMesh. Basically the positioning doesn't have any effect.

I've found this reddit thread , while not directly tied to your material the suggestion is to use this gl_Position = projectionMatrix * viewMatrix * modelMatrix * instanceMatrix * vec4(position, 1.0).

Which I did and swapped the gl_Position line in your shader code with the above and it worked.

Is this the right approach if using InstancedMesh?

@ektogamat
Copy link
Owner

Hey. Thank you very much for your feedback. This is awesome. If you can, just send me a PR and I can merge it okay? I tested with animated meshes but not with instanced meshes so your approach is probably right!

Thanks again and sorry for the delay 😊

@fluxxus
Copy link
Author

fluxxus commented Apr 10, 2024

No problem, glad that I could help. I'll submit PR tomorrow if it is ok with you, I am away from the computer right now.

P.S.
How would you check if InstancedMesh is used? I haven't tried, but I guess that the above line won't work for regular meshes. This is just my guess, I am far from expert.

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