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

INTEL_lights_sunsky: a procedural sun-sky model as environmental light source #2179

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
123 changes: 123 additions & 0 deletions extensions/2.0/Vendor/INTEL_lights_sunsky/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# INTEL_lights_sunsky

## Contributors

- Johannes Günther, Intel, [@johguenther](https://github.com/johguenther)
- Bruce Cherniak, Intel, [@BruceCherniak](https://github.com/BruceCherniak)
- Isha Sharma, Intel, [@isharma25](https://github.com/isharma25)

## Status

Draft

## Dependencies

Written against the glTF 2.0 spec.

## Overview

This extension defines parameters for a procedural sun-sky model, an
environmental light source, which provides natural illumination for the
scene and which is optionally visible in the background.

<figure>
<img src="./sunsky.png" alt="Sun and sky at day and at dusk." />
<figcaption aria-hidden="true">Two different settings of the sunsky
light, affecting illumination and background; left: clear sky at day,
right: hazy sky at dusk.</figcaption>
</figure>

## Specifying a Sunsky Light

Specifying sunsky lights is similar to
[`KHR_lights_punctual`](../../Khronos/KHR_lights_punctual): the
top-level glTF 2.0 object is extended by a `lights` array, each element
a parameter struct defining a sunsky light.

```json
"extensions": {
"INTEL_lights_sunsky": {
"lights": [
{
"visible": true,
"intensity": 0.025,
"elevation": 1.1,
"azimuth": 2.5,
"turbidity": 2.0,
"albedo": 0.3
}
]
}
}
```
A sunsky light is instantiated by referencing it by a node, which also
allows for rotation and orientation of the light (e.g., placing the
zenith at +Z in the world).

```json
"nodes" : [
{
"extensions" : {
"INTEL_lights_sunsky" : {
"light" : 0
}
}
}
]
```

## Properties

No property is required, all have default values.

| Property | Description | Default |
|:-----------|:-------------|:--------|
| `visible` | whether seen in the background | `true` |
| `intensity`| brightness scaling factor | `0.025` |
| `elevation`| angle (in `-π/2`..`π/2`) of the sun to the horizon, i.e., to the plane with normal +Y (the zenith) | `π/2` |
| `azimuth` | angle (in `0`..`2π`) of the sun to +X in the horizon plane; increasing azimuth is a counterclockwise rotation around +Y | `0` |
| `turbidity`| atmospheric turbidity due to particles, between `1` (clear sky) and `10` (hazy)| `3` |
| `albedo` | ground reflectance, in `0`..`1` | `0.3` |

The [physical-based sun-sky models](#resources) provide absolute
radiance values, which are too bright for typical scenarios without
tone mapping, which is why the default `intensity` scales the intrinsic
radiance into “normal” dynamic range.

Note that the `azimuth` angle is redundant to a rotation of the node the
sunsky light is attached to, it is supported for convenience.

Some sky models only provide data for the upper hemisphere (and thus
only support `elevation >= 0`), with an unnatural, sharp cut at the
horizon. Implementations using such models can extend the sky dome by
stretching (interpolating) the horizon. The amount of stretch, the
fraction of the lower hemisphere to cover can be controlled by the
optional parameter `horizonExtension` (in `0`..`1`, default `0.01`).


## glTF Schema Updates

### JSON Schema

- [glTF.INTEL_lights_sunsky.schema.json](schema/glTF.INTEL_lights_sunsky.schema.json)
- [light.schema.json](schema/light.schema.json)
- [node.INTEL_lights_sunsky.schema.json](schema/node.INTEL_lights_sunsky.schema.json)

## Known Implementations

- Intel [OSPRay Studio](https://www.ospray.org/ospray_studio/), since
v0.11.0

## Resources

- Lukáš Hošek, Alexander Wilkie, “[An Analytic Model for Full Spectral
Sky-Dome
Radiance](https://cgg.mff.cuni.cz/projects/SkylightModelling/)”, ACM
Transactions on Graphics (Proceedings of ACM SIGGRAPH 2012), 31(4),
2012
- Alexander Wilkie, Petr Vevoda, Thomas Bashford-Rogers, Lukáš Hošek,
Tomáš Iser, Monika Kolářová, Tobias Rittig, and Jaroslav Křivánek,
“[A Fitted Radiance and Attenuation Model for Realistic
Atmospheres](https://doi.org/10.1145/3450626.3459758)”, ACM
Transactions on Graphics (Proceedings of SIGGRAPH 2021),
40(4), 2021.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "INTEL_lights_sunsky glTF extension",
"type": "object",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"lights": {
"type": "array",
"items": {
"type": "object",
"$ref": "light.schema.json"
},
"minItems": 1
},
"extensions": {},
"extras": {}
},
"required": [
"lights"
]
}
51 changes: 51 additions & 0 deletions extensions/2.0/Vendor/INTEL_lights_sunsky/schema/light.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "light",
"type": "object",
"description": "A procedural sun-sky model, an environmental light source.",
"allOf": [ { "$ref": "glTFChildOfRootProperty.schema.json" } ],
"properties": {
"visible": {
"type": "boolean",
"description": "Whether seen in the background.",
"default": true
},
"intensity": {
"type": "number",
"description": "Brightness scaling factor.",
"default": 0.025,
"minimum": 0
},
"elevation": {
"type": "number",
"description": "Angle of the sun to the horizon, i.e., to the plane with normal +Y (the zenith).",
"default": 1.5707963267948966,
"minimum": -1.5707963267948966,
"maximum": 1.5707963267948966
},
"azimuth": {
"type": "number",
"description": "Angle of the sun to +X in the horizon plane; increasing azimuth is a counterclockwise rotation around +Y.",
"default": 0,
"minimum": 0,
"maximum": 6.283185307179586
},
"turbidity": {
"type": "number",
"description": "Atmospheric turbidity due to particles, between `1` (clear sky) and `10` (hazy).",
"default": 3,
"minimum": 1,
"maximum": 10
},
"albedo": {
"type": "number",
"description": "Ground reflectance.",
"default": 0.3,
"minimum": 0,
"maximum": 1
},
"name": {},
"extensions": {},
"extras": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "INTEL_lights_sunsky node extension",
"type": "object",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"light": {
"allOf": [
{
"$ref": "glTFid.schema.json"
}
],
"description": "The id of the light referenced by this node."
},
"extensions": {},
"extras": {}
},
"required": [
"light"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Vendor extensions are not covered by the Khronos IP framework.
* [AGI_stk_metadata](2.0/Vendor/AGI_stk_metadata/README.md)
* [CESIUM_primitive_outline](2.0/Vendor/CESIUM_primitive_outline/README.md)
* [FB_geometry_metadata](2.0/Vendor/FB_geometry_metadata/README.md)
* [INTEL_lights_sunsky](2.0/Vendor/INTEL_lights_sunsky/README.md)
* [MSFT_lod](2.0/Vendor/MSFT_lod/README.md)
* [MSFT_packing_normalRoughnessMetallic](2.0/Vendor/MSFT_packing_normalRoughnessMetallic/README.md)
* [MSFT_packing_occlusionRoughnessMetallic](2.0/Vendor/MSFT_packing_occlusionRoughnessMetallic/README.md)
Expand Down