Size of vertex coordinates (was Please help)
-
- Posts: 10
- Joined: Tue Jan 27, 2015 11:32 pm
Size of vertex coordinates (was Please help)
How can I tell if a game 3d model uses 2 byte or 4byte or 8 byte vertex coordinates
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Size of vertex coordinates (was Please help)
Moved in the correct section and used a "real" title ("Please help" means nothing and 90% gets ignored).
-
- Posts: 40
- Joined: Mon Sep 15, 2014 5:13 am
Re: Size of vertex coordinates (was Please help)
theclub456 wrote:How can I tell if a game 3d model uses 2 byte or 4byte or 8 byte vertex coordinates
Most models I've seen have vertices that are 12 bytes long composing of 3 floats and often some information afterwards like uv and vertex normal data. How I figure it out is by changing the bytes per row displayed until it looks like pic related. The first 3 floats are usually the vertex information. Hope this helps.
-
- Posts: 38
- Joined: Sat Dec 20, 2014 5:14 pm
Re: Size of vertex coordinates (was Please help)
Basically, you look at how much data each vertex has.
A vertex position can be stored as a float, short or half float. Floats and half floats usually end with 'F' or 'D' or something similar.
By changing the amount of bytes shown on each line in the hex editor you can figure out how many bytes each vertex consists of
Common sizes are 28,32,64 etc
Vertices usually consist of positions, normals, uvs (often half floats), weights (either floats or bytes), bone indices, vertex colors (often bytes), extra normals (tangent, binormal), extra uv (multiple uv channels).
A vertex position can be stored as a float, short or half float. Floats and half floats usually end with 'F' or 'D' or something similar.
By changing the amount of bytes shown on each line in the hex editor you can figure out how many bytes each vertex consists of
Common sizes are 28,32,64 etc
Vertices usually consist of positions, normals, uvs (often half floats), weights (either floats or bytes), bone indices, vertex colors (often bytes), extra normals (tangent, binormal), extra uv (multiple uv channels).
-
- Posts: 17
- Joined: Fri Aug 08, 2014 12:51 am
Re: Size of vertex coordinates (was Please help)
Dump the shader (if its a dx9 10 11 pc title)
You will see the input signature like
Vertex Stride X
{
VEC3_T POSITION
VEC3_T NORMAL
VEC2_T UV
}
Then you know u need to look for those. Most game devs I've seen pack their Position floats into uint16 for XYZW
To unpack you would read the XYZ values then divide them by the scaler most cases its UINT.MAXVAL (some times its the W component) im typing this from my phone so I cant give you a copy paste function.
You will see the input signature like
Vertex Stride X
{
VEC3_T POSITION
VEC3_T NORMAL
VEC2_T UV
}
Then you know u need to look for those. Most game devs I've seen pack their Position floats into uint16 for XYZW
To unpack you would read the XYZ values then divide them by the scaler most cases its UINT.MAXVAL (some times its the W component) im typing this from my phone so I cant give you a copy paste function.