https://github.com/terraspace/mshx
MSHX Tools
https://github.com/terraspace/mshx
Last synced: 2 months ago
JSON representation
MSHX Tools
- Host: GitHub
- URL: https://github.com/terraspace/mshx
- Owner: Terraspace
- Created: 2025-02-24T17:25:39.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-24T17:33:09.000Z (3 months ago)
- Last Synced: 2025-02-24T18:29:20.456Z (3 months ago)
- Language: Go
- Size: 17.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**WaveFront OBJ to MSHX Converter Utility**
**MSHX Format**
magic: char[4] ; 'MSHX'
version: uint32 ; version of the MSHX file (currently 1)
vertexCount: uint32
normalCount: uint32
tangentCount: uint32
uvCount: uint32
faceCount: uint32
materialCount: uint32
vertexType: uint32 ; 0=xyz, 1=xyzargb
boundingSphere: x,y,z,radius (float)
; A close-to-optimal bounding sphere is generated for the mesh
vertices[vertexCount]:
x,y,z, (float,) ; w assumed = 1.0, if no color data in OBJ file, is omitted
normals[normalCount]:
nx,ny,nz (float) ; w assumed = 0.0
; *** Normals from an OBJ file are re-normalized on conversion
tangents[tangentCount]:
tux,tuy,tuz (float) ; w assumed = 0.0 (tangent)
tvx,tvy,tvz (float) ; w assumed = 0.0 (bitangent)
uvs[uvCount]:
u,v (float)
faces[faceCount]:
edge-count (uint8) ; [3=tri, 4=quad...]
v1,v2,v3,[v4]... (uint32) ; index into above vertex buffer [mandatory]
n1,n2,n3,[n4]... (uint32) ; index into above normal buffer [skipped if no normals above]
t1,t2,t3,[t4]... (uint32) ; index into above tangent buffer [skipped if no tangets above]
uv1,uv2,uv3,[uv4]... (uint32) ; index into above uv buffer [skipped if no uvs above]
materialID (uint32) ; mandatory = 0 if no materials
; for a quad, the 4 vertices are tested to ensure they are coplanar and convex
; face winding order is assumed to be correct in the source OBJ file
; vertex/face reordering pre-pass in converter to optimize for vertex cache
; *** source OBJ files must use absolute and not relative indices
; *** OBJ files are assumed to only support triangle and quad, not higher order polyongs
materials[materialCount]:
ambientColor (argb[] float32) ; ambient colour
diffuseColor (argb[] float32) ; diffuse colour
specularColor (argb[] float32) ; specular colour
emissiveColor (argb[] float32) ; emissive colour
transmissiveColor (argb[] float32) ; transmissive colour
specularPower (float32) ; specular power
emissive (float32)
roughness (float32) ; mix between diffuse and specular (fixed for an entire material) [0.0 - 1.0] [diffuse - specular] - used when no roughness map provided below.
metal (float32) ; [0.0 - 1.0] how reflective a material is / 0=nonmetal, 1=metal
mode (uint32)
sheen (float32)
clearcoat thickness (float32)
clearcore roughness (float32)
anisotropy (float32)
aniostropy rotation (float32)
texture map string length (uint32)
texture map name (byte[])