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

Update readme for information on vertices #6

Closed
kion-dgl opened this issue Jul 7, 2024 · 2 comments · Fixed by #73
Closed

Update readme for information on vertices #6

kion-dgl opened this issue Jul 7, 2024 · 2 comments · Fixed by #73
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@kion-dgl
Copy link
Owner

kion-dgl commented Jul 7, 2024

  • Each vertex is a dword
  • Each axis is 10 bits, signed
  • -y is up
  • How to read, scale and rotate
  • How to encode, what is the max size
  • How do scale bits work
@kion-dgl
Copy link
Owner Author

kion-dgl commented Jul 11, 2024

Also right now, we're ignoring the scale bits in our tests, we need to add those back in to see if we are interpreting them correctly.

As a note, it looks like only the vertices in the body test are failing.

@kion-dgl
Copy link
Owner Author

kion-dgl commented Jul 11, 2024

Summary

Each vertex is encoded as a 32 bit value (dword).

Dword

Each dword is split up into the bottom 10 bits for x, the next 10 bits for y, the next 10 bits for z and the last 2 bits for scale.

flowchart TD
A[30 - 31 Scale]
B[20 - 29 Z]
C[10-19 Y]
D[0-9 X]
Loading

Bits

Each of the 10 bit values for each axis is a signed int. Meaning that the most significant bit is negative, and the lower 9 bits are positive. This means that the maximum negative number is -512 or 0b1000000000 and the maximum positive number is 511 or 0b0111111111.

flowchart TD
A[-512]
B[256]
C[128]
D[64]
E[32]
F[16]
G[8]
H[4]
I[2]
J[1]
Loading

Scale

The scale bits make up the top two bits in the dword. The options are as follows:

  • 0b00 1x scale
  • 0b01 2x scale
  • 0b10 4x scale
  • 0b11 0.5x scale

This means that the larger the size of the vertex, the less control over its exact position, and it will need to snap to a larger location. But at the same time, the larger a vertex is, there might be less need for precision. What this means is that in practicality, the game uses scaling sparingly.

Making Vertices Usable

The PlaysStation has two quirks that makes working with vertices

@kion-dgl kion-dgl added this to the Miku Legends v0.3 milestone Jul 30, 2024
@kion-dgl kion-dgl added the documentation Improvements or additions to documentation label Jul 30, 2024
@kion-dgl kion-dgl self-assigned this Oct 2, 2024
@kion-dgl kion-dgl linked a pull request Oct 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant