-
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
Post processing #5615
Post processing #5615
Conversation
added HBAO and DOF
Added stepsize parameter at DOF
add Bloom(Glow) abd EdgeDetection(Toon) Fixed a HBAO's artifact which draws unexpected lines Glow - http://localhost:8080/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=d5fd85d0eaec2a91fb9548ec8d8fbea4 Toon - http://localhost:8080/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=87ac93ad6ac8df9c78894ba242416450
…ternally, and set stages show to true by default
cleaned up improvements for PostProcess Added sandcastles for Bloom and Edge detection Reflected Sean Lilley's review
Source/Scene/Scene.js
Outdated
// and instead shadowing is built-in. In this case execute the command regularly below. | ||
command.derivedCommands.shadows.receiveCommand.execute(context, passState); | ||
} else { | ||
command.execute(context, passState); |
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.
All these changes are just reorganization without code edits. The debug show bounding volume code is just moved to its own function.
@@ -300,7 +302,7 @@ define([ | |||
this._globeDepth = globeDepth; | |||
this._depthPlane = new DepthPlane(); | |||
this._oit = oit; | |||
this._fxaa = new FXAA(); | |||
this._sceneFramebuffer = new SceneFramebuffer(); |
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.
The FXAA file was renamed to SceneFramebuffer and the FXAA specific stuff was moved to PostProcessLibrary
|
||
const float fxaaQualitySubpix = 0.5; | ||
const float fxaaQualityEdgeThreshold = 0.125; | ||
const float fxaaQualityEdgeThresholdMin = 0.0833; | ||
|
||
void main() | ||
{ | ||
vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw; |
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.
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.
Bump - in case this is important.
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.
This is fine for now. This would need to change for multiple viewports, but a lot more work would need to be done to get post-processing per-viewport.
@@ -0,0 +1,176 @@ | |||
define([ |
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.
This file is a placeholder for the AO in #5673
Quick summary of the code: A
More complicated effects like AO may require custom stages which "inherit" from
|
CC #5808 |
@lilleyse updated. This should be ready. |
Looks ready to me. I think this is safe to merge for 1.45 but can push if anyone prefers it wait. |
If we're confident this is pretty well isolated - taking into account OIT, sun bloom, etc.- and well tested, OK with me to merge for 1.45. Otherwise, let's not take the risk with everything else already going in, e.g., log depth, ion, etc. |
Example A: IE11 is completely broken in this branch. Cesium Viewer renders a black canvas. |
@lilleyse This is ready. I fixed the issues in IE and Edge. Depth textures aren't supported in IE so any stage added to the collection that requires a depth texture will not be run. If one stage in a composite won't run, then neither does any stage in the composite (also goes for composites of composites). Can you review this and #6476 soon? I'd like to merge then as soon as possible so they have a while to sit in master before the next release. |
Add a test that checks that post processing works as expected when depth textures are not supported. |
Should |
…ure to isSupported.
@lilleyse updated. |
Source/Scene/PostProcessStage.js
Outdated
* @see {Context#depthTexture} | ||
* @see {@link http://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/|WEBGL_depth_texture} | ||
*/ | ||
PostProcessStage.prototype.isSupported = function(context) { |
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.
Since it's part of the public API it should probably take scene
instead.
Annoyingly, there will probably need to be a duplicate function that takes context
, for internal use.
Source/Scene/PostProcessStage.js
Outdated
* @see {Context#depthTexture} | ||
* @see {@link http://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/|WEBGL_depth_texture} | ||
*/ | ||
PostProcessStage.prototype.isSupported = function(context) { |
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.
There are a few areas in the post processing code that check if ao is enabled by checking if depth textures are supported. Those areas should call this function instead.
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.
- https://github.com/AnalyticalGraphicsInc/cesium/pull/5615/files#diff-1eed62beb3641796599874a8801c8395R463
- https://github.com/AnalyticalGraphicsInc/cesium/pull/5615/files#diff-1eed62beb3641796599874a8801c8395R591
- https://github.com/AnalyticalGraphicsInc/cesium/pull/5615/files#diff-faf43159371dc6d497cba9acd00771cdR257
The new changes look good. I tested in as many browsers as I could (Chrome, Firefox, Edge, IE, Safari) and Safari on an iPad. Internet Explorer ignores unsupported post processing stages correctly. As a final safeguard, it might be good to check The only artifact that I noticed is AO graininess on the iPad. It used to be worse before 5e11e9e but it's still worth showing what's happening. Whether or not this is something we can fix, I don't know. Also there is a failing test in CI:
|
@lilleyse I fixed the test and updated the Sandcastles to report when a post process isn't supported. I think we should merge this and open a bug for the iOS issue. I'll look at it before the next release. I just want this to sit in master for a while |
Travis failed due to an unrelated failure in I'll look at #6476 soon as well. |
Ok it passed. Thanks @bagnell! |
A start for post processing effects in Cesium. I trimmed down this PR so it only applies to scene post-processing. Per-entity post processing will be ready soon too, but I want to keep this PR a bit simpler.
@byumjin
u_depthTexture
now works so you can test out SSAO. However it uses the last frustum's depth only! This actually works okay for some situations, but to guarantee that only one frustum is rendered, setscene.farToNearRatio
to a large number like100000000.0
.I'll bump again when this is ready to review.
To-do:
PostProcessLibrary
shaders in .glsl fileLINEAR
filtering on its texture, butPostProcess
usesNEAREST
for everythingConsolidate depth textures from all frustums, separate PRLog depth