Skip to content

Commit

Permalink
Merge pull request #12158 from CesiumGS/msaa-default-on
Browse files Browse the repository at this point in the history
Enable MSAA by default
  • Loading branch information
ggetz authored Aug 27, 2024
2 parents fd7eb81 + e37ea20 commit 088c4a2
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Apps/Sandcastle/gallery/Bathymetry.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@

const scene = viewer.scene;

// prevent aliasing from countour lines
scene.msaaSamples = 4;

const globe = scene.globe;
globe.enableLighting = true;
globe.maximumScreenSpaceError = 1.0; // Load higher resolution tiles for better seafloor shading
Expand Down
1 change: 0 additions & 1 deletion Apps/Sandcastle/gallery/I3S Building Scene Layer.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ <h1>Loading...</h1>
animation: false,
timeline: false,
orderIndependentTranslucency: false,
msaaSamples: 4, // enables multisample antialiasing for improved visual quality
});

// More datasets to tour can be added here...
Expand Down
1 change: 0 additions & 1 deletion Apps/Sandcastle/gallery/Japan Buildings.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
sceneModePicker: false,
animation: false,
timeline: false,
msaaSamples: 4,
});
const scene = viewer.scene;
scene.globe.depthTestAgainstTerrain = true;
Expand Down
2 changes: 0 additions & 2 deletions Apps/Sandcastle/gallery/glTF PBR Extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
);
}

scene.msaaSamples = 4;

const height = 20.0;
const hpr = new Cesium.HeadingPitchRoll(0.0, 0.0, 0.0);
const origin = Cesium.Cartesian3.fromDegrees(
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

##### Additions :tada:

- Enable MSAA by default with 4 samples. To turn MSAA off set `scene.msaaSamples = 1` [#12158](https://github.com/CesiumGS/cesium/pull/12158)
- Made the `time` parameter optional for `Property`, using `JulianDate.now()` as default. [#12099](https://github.com/CesiumGS/cesium/pull/12099)

- Exposes `ScreenSpaceCameraController.zoomFactor` to allow adjusting the zoom factor (speed). [#9145](https://github.com/CesiumGS/cesium/pull/9145)

##### Fixes :wrench:
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const requestRenderAfterFrame = function (scene) {
* @param {boolean} [options.requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
* @param {number} [options.maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
* @param {number} [options.depthPlaneEllipsoidOffset=0.0] Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
* @param {number} [options.msaaSamples=1] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets.
* @param {number} [options.msaaSamples=4] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.
*
* @see CesiumWidget
* @see {@link http://www.khronos.org/registry/webgl/specs/latest/#5.2|WebGLContextAttributes}
Expand Down Expand Up @@ -228,7 +228,7 @@ function Scene(options) {
this._minimumDisableDepthTestDistance = 0.0;
this._debugInspector = new DebugInspector();

this._msaaSamples = defaultValue(options.msaaSamples, 1);
this._msaaSamples = defaultValue(options.msaaSamples, 4);

/**
* Exceptions occurring in <code>render</code> are always caught in order to raise the
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Widget/CesiumWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function configureCameraFrustum(widget) {
* @param {boolean} [options.blurActiveElementOnCanvasFocus=true] If true, the active element will blur when the viewer's canvas is clicked. Setting this to false is useful for cases when the canvas is clicked only for retrieving position or an entity data without actually meaning to set the canvas to be the active element.
* @param {boolean} [options.requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
* @param {number} [options.maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
* @param {number} [options.msaaSamples=1] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets.
* @param {number} [options.msaaSamples=4] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.
*
* @exception {DeveloperError} Element with id "container" does not exist in the document.
*
Expand Down
1 change: 1 addition & 0 deletions packages/engine/Specs/Scene/SceneSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe(
expect(scene.mapProjection).toBeInstanceOf(GeographicProjection);
expect(scene.frameState).toBeInstanceOf(FrameState);
expect(scene.tweens).toBeInstanceOf(TweenCollection);
expect(scene.msaaSamples).toEqual(4);

const contextAttributes = scene.context._gl.getContextAttributes();
// Do not check depth and antialias since they are requests not requirements
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/Source/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function enableVRUI(viewer, enabled) {
* @property {boolean} [requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
* @property {number} [maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
* @property {number} [depthPlaneEllipsoidOffset=0.0] Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
* @property {number} [msaaSamples=1] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets.
* @property {number} [msaaSamples=4] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.
*/

/**
Expand Down

0 comments on commit 088c4a2

Please sign in to comment.