diff options
Diffstat (limited to 'contrib/cgltf-tangents/README.md')
| -rw-r--r-- | contrib/cgltf-tangents/README.md | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/contrib/cgltf-tangents/README.md b/contrib/cgltf-tangents/README.md deleted file mode 100644 index 2a68b27..0000000 --- a/contrib/cgltf-tangents/README.md +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | # cgltf-tangents | ||
| 2 | |||
| 3 | A library to compute missing tangent vectors in glTF models using MikkTSpace. | ||
| 4 | |||
| 5 | ## Example | ||
| 6 | |||
| 7 | ``` | ||
| 8 | // Load the glTF scene and buffers as usual. | ||
| 9 | cgltf_result result = cgltf_parse_file(&options, filepath, &data); | ||
| 10 | cgltf_load_buffers(&options, data, filepath); | ||
| 11 | |||
| 12 | // Compute missing tangents. | ||
| 13 | cgltfTangentBuffer* tangent_buffers = 0; | ||
| 14 | cgltf_size num_tangent_buffers = 0; | ||
| 15 | cgltf_compute_tangents(&options, data, &tangent_buffers, &num_tangent_buffers); | ||
| 16 | ``` | ||
| 17 | |||
| 18 | ## About | ||
| 19 | |||
| 20 | This is a single-header/source library that combines | ||
| 21 | [MikkTSpace](https://github.com/mmikk/MikkTSpace) and | ||
| 22 | [cgltf](https://github.com/jkuhlmann/cgltf) to compute missing tangent vectors | ||
| 23 | for models. | ||
| 24 | |||
| 25 | Mesh primitives in glTF may have a normal map but not necessarily tangent | ||
| 26 | vectors. An example is the | ||
| 27 | [DamagedHelmet](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet/glTF) | ||
| 28 | sample. From the | ||
| 29 | [spec](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes): | ||
| 30 | |||
| 31 | *"When tangents are not specified, client implementations SHOULD calculate | ||
| 32 | tangents using default MikkTSpace algorithms with the specified vertex | ||
| 33 | positions, normals, and texture coordinates associated with the normal texture."* | ||
| 34 | |||
| 35 | cgltf-tangents takes an input glTF scene and scans it for mesh primitives that | ||
| 36 | have a normal map but no tangents. cgltf-tangents then invokes MikkTSpace to | ||
| 37 | compute tangents for those mesh primitives and outputs an array of tangent | ||
| 38 | buffers. The client can then upload these buffers to GPU memory for rendering. | ||
| 39 | |||
| 40 | See `test/` for a complete example. | ||
| 41 | |||
| 42 | MikkTSpace is packaged here for convenience. cgltf must be obtained separately. | ||
