-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1691 from ultrafishotoy/KHR_instancing
EXT_mesh_gpu_instancing
- Loading branch information
Showing
14 changed files
with
1,704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# EXT\_mesh\_gpu\_instancing | ||
|
||
## Contributors | ||
|
||
* John Cooke, OTOY, <mailto:[email protected]> | ||
* Don McCurdy | ||
* Arseny Kapoulkine | ||
|
||
## Acknowledgments | ||
|
||
## Status | ||
|
||
Experimental | ||
|
||
## Dependencies | ||
|
||
Written against the glTF 2.0 spec. | ||
|
||
## Overview | ||
|
||
This extension is specfically designed to enable GPU instancing which renders many copies of a single mesh at once using a small number of draw calls. It's useful for things | ||
like trees, grass, road signs, etc. The TRANSLATION, ROTATION, and SCALE attributes allows the mesh to be displayed at many different locations with different rotations and scales. | ||
Custom attributes can use the underscore mechanism to achieve other effects (i.e. _ID, _TRANSFORM4x3, etc.). | ||
|
||
## Extending Nodes with per instance attributes | ||
|
||
Instancing is defined by adding the `EXT_mesh_gpu_instancing` extension to any glTF node that has a mesh. Instancing only applies to mesh nodes, there is no defined behavior for a node | ||
with this extension that doesn't also have a mesh. Applying to nodes rather than meshes allows the same mesh to be used by several nodes, instanced or otherwise. The attributes | ||
section contains accessor ids for the TRANSLATION, ROTATION, and SCALE attribute buffers, all of which are optional. The attributes specify an object space transform that should be | ||
multipled by the node's world transform in the shader to produce the final world transform for the instance. For example, the following defines some instancing attributes to a node with mesh. | ||
|
||
```json | ||
{ | ||
"nodes": [ | ||
{ | ||
"mesh": 0, | ||
"name": "teapot", | ||
"extensions": { | ||
"EXT_mesh_gpu_instancing": { | ||
"attributes": { | ||
"TRANSLATION": 0, | ||
"ROTATION": 1, | ||
"SCALE": 2, | ||
"_ID" : 3 | ||
}, | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Appendix | ||
|
||
|
||
## Reference | ||
|
||
|
||
### Theory, Documentation and Implementations |
Binary file added
BIN
+98.9 KB
extensions/2.0/Vendor/EXT_mesh_gpu_instancing/samples/teapots_galore/mesh.bin
Binary file not shown.
Binary file added
BIN
+152 Bytes
extensions/2.0/Vendor/EXT_mesh_gpu_instancing/samples/teapots_galore/mesh_2.bin
Binary file not shown.
Oops, something went wrong.