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

new camera light feature #2943

Merged
merged 6 commits into from
Apr 11, 2019
Merged

new camera light feature #2943

merged 6 commits into from
Apr 11, 2019

Conversation

jianhuang01
Copy link
Contributor

For #2833

Change List

  • add camera light class
  • get projected camera position in rendering pipeline
  • tests

modules/core/src/effects/lighting-effect.js Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Apr 10, 2019

Coverage Status

Coverage increased (+0.6%) to 62.388% when pulling 2383f64 on camera-light into 87cca76 on master.

@@ -0,0 +1,3 @@
import {PointLight} from '@luma.gl/core';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Time to create an effects/lighting directory?

: COORDINATE_SYSTEM.IDENTITY,
fromCoordinateOrigin: [0, 0, 0]
});
if (pointLight instanceof CameraLight) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a little concerning that the effect class has to know about CameraLight for it to work. Can users not implement their own light sources?

We could defer to each light source class to calculate this, e.g.

pointLight.getPosition(parameters);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lighting effect is owner of different light sources, I think it is reasonable for it to know each kind of light source, default behaviors and doing some jobs based on that.

User can implement their own light sources, but we need define the light source category and the basic behavior first. For example, user can implement their own CamerLight by extending from our CameraLight source, we will provide the internal camera position automatically as a predefined behavior, and user don't need understand our complicated projection system.

Point light sources stores the pre-projection position, color, and intensity ,etc. If we put this project logic inside light sources, there will be a coupling between viewport, projection system and the light source classes, which is not a good design from my perspective. Also the projected position is not the same under different viewport & zoom, then the getPosition API is even more ambiguous with those complicated logics lives together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to move viewport related logic to light source classes per offline discussion in case user need implement their own light source category.

@@ -153,6 +153,58 @@ function calculateMatrixAndOffset({
};
}

export function getCameraPositionFromViewport({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this just duplicating code in this file? At least reuse this for project module's uniform generation?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You should be able to import the project module and call project.getUniforms without this new utility function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this new API according to ib's review comments, I can revert this change if it is not good. Orginially I use the existing API 'getUniformsFromViewport', which way do you prefer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to revert back to 'getUniformsFromViewport' solution.

@ibgreen
Copy link
Collaborator

ibgreen commented Apr 11, 2019

This discussion is getting rather detailed but once the dust settles, might be worth a quick audit of the proposed API changes/logic?

Viewport and project systems are a complex part of deck, and also lighting is an area that is still under active development in both luma and deck, so it is probably worth giving this the extra thought.

Also, have we considered pushing the camera light feature to 7.1? At some point a project needs to accept that certain features missed the "train" and wait on the platform for another 4-5 weeks for the next train.

Perhaps this class can be done application-side if some app cannot wait? While we take the time to audit this and do it right?

@Pessimistress
Copy link
Collaborator

Don't forget to add documentation.

@jianhuang01
Copy link
Contributor Author

Don't forget to add documentation.

Document will be a different PR, postpone that cause I want to make sure team agrees on the solution.

@jianhuang01 jianhuang01 merged commit ba77287 into master Apr 11, 2019
@jianhuang01 jianhuang01 deleted the camera-light branch April 11, 2019 22:18
@jianhuang01
Copy link
Contributor Author

This discussion is getting rather detailed but once the dust settles, might be worth a quick audit of the proposed API changes/logic?

Viewport and project systems are a complex part of deck, and also lighting is an area that is still under active development in both luma and deck, so it is probably worth giving this the extra thought.

Also, have we considered pushing the camera light feature to 7.1? At some point a project needs to accept that certain features missed the "train" and wait on the platform for another 4-5 weeks for the next train.

Perhaps this class can be done application-side if some app cannot wait? While we take the time to audit this and do it right?

Did API audit in jam meeting, as the conclusion we make CameraLight as experimental.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants