Billboards
hypersurge opened this issue · comments
I'm attemping to create a "billboard" style sprite, that scales with perspective but always faces the camera, irrespective of rotation or alignment. Easy enough to achieve with an orthographic view, but perspective is more complex.
I see sprite3d.proj.affine = AFFINE.POINT achieves all except scaling. Any quick suggestion please?
so, we do have scaling but it breaks rotation?
AXIS_X and AXIS_Y dont work in your case, right?
If you have an idea, add it here: https://github.com/pixijs/pixi-projection/blob/master/src/proj3d/Matrix3d.ts#L428
or in 2d case, same place but in Matrix2d.
I can help if you give me a demo or at least a drawing how our 3 modes work and which 4 you want to add. Imagine there's local coord isystem in some point, and how do you want to modify it to make billboards?
Thanks @ivanpopelyshev, yes neither AXIS_X or AXIS_Y appear to work for this case, nor did assigning the rotation transform equal to the camera's (due to spherical camera space?).
Based on your reference I did determine the required matrix and can make a PR, but first I wanted to ask what should be the appropriate AFFINE enum naming. e.g. BILLBOARD?
The succinct description of a billboard sprite is "a surface that moves and scales in 3D space while remaining perfectly aligned to the Camera plane". For 2D it would work the same as the existing POINT implementation. A typical use case might be a low LOD pre-rendered version in the distance, a pre-rendered explosion or halo, or in-situ gui. An example to demonstrate the desired output:
https://youtu.be/V_7EEzOCDB0?t=62
Thanks!