-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Cull shadow commands #3819
Cull shadow commands #3819
Conversation
@lilleyse is the TODO for this PR? If so, use a Markdown tasklist. |
for (var i = 0; i < length; ++i) { | ||
var command = commandList[i]; | ||
// Don't insert globe commands with the rest of the scene commands since they are handled separately | ||
if (command.castShadows && (insertAll || (command.pass === Pass.OPAQUE || command.pass === Pass.TRANSLUCENT))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but long-term, we can evaluate avoiding linear searches like this, e.g., "is opaque or translucent", by using separate lists.
Just those comments so far for this PR. |
cc09976
to
0582b1f
Compare
Conflicts: Source/Scene/Scene.js
The most recent code checks if the shadow map is visible or not. For non-cascaded shadow maps, it checks the shadow volume's bounding sphere against the scene camera's frustum. Cascaded shadows go out of view when the camera is camera is zoomed too far from the Earth or when the light is angled below the horizon. At the same time the code checks if a shadow map needs to update. |
I started bullet two: |
I am all for the simple solution and adding the more involved technique to the roadmap. We may need to reevaluate with 3D Tiles buildings, but I think that should be an easier case than terrain. |
@@ -1241,7 +1241,7 @@ define([ | |||
// When moving the camera low LOD terrain tiles begin to load, whose bounding volumes | |||
// throw off the near/far fitting for the shadow map. Only update shadowNear and shadowFar | |||
// for reasonably sized bounding volumes. | |||
if (!(distances.start < 0.0 && distances.stop > frameState.shadowFar)) { | |||
if (!((distances.start < -100.0) && (distances.stop > 100.0) && (pass === Pass.GLOBE))){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to add a TODO
that 3D Tiles are not part of Pass.GLOBE
. However, we can introduce Pass.ENVIRONMENT
, etc., but will need to think through opaque vs. translucent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the TODO. I'll have to try it out, but it may not actually be a problem.
Just those comments on the new commits. |
Shadow Improvements
Multiple shadow maps
Shadows Updates
Merging this. The TODO list will be added/fixed in separate PRs. |
For #2594
executeShadowMapCommands
to cull commands based on the shadow volume. This will allow for rendering casters that may not be visible to the scene camera. Also culls against individual cascades.Shadows.html
To-do:
Globe.update
. Culling based on an orthographic camera seems to have problems.