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

Shadows for Primitives #3584

Merged
merged 9 commits into from
Feb 17, 2016
Merged

Shadows for Primitives #3584

merged 9 commits into from
Feb 17, 2016

Conversation

lilleyse
Copy link
Contributor

For #2594

Primitives now work with shadows. I had to do some tweaking to make shadow casting work for primitives that use relative-to-center, since they hard-coded the camera's view matrix.

@@ -1077,31 +1103,32 @@ define([
function createShaderProgram(primitive, frameState, appearance) {
var context = frameState.context;
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 should note that primitives that supply their own _createShaderProgramFunction do not support shadows right now. I believe this is just GroundPrimitive.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's only GroundPrimitive. Since the polygons are draped on terrain, they don't need to cast shadows. If they are translucent, they probably don't need to receive shadows, but I would wait and test to see how it looks when you have terrain receive shadows.

@bagnell
Copy link
Contributor

bagnell commented Feb 16, 2016

This doesn't have to be addressed in this PR, but the cast shadows will disappear when the caster is culled by the camera frustum:
image
Zoom in until the top box is out of view:
image

this.receiveShadows = defaultValue(options.receiveShadows, true);
this._receiveShadows = this.receiveShadows;

this._shadowsEnabled = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor, and up to you, but I didn't know what this was when I first saw it. Maybe _frameStateShadowsEnable or _sceneShadowsEnabled is a better name in this context of this file.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 16, 2016

Good momentum! @bagnell can merge when ready.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 16, 2016

the cast shadows will disappear when the caster is culled by the camera frustum

I would consider this part of the terrain work we discussed offline this morning.

@lilleyse
Copy link
Contributor Author

I would consider this part of the terrain work we discussed offline this morning.

Yeah, it will be a separate PR. executeShadowMapCommands is just taking whatever is in the first frustum, so the culling is expected for now.

@lilleyse
Copy link
Contributor Author

Updated.

bagnell added a commit that referenced this pull request Feb 17, 2016
@bagnell bagnell merged commit 8172ff7 into shadows Feb 17, 2016
@bagnell bagnell deleted the shadows-primitive branch February 17, 2016 16:17
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.

3 participants