-
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.
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
extensions/2.0/Khronos/KHR_materials_parallax_mapping/README.md
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,56 @@ | ||
<!-- | ||
Copyright 2015-2021 The Khronos Group Inc. | ||
SPDX-License-Identifier: CC-BY-4.0 | ||
--> | ||
|
||
# KHR\_materials\_parallax\_mapping | ||
|
||
## Contributors | ||
|
||
|
||
## Status | ||
|
||
Draft | ||
|
||
## Dependencies | ||
|
||
Written against the glTF 2.0 spec. | ||
|
||
## Overview | ||
|
||
Many materials provide a height-map that can either be used for real geometry displacement or for parallax-mapping. | ||
This extension defines a way to specify a texture as a height map. | ||
|
||
## glTF Schema Updates | ||
|
||
The height at a given position is calculated by sampling the given texture and using the red channel. The sampled value is then multiplied with the `heightFactor`. | ||
The result is used in an implementation defined way to offset all other texture lookups. (See Resources) | ||
|
||
This extension does _not_ require the geometry of the object this material is applied to to be modified. | ||
|
||
```json | ||
{ | ||
"materials":[ | ||
{ | ||
"extension": { | ||
"KHR_material_parallax_mapping": { | ||
"heightTexture": 0, | ||
"heightFactor": 0.5, | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### JSON Schema | ||
|
||
- [parallaxMapping.schema.json](schema/parallaxMapping.schema.json) | ||
|
||
## Known Implementations | ||
|
||
None. | ||
|
||
## Resources | ||
* [Introduction](https://en.wikipedia.org/wiki/Parallax_mapping) | ||
* [Discussion about different implementations](https://learnopengl.com/Advanced-Lighting/Parallax-Mapping) |
23 changes: 23 additions & 0 deletions
23
extensions/2.0/Khronos/KHR_materials_parallax_mapping/schema/parallaxMapping.schema.json
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,23 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema", | ||
"title": "parallaxMapping", | ||
"type": "object", | ||
"description": "Reference to a heightmap for parallax mapping.", | ||
"allOf": [ { "$ref": "glTFChildOfRootProperty.schema.json" } ], | ||
"properties": { | ||
"heightTexture": { | ||
"allOf": [ { "$ref": "textureInfo.schema.json" } ], | ||
"description": "A texture that describes the surface height.", | ||
}, | ||
"heightFactor": { | ||
"type": "number", | ||
"description": "Used to scale the height map.", | ||
"default": 1.0, | ||
"minimum": 0.0, | ||
"gltf_detailedDescription": "This parameter scales the heightmap. A smaller number makes the effect less noticable, a higher number more prominent." | ||
|
||
}, | ||
"extensions": { }, | ||
"extras": { } | ||
}, | ||
} |