Skip to content

Introduce environment-image and environment-intensity - #392

Merged
cdata merged 2 commits into
masterfrom
reflection-image
Mar 1, 2019
Merged

cdata merged 2 commits into
masterfrom
reflection-image

Conversation

@cdata

@cdata cdata commented Feb 28, 2019 •

Copy link
Copy Markdown
Contributor

This change proposes the introduction of two new user-configurable attribute/properties: environment-image and environment-intensity. Highlights of the change include:

  • Upgrades @polymer/[email protected] to [email protected]
    • Various fixes were necessary to make tests pass after breaking changes from upgrade
  • Adds environment-image attribute to control the environment map without affecting the background image or color
  • Adds environment-intensity attribute to control the intensity of whatever environment map happens to be used

Examples

environment-intensity oscillating 0.0 - 6.0 Cycle environment-image only Cycle background-image only
reflectionintensityosc reflectionimageosc reflectionimagebgosc

Name rationale

Terms like environment map and IBL are commonly used to refer to the color information used to approximate the light emitted from physical surfaces in 3D scenes. However, these terms are not as meaningful to folks who do not have a graphics background. In the case of a mirror, puddle or other highly reflective surface, a word that very quickly comes to mind to describe the color information is "reflection." As skybox is the "background", so IBL is the "reflection."

After a lot of good internal team discussion and some questionable science, the attribute names have been changed to environment-image and environment-intensity respectively. One colleague, when faced with the choice between "reflection" and "environment," responded:

ok so this is what happened
i said "obviously reflection"
and then "oh but if the reflection is changing that means the environment around it is changing!"
🤯

Fundamentally speaking, reflectivity is a property of individual materials, and environment is a more technically accurate term.

Additional comments

This change is larger than I initially anticipated. I began to refactor environment map generation, and then quickly ran up against failing tests because I was not accommodating for #76 properly in some cases. So, rather than further spread the #76 disease, I decided to upgrade us to the latest lit-element so that we could benefit from the fix introduced a while back. This prompted additional changes that were difficult to tweeze apart from the original proposal due to the need to make tests pass.

Fixes #122
Fixes #76

@cdata
cdata force-pushed the reflection-image branch 2 times, most recently from a5694ff to 9caac99 Compare February 28, 2019 08:30
@johnpallett

Copy link
Copy Markdown
Contributor

Are non-reflective materials and surfaces affected by this attribute? "Reflection" suggests the attribute only affects a certain type of material, i.e. things that are partially or entirely reflective (mirrors, car paint, TVs that are turned off). Does this attribute affect matte paint materials?

@mrdoob

mrdoob commented Feb 28, 2019

Copy link
Copy Markdown
Collaborator

The equation is the same for all materials.
If the material is not reflective (metalness: 0), then reflection-image * 0 = 0 ✌️

@cdata

cdata commented Feb 28, 2019 •

Copy link
Copy Markdown
Contributor Author

The literal definition of "reflection" is:

The throwing back by a body or surface of light, heat, or sound without absorbing it.

If an opaque, dielectric (non-metallic) surface is lit at all, does it not follow that it is "reflecting" light (even if that reflection is not recognizable as a mirrored image of the environment due to diffusion)?

@cdata
cdata force-pushed the reflection-image branch from 9caac99 to eb38c8c Compare March 1, 2019 06:00
@cdata cdata changed the title Refactor environment, add reflection image Introduce environment-image and environment-intensity Mar 1, 2019
@cdata

cdata commented Mar 1, 2019

Copy link
Copy Markdown
Contributor Author

FYI names have been changed from reflection-* to environment-*, updated rationale is in the PR description.

@cdata
cdata marked this pull request as ready for review March 1, 2019 15:45
@cdata
cdata requested review from jsantell, mrdoob and smalls March 1, 2019 15:45
@cdata
cdata changed the base branch from stage-light-intensity to master March 1, 2019 16:24
@cdata
cdata force-pushed the reflection-image branch from c7a9e32 to dcd6d9e Compare March 1, 2019 16:28

@smalls smalls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM although I suspect @jsantell probably has better feedback we can always pick that up in a future PR.

I think the environment- prefix names are good. Thanks for putting the thought into the API!

@cdata
cdata merged commit 5bf8023 into master Mar 1, 2019
@cdata
cdata deleted the reflection-image branch March 1, 2019 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lighting: allow different images for IBL and background-image UpdatingElement sets a remove attribute as 'null' for string properties

4 participants