-
Notifications
You must be signed in to change notification settings - Fork 1.2k
KHR_materials_ior #1718
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
Merged
emackey
merged 17 commits into
KhronosGroup:master
from
DassaultSystemes-Technology:KHR_materials_ior
Apr 14, 2021
Merged
KHR_materials_ior #1718
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8a58fc6
Added KHR_materials_ior.
proog128 2aea8da
Changed mapping of ior texture and added more details.
proog128 008e114
Removed f0/IOR texture. Same effect can be achieved with specular col…
proog128 5bc80d6
Split into normative and non-normative parts; clarify interaction wit…
proog128 fa6dcb7
Add link to schema.
proog128 6149f5e
Small fix.
proog128 9132e03
Add reference to KHR_materials_specular to avoid duplication.
proog128 3a13916
Add reference to KHR_materials_volume to avoid duplication.
proog128 3155bd2
Clarify interaction with KHR_materials_transmission.
proog128 3fe9485
Add contributors and Khronos copyright.
proog128 d9063db
Fix link to schema.
proog128 5883dc7
Add exclusions section.
proog128 3a8e646
Simplify and link to node-based representation in Appendix B.
proog128 d05a95b
Allow the value 0 for ior.
proog128 69360cf
Update contributor list
emackey d220165
Draft status
emackey 6ebfb85
More contributors
emackey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,152 @@ | ||
| # KHR\_materials\_ior | ||
|
|
||
| ## Contributors | ||
|
|
||
| * Tobias Haeussler, Dassault Systemes [@proog128](https://github.com/proog128) | ||
| * Bastian Sdorra, Dassault Systemes [@bsdorra](https://github.com/bsdorra) | ||
| * Ben Houston, ThreeKit [@bhouston](https://github.com/bhouston) | ||
| * Richard Sahlin, IKEA [@rsahlin](https://github.com/rsahlin) | ||
| * Norbert Nopper, UX3D [@UX3DGpuSoftware](https://twitter.com/UX3DGpuSoftware) | ||
| * Ed Mackey, AGI [@emackey](https://twitter.com/emackey) | ||
|
|
||
| Copyright (C) 2018-2020 The Khronos Group Inc. All Rights Reserved. glTF is a trademark of The Khronos Group Inc. | ||
| See [Appendix](#appendix-full-khronos-copyright-statement) for full Khronos Copyright Statement. | ||
|
|
||
| ## Status | ||
|
|
||
| Experimental | ||
|
|
||
| ## Dependencies | ||
|
|
||
| Written against the glTF 2.0 spec. | ||
|
|
||
| ## Exclusions | ||
|
|
||
| * This extension must not be used on a material that also uses `KHR_materials_pbrSpecularGlossiness`. | ||
| * This extension must not be used on a material that also uses `KHR_materials_unlit`. | ||
|
|
||
| ## Overview | ||
|
|
||
| The dielectric BRDF of the metallic-roughness material in glTF uses a fixed value of 1.5 for the index of refraction. This is a good fit for many plastics and glass, but not for other materials like water or asphalt, sapphire or diamond. This extensions allows users to set the index of refraction to a certain value. | ||
|
|
||
| ## Extending Materials | ||
|
|
||
| The index of refraction of a material is configured by adding the `KHR_materials_ior` extension to any glTF material. | ||
|
|
||
| ```json | ||
| { | ||
| "materials": [ | ||
| { | ||
| "extensions": { | ||
| "KHR_materials_ior": { | ||
| "ior": 1.4, | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| | |Type|Description|Required| | ||
| |-|----|-----------|--------| | ||
| | **ior** | `number` | The index of refraction. | No, default: `1.5`| | ||
|
|
||
| Typical values for the index of refraction range from 1 to 2. In rare cases values greater than 2 are possible. The following table shows some materials and their index of refraction: | ||
|
|
||
| | Material | Index of Refraction | | ||
| |--------------|---------------------| | ||
| | Air | 1.0 | | ||
| | Water | 1.33 | | ||
| | Eyes | 1.38 | | ||
| | Window Glass | 1.52 | | ||
| | Sapphire | 1.76 | | ||
| | Diamond | 2.42 | | ||
|
|
||
| The ior parameter affects the `dielectric_brdf` of the glTF 2.0 metallic-roughness material. The new `dielectric_brdf` that includes the `ior` parameter is given as follows: | ||
|
|
||
| ``` | ||
| dielectric_brdf = | ||
| fresnel_mix( | ||
| ior = ior, | ||
| base = diffuse_brdf( | ||
| color = baseColor), | ||
| layer = specular_brdf( | ||
| α = roughness^2)) | ||
| ``` | ||
|
|
||
| ## Implementation | ||
|
|
||
| *This section is non-normative* | ||
|
|
||
| The extension changes the computation of the Fresnel term defined in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) to the following: | ||
|
|
||
| ``` | ||
| const dielectricSpecular = ((ior - 1)/(ior + 1))^2 | ||
| ``` | ||
|
|
||
| Note that for the default index of refraction `ior = 1.5` this term evaluates to `dielectricSpecular = 0.04`. | ||
|
|
||
| ## Interaction with other extensions | ||
|
|
||
| If `KHR_materials_specular` is used in combination with `KHR_materials_ior`, the Fresnel term is additionally scaled by the values given `specular` and `specularColor`. See [`KHR_materials_specular`](../KHR_materials_specular/README.md) for more information. | ||
|
|
||
| If `KHR_materials_transmission` is used in combination with `KHR_materials_ior`, the `ior` affects the strength of the transmission effect according to the Fresnel term. See [`KHR_materials_transmission`](../KHR_materials_transmission/README.md) for more information. If `KHR_materials_specular` is used in addition, the Fresnel term is additionally scaled by the values given in `specular` and `specularColor`. | ||
|
|
||
| If `KHR_materials_volume` is used in combination with `KHR_materials_ior`, the `ior` affects the refraction effect. See [`KHR_materials_volume`](../KHR_materials_volume/README.md) for more information. | ||
|
|
||
| ## Schema | ||
|
|
||
| - [glTF.KHR_materials_ior.schema.json](schema/glTF.KHR_materials_ior.schema.json) | ||
|
|
||
| ## Appendix: Full Khronos Copyright Statement | ||
|
|
||
| Copyright 2018-2020 The Khronos Group Inc. | ||
|
|
||
| Some parts of this Specification are purely informative and do not define requirements | ||
| necessary for compliance and so are outside the Scope of this Specification. These | ||
| parts of the Specification are marked as being non-normative, or identified as | ||
| **Implementation Notes**. | ||
|
|
||
| Where this Specification includes normative references to external documents, only the | ||
| specifically identified sections and functionality of those external documents are in | ||
| Scope. Requirements defined by external documents not created by Khronos may contain | ||
| contributions from non-members of Khronos not covered by the Khronos Intellectual | ||
| Property Rights Policy. | ||
|
|
||
| This specification is protected by copyright laws and contains material proprietary | ||
| to Khronos. Except as described by these terms, it or any components | ||
| may not be reproduced, republished, distributed, transmitted, displayed, broadcast | ||
| or otherwise exploited in any manner without the express prior written permission | ||
| of Khronos. | ||
|
|
||
| This specification has been created under the Khronos Intellectual Property Rights | ||
| Policy, which is Attachment A of the Khronos Group Membership Agreement available at | ||
| www.khronos.org/files/member_agreement.pdf. Khronos grants a conditional | ||
| copyright license to use and reproduce the unmodified specification for any purpose, | ||
| without fee or royalty, EXCEPT no licenses to any patent, trademark or other | ||
| intellectual property rights are granted under these terms. Parties desiring to | ||
| implement the specification and make use of Khronos trademarks in relation to that | ||
| implementation, and receive reciprocal patent license protection under the Khronos | ||
| IP Policy must become Adopters and confirm the implementation as conformant under | ||
| the process defined by Khronos for this specification; | ||
| see https://www.khronos.org/adopters. | ||
|
|
||
| Khronos makes no, and expressly disclaims any, representations or warranties, | ||
| express or implied, regarding this specification, including, without limitation: | ||
| merchantability, fitness for a particular purpose, non-infringement of any | ||
| intellectual property, correctness, accuracy, completeness, timeliness, and | ||
| reliability. Under no circumstances will Khronos, or any of its Promoters, | ||
| Contributors or Members, or their respective partners, officers, directors, | ||
| 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. | ||
18 changes: 18 additions & 0 deletions
18
extensions/2.0/Khronos/KHR_materials_ior/schema/glTF.KHR_materials_ior.schema.json
This file contains hidden or 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,18 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema", | ||
| "title": "KHR_materials_ior glTF extension", | ||
| "type": "object", | ||
| "description": "glTF extension that defines the index of refraction of a material.", | ||
| "allOf": [ { "$ref": "glTFProperty.schema.json" } ], | ||
| "properties": { | ||
| "ior": { | ||
| "type": "number", | ||
| "description": "The index of refraction.", | ||
| "default": 1.5, | ||
| "minimum": 1.0, | ||
|
emackey marked this conversation as resolved.
Outdated
|
||
| "gltf_detailedDescription": "The index of refraction (IOR) is a measured physical number usually in the range between 1 and 2 that determines how much the path of light is bent, or refracted, when entering a material. It also influences the ratio between reflected and transmitted light, calculated from the Fresnel equations." | ||
| }, | ||
| "extensions": { }, | ||
| "extras": { } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.