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

Billboards #75

Open
hypersurge opened this issue Jun 7, 2020 · 2 comments
Open

Billboards #75

hypersurge opened this issue Jun 7, 2020 · 2 comments
Labels

Comments

@hypersurge
Copy link

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?

@ivanpopelyshev
Copy link
Collaborator

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?

@hypersurge
Copy link
Author

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!

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

No branches or pull requests

3 participants