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

Upate to latest glTF #8

Merged
merged 75 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
76587d9
instancing extension
ultrafishotoy Oct 23, 2019
de031ed
cleanup
ultrafishotoy Oct 23, 2019
5d2dac5
overview statement
ultrafishotoy Oct 23, 2019
ed5f6e6
tweak statements
ultrafishotoy Oct 23, 2019
a68dcf6
statement
ultrafishotoy Oct 23, 2019
82b3adb
description
ultrafishotoy Oct 23, 2019
1b4f9c3
typo
ultrafishotoy Oct 23, 2019
956b01d
simple example
ultrafishotoy Nov 6, 2019
62cf80a
syntax fix
ultrafishotoy Nov 6, 2019
2ed4903
teapots galore
ultrafishotoy Nov 6, 2019
a833742
oops
ultrafishotoy Nov 6, 2019
8b8e39a
example image
ultrafishotoy Nov 6, 2019
66fa030
fix path
ultrafishotoy Nov 6, 2019
332af44
update attribs to POSITION, ROTATION, and SCALE
ultrafishotoy Dec 2, 2019
133d28d
rename extension
ultrafishotoy Dec 2, 2019
3857fa7
updated POSITION attribute to TRANSLATION
ultrafishotoy Dec 31, 2019
d53d9c8
remove 'world space' language
ultrafishotoy Jan 5, 2020
b4854e9
new sample files
ultrafishotoy Feb 19, 2020
ea4c776
sample updated with rotation as a quaternion
ultrafishotoy Mar 5, 2020
c70f30e
latest sample files
ultrafishotoy Mar 26, 2020
615652a
oops
ultrafishotoy Mar 26, 2020
8d8f4a0
KHR_mesh_instancing -> EXT_mesh_gpu_instancing
Mar 28, 2020
eef3c13
Merge pull request #1 from donmccurdy/ultrafishotoy-EXT_mesh_gpu_inst…
ultrafishotoy Mar 30, 2020
900ac06
moved to Vendor folder and renamed
ultrafishotoy Mar 31, 2020
5984aa1
Merge branch 'KHR_instancing' of https://github.com/ultrafishotoy/glT…
ultrafishotoy Mar 31, 2020
973bc5a
Starting to replace the tables with the glTF-Project-Explorer
javagl Apr 8, 2020
75de758
An attempt to trick GitHub into retaining the anchor links
javagl Apr 8, 2020
86b543c
Trying to keep existing links with anchors
javagl Apr 8, 2020
0ee8126
Trying even more trickery to retain the anchor links
javagl Apr 8, 2020
2ae9fe9
Removed tables that will be replaced with the project explorer
javagl Apr 8, 2020
79b1114
Updated TOC and wording
javagl Apr 8, 2020
d15d455
Removed broken link. Fixed changed link.
javagl Apr 8, 2020
9bd4e94
Fixed indentation and link target
javagl Apr 8, 2020
7af8f22
Initial version of CESIUM_primitive_outline spec.
kring Apr 17, 2020
ad9af82
Move image placeholder to the top.
kring Apr 17, 2020
415c608
Add figures, tweak README.
kring Apr 28, 2020
dec7a10
Merge remote-tracking branch 'upstream/master' into CESIUM_primitive_…
kring Apr 28, 2020
738e07f
Add schema for CESIUM_primitive_outline.
kring Apr 28, 2020
7e2b663
number -> integer
kring Apr 28, 2020
bd95b64
Add new extension to ToC.
kring Apr 28, 2020
456c856
Maintain alphabetic sorting of vendor extensions.
kring Apr 28, 2020
7894a72
Add Sean to contributors.
kring Apr 28, 2020
fd73db4
Fix typo.
kring Apr 28, 2020
ea7fde7
Merge pull request #1797 from kring/CESIUM_primitive_outline
emackey Apr 28, 2020
8fa5fdd
Mark Clearcoat as ratified
emackey Apr 28, 2020
18fdc28
Mark clearcoat and mesh_quantization as ratified.
emackey Apr 28, 2020
294c940
Merge pull request #1803 from KhronosGroup/clearcoat-ratified
emackey Apr 28, 2020
5cc0f5c
Add SPECTRUM vendor prefix
pjcozzi Apr 29, 2020
7c7de09
Merge pull request #1805 from KhronosGroup/pjcozzi-patch-1
pjcozzi Apr 29, 2020
dbd7b63
specify the types of the attributes
ultrafishotoy Apr 29, 2020
b144181
Merge pull request #1796 from javagl/project-list-migration
javagl May 4, 2020
ecd0aac
Add link to "View a glTF model in AR on Android without leaving your …
pjcozzi May 12, 2020
c259065
Merge pull request #1814 from KhronosGroup/pjcozzi-patch-1
pjcozzi May 12, 2020
e0a458b
clean up readme.md
ultrafishotoy May 27, 2020
0c76176
Merge pull request #1691 from ultrafishotoy/KHR_instancing
emackey May 28, 2020
fee8592
Update extension README.md
emackey May 28, 2020
9b7cba9
EXT_mesh_gpu_instancing: Allow quantized quaternions
zeux Jun 2, 2020
6b726df
Fix case in schema for SCALE
zeux Jun 2, 2020
9fbf782
Update README.md
zeux Jun 2, 2020
d360133
Clarify that AO does not affect direct lighting.
Jun 12, 2020
b9682f3
Add PANDA3D vendor prefix
Moguri Jun 12, 2020
7aebdd9
Clearer indication of non-normative section, update trademarks.
emackey Jul 1, 2020
a3d9436
Fix italics markdown
emackey Jul 1, 2020
9f5588d
Make some parts of implementation section normative.
proog128 Jul 6, 2020
a3e4c3a
Add a link to the MIME Sniffing Standard
lexaknyazev Jul 7, 2020
a1c336e
Merge pull request #1826 from KhronosGroup/donmccurdy-ao-clarification
emackey Jul 13, 2020
e51a5a2
Add SEIN vendor extension prefix
pjcozzi Jul 21, 2020
dae8fe7
Merge pull request #1842 from KhronosGroup/pjcozzi-patch-1
pjcozzi Jul 21, 2020
9d1a30c
Merge pull request #1836 from KhronosGroup/clearcoat-normative
emackey Aug 3, 2020
e2061a7
Merge pull request #1 from KhronosGroup/master
willeastcott Aug 5, 2020
f3a7553
Add PlayCanvas viewer to list of Preview Tools
willeastcott Aug 5, 2020
ba36f57
Merge pull request #1820 from zeux/instancing-quantquat
emackey Aug 6, 2020
0f59b5a
Merge pull request #1847 from willeastcott/master
emackey Aug 6, 2020
3b92811
Clarify the restriction on accessor counts within a primitive
zeux Aug 11, 2020
acb8b62
Merge pull request #1848 from zeux/attribute-accessor-count
bghgary Aug 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
348 changes: 31 additions & 317 deletions README.md

Large diffs are not rendered by default.

41 changes: 23 additions & 18 deletions extensions/2.0/Khronos/KHR_materials_clearcoat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See [Appendix](#appendix-full-khronos-copyright-statement) for full Khronos Copy

## Status

Draft
Complete

## Dependencies

Expand Down Expand Up @@ -52,7 +52,7 @@ The PBR clearcoat materials are defined by adding the `KHR_materials_clearcoat`

### Clearcoat

All implementations should use the same calculations for the BRDF inputs. Implementations of the BRDF itself can vary based on device performance and resource constraints. See [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) for more details on the BRDF calculations.
The following parameters are contributed by the `KHR_materials_clearcoat` extension:

| | Type | Description | Required |
|----------------------------------|---------------------------------------------------------------------------------|----------------------------------------|----------------------|
Expand All @@ -61,7 +61,19 @@ All implementations should use the same calculations for the BRDF inputs. Implem
|**clearcoatRoughnessFactor** | `number` | The clearcoat layer roughness. | No, default: `0.0` |
|**clearcoatRoughnessTexture** | [`textureInfo`](/specification/2.0/README.md#reference-textureInfo) | The clearcoat layer roughness texture. | No |
|**clearcoatNormalTexture** | [`normalTextureInfo`](/specification/2.0/README.md#reference-normaltextureinfo) | The clearcoat normal map texture. | No |


The clearcoat BRDF is layered on top of the glTF 2.0 Metallic-Roughness material, including emission and all extensions. The `clearcoatFactor` determines the view-independent intensity of the clearcoat BRDF. If `clearcoatFactor` (in the extension) is zero, the whole clearcoat layer is disabled. Implementations of the BRDF itself can vary based on device performance and resource constraints. As in the specular term of the glTF 2.0 Metallic-Roughness material, the roughness input is squared to make it perceptually linear, and the Fresnel term uses a fixed refractive index of 1.5, corresponding to a F0 of 0.04.

The values for clearcoat layer intensity and clearcoat roughness can be defined using factors, textures, or both. If the `clearcoatTexture` or `clearcoatRoughnessTexture` is not given, respective texture components are assumed to have a value of 1.0. All clearcoat textures contain RGB components in linear space. If both factors and textures are present, the factor value acts as a linear multiplier for the corresponding texture values.

If `clearcoatNormalTexture` is not given, no normal mapping is applied to the clear coat layer, even if normal mapping is applied to the base material. Otherwise, `clearcoatNormalTexture` may be a reference to the same normal map used by the base material, or any other compatible normal map.

## Implementation Notes

*This section is non-normative.*

All implementations should use the same calculations for the BRDF inputs. See [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) for more details on the BRDF calculations.

The clearcoat formula `f_clearcoat` is computed using the specular term from the glTF 2.0 Metallic-Roughness material, defined in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation). Use specular F0 equal `0.04`, base color black `0.0, 0.0, 0.0`, metallic value `0.0`, and the clearcoat roughness value defined in this extension as follows:

```
Expand All @@ -78,12 +90,6 @@ color = (f_emissive + f_diffuse + f_specular) * (1.0 - clearcoatBlendFactor * cl
f_clearcoat * clearcoatBlendFactor
```

If `clearcoatFactor` (in the extension) is zero, the whole clearcoat layer is disabled.

The values for clearcoat layer intensity and clearcoat roughness can be defined using factors, textures, or both. If the `clearcoatTexture` or `clearcoatRoughnessTexture` is not given, respective texture components are assumed to have a value of 1.0. All clearcoat textures contain RGB components in linear space. If both factors and textures are present, the factor value acts as a linear multiplier for the corresponding texture values.

If `clearcoatNormalTexture` is not given, no normal mapping is applied to the clear coat layer, even if normal mapping is applied to the base material. Otherwise, `clearcoatNormalTexture` may be a reference to the same normal map used by the base material, or any other compatible normal map.

## Schema

- [glTF.KHR_materials_clearcoat.schema.json](schema/glTF.KHR_materials_clearcoat.schema.json)
Expand Down Expand Up @@ -147,12 +153,11 @@ employees, agents or representatives be liable for any damages, whether direct,
indirect, special or consequential damages for lost revenues, lost profits, or
otherwise, arising from or in connection with these materials.

Vulkan is a registered trademark and Khronos, OpenXR, SPIR, SPIR-V, SYCL, WebGL,
WebCL, OpenVX, OpenVG, EGL, COLLADA, glTF, NNEF, OpenKODE, OpenKCAM, StreamInput,
OpenWF, OpenSL ES, OpenMAX, OpenMAX AL, OpenMAX IL, OpenMAX DL, OpenML and DevU are
trademarks of The Khronos Group Inc. ASTC is a trademark of ARM Holdings PLC,
OpenCL is a trademark of Apple Inc. and OpenGL and OpenML are registered trademarks
and the OpenGL ES and OpenGL SC logos are trademarks of Silicon Graphics
International used under license by Khronos. All other product names, trademarks,
and/or company names are used solely for identification and belong to their
respective owners.
Khronos® and Vulkan® are registered trademarks, and ANARI™, WebGL™, glTF™, NNEF™, OpenVX™,
SPIR™, SPIR-V™, SYCL™, OpenVG™ and 3D Commerce™ are trademarks of The Khronos Group Inc.
OpenXR™ is a trademark owned by The Khronos Group Inc. and is registered as a trademark in
China, the European Union, Japan and the United Kingdom. OpenCL™ is a trademark of Apple Inc.
and OpenGL® is a registered trademark and the OpenGL ES™ and OpenGL SC™ logos are trademarks
of Hewlett Packard Enterprise used under license by Khronos. ASTC is a trademark of
ARM Holdings PLC. All other product names, trademarks, and/or company names are used solely
for identification and belong to their respective owners.
2 changes: 1 addition & 1 deletion extensions/2.0/Khronos/KHR_mesh_quantization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ See [Appendix](#appendix-full-khronos-copyright-statement) for full Khronos Copy

## Status

Draft (not ratified yet)
Complete

## Dependencies

Expand Down
76 changes: 76 additions & 0 deletions extensions/2.0/Vendor/CESIUM_primitive_outline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# CESIUM_primitive_outline

<figure>
<img src="./figures/with-extension.png"/>
<figcaption><em>Edges rendered on solid buildings using this extension. The buildings are derived from OpenStreetMap data in New York.</em></figcaption>
</figure>

## Contributors

- Kevin Ring, Cesium, [@kring](https://github.com/kring)
- Sean Lilley, Cesium, [@lilleyse](https://github.com/lilleyse)

## Status

Cesium Vendor Extension - Currently supported in [CesiumJS](https://cesium.com/cesiumjs) and in some of Cesium's content generation tools.

## Dependencies

Written against the glTF 2.0 spec.

## Overview

Non-photorealistic 3D objects, such as untextured buildings, are often more visually compelling when their edges are outlined. A simple approach to adding outlines to a glTF model is to add an additional primitive of type `LINES` to the model, drawing lines along the edges to be outlined. Unfortunately, the visual quality of such an approach is quite poor, because the lines depth fight with the triangles. The rasterization of the lines does not match the rasterization of the edges of the triangles.

<figure>
<img src="./figures/depth-fighting.png"/>
<figcaption><em>Stipling caused by depth fighting between separately-rendered lines and triangles.</em></figcaption>
</figure>

The traditional way to avoid this depth fighting is to use `glPolygonOffset` or similar. glTF 2.0, however, does not support specifying a polygon offset. Even if it did - or an extension were defined to support it - it's very difficult to get high quality rendering with this approach. Depending on the polygon offset values chosen, lines on the back-face may "bleed through" to the front because of too much depth bias, or lines may have a stipled look due to too little depth bias. Even with careful tuning of the polygon offset values, it's usually possible to detect both problems simultaneously in a single scene.

Even if these artifacts are deemed tolerable, rendering separate line primitives increases the number of draw calls required to render the scene. Furthermore, on some hardware, drawing lines is significantly slower than drawing triangles.

This extension indicates to a rendering engine that a list of triangle edges should be outlined. While it does not dictate how the rendering should be done, the fact that all of the lines are actually edges of triangles allows the rendering engine to use a higher quality - and faster - technique for rendering the lines, without needing to deduce the suitability of such a technique at runtime.

## Extending Primitives

Edge outlining is requested by adding the `CESIUM_primitive_outline` extension to a primitive rendered with `"mode": 4`, `TRIANGLES`.

```json
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"_BATCHID": 2
},
"indices": 3,
"material": 0,
"mode": 4,
"extensions": {
"CESIUM_primitive_outline": {
"indices": 4
}
}
}
]
}
]
```

The `indices` property specifies the ID of an accessor with the locations of the edges. The accessor must contain an even number of elements of `componentType` `UNSIGNED_SHORT` (5123) or `UNSIGNED_INT` (5125) representing vertex indices on the primitive containing this extension. Each pair of indices specifies the endpoint vertices of an edge to be highlighted. These two vertices must also be two of the three vertices of one or more triangles; otherwise, the line will not be drawn at all.

## Implementation Notes

This extension does not dictate any specific rendering technique; it only requires that the outlines be drawn and that they avoid depth fighting with the solid geometry. However, most implementations will find it convenient to use a single-pass approach that renders the outlines as part of the triangles. For example, [Fast and versatile texture-based wireframe rendering](https://www.researchgate.net/publication/220067637_Fast_and_versatile_texture-based_wireframe_rendering) describes a technique that uses a mipmapped 1D texture and three sets of 1D texture coordinates to render high-quality, anti-aliased lines on the edges of triangles. This is the approach used in CesiumJS.

A fully-functional, open-source implementation of this extension was added to CesiumJS in [this pull request](https://github.com/CesiumGS/cesium/pull/8776).

## Justification

Strictly speaking, this extension is not required. A rendering engine could inspect all LINES primitives to see if they share vertices with a TRIANGLES primitive and, if so, use a different rendering technique to render lines that are coincident with triangle edges. However, this would add a significant runtime cost to match lines to triangle edges, and the cost would be imposed on all models that use lines, even those that would not benefit from this rendering technique. Therefore, this extension is primarily an optimization, allowing models to opt-in to single-pass, non-photorealistic edge rendering.

Using this extension also means that lines will not be drawn at all in rendering engines that do not support this extension. This is desirable because depth-fighting between lines and triangles looks very bad; we're probably better off not rendering the lines at all.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "CESIUM_primitive_outline glTF primitive extension",
"type": "object",
"description": "glTF extension for indicating that some edges of a primitive's triangles should be outlined.",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"indices": {
"type": "integer",
"description": "The index of the accessor providing the list of highlighted lines at the edge of this primitive's triangles."
},
"extensions": { },
"extras": { }
}
}
77 changes: 77 additions & 0 deletions extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# EXT\_mesh\_gpu\_instancing

## Contributors

* John Cooke, OTOY, <mailto:[email protected]>
* Don McCurdy
* Arseny Kapoulkine, [@zeuxcg](https://twitter.com/zeuxcg)

## 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, _COLOR, etc.).

## Extending Nodes With 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
},
}
}
}
]
}
```

Valid accessor type and component type for each attribute semantic property are defined below.

|Name|Accessor Type|Component Type(s)|Description|
|----|----------------|-----------------|-----------|
|`"TRANSLATION"`|`"VEC3"`|`5126`&nbsp;(FLOAT)|XYZ translation vector|
|`"ROTATION"`|`"VEC4"`|`5126`&nbsp;(FLOAT)<br>`5120`&nbsp;(BYTE)&nbsp;normalized<br>`5122`&nbsp;(SHORT)&nbsp;normalized|XYZW rotation quaternion|
|`"SCALE"`|`"VEC3"`|`5126`&nbsp;(FLOAT)|XYZ scale vector|

All attribute accessors in a given node **must** have the same `count`.

> **Implementation Note:** When instancing is used on the node, the non-instanced version of the mesh should not be rendered.

## Transformation Order

When using instancing, the instance transform matrix is constructed by multiplying translation (if present), rotation (if present), and scale in the same order as they are for nodes:

InstanceXform = Translation * Rotation * Scale

The node's world transform matrix is constructed by multiplying the node's local transform matrix from the root of the tree up until (and including) the node itself:

NodeWorldXform = RootXform * ... * ParentLocalXform * NodeLocalXform

The resulting transforms are applied to mesh positions/normals/etc., with instance transformation applied first:

WorldPosition = NodeWorldXform * InstanceXform * VertexPosition

> Note: the construction above assumes column vectors; for row vectors, the matrix multiplication order should be reversed
Binary file not shown.
Binary file not shown.
Loading