Sprite Material support
See original GitHub issueImagine a RPG style game where each player has a nameplate. For example ( https://i.imgur.com/KxgTpuu.jpg ).
Working with MeshBasicMaterial
or MeshPhongMaterial
we would need to use an onBeforeRender handler that adjusts the whole group's world matrix based on camera frustum on each frame
as you’ve suggested here.
A Sprite Material has these optimizations baked in to handle this exact scenario. It feels like following your suggestion will lead to rolling our own Sprite Material, which is likely going to have much worse performance and usability than Three’s.
It will also really complicate solutions. Imagine all the other use cases in the scene that need a Sprite’s behavior but belong to different object groups with different object hierarchy’s. There would never be a one size fits all in the same way a Three’s Sprite behaves.
Would really appreciate support for Sprite Material as it would both improve performance of our implementation along with developer usability of your library.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top GitHub Comments
I’ve updated the CodeSandbox example to the latest libraries.
Here’s an example in action, using createDerivedMaterial from troika-three-utils. You should be able to use that directly. https://codesandbox.io/s/createbillboardmaterial-xl6mt?file=/src/createBillboardMaterial.js
I do think I’ll formalize this, with some fixes to normals so lighting works as expected. It’s a very flexible approach – any material can be used as the base, and it can be applied to any mesh.
Keep in mind though that it does have drawbacks, like not being raycastable.