scene3DOnly 'true' not working

Hello Cesium team,

I have updated my application with Cesium 1.12 version(minified) set scene3DOnly as 'true' but still I am able to switch 2D, Columbus views from 3D. For non-minified version of same 1.12 version i am not getting this problem.

Could you please tell me know what is the reason behind it?
And is there any option to load only 2D or Columbus views like scene3DOnly ?

Thanks,
Raghu

I can’t reproduce the problem you are seeing. Running a Sandcastle example with the below line behaves as expected:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {scene3DOnly : true});

This gets rid of the SceneModePicker and puts the engine in scene3DOnly mode. If I try and programatically switch to another mode, for example with either line below, I get the expected exception telling me 2D and CV are not available.

viewer.scene.mode = Cesium.SceneMode.SCENE2D;

viewer.scene.morphTo2D();

The scene3DOnly setting exists so that we can skip extra work that needs to be done for 2D and CV modes in order to improve performance (for example, large-scale geometry creation can be faster if scene3DOnly is enabled). There’s no “extra work” that needs to be skipped if you are only using 2D or CV modes, so having an option for these doesn’t make sense. If you want your app to be 2D or CV only, just get rid of the sceneModePicker and set your mode at start up. For example:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

sceneMode : Cesium.SceneMode.SCENE2D,

sceneModePicker : false

});

Hi Matthew,

When I use CesiumUnminified version its throwing exception while programmatically swith the mode, the problem exists with minified version currently I am using.

Thanks,
Raghu.

That’s actually the expected behavior. The minified version of Cesium removes lots of extra error checking in order to improve performance so programatically switching modes may still work in some cases (such as an empty map). The official recommendation of the Cesium team is to develop against the unminified version and only use the minified version of release.

Thanks Matthew.

And actually I am loading 20k data of linestring and I could able to see it on Map when Scene3DOnly set as true.

The same data is giving Invalid array buffer length error when initializing map with 2D/CV scene mode. So is it internally creating the objects for all scene modes as well even i am in 2D scene..?

Thanks,
Raghu

The same primitives are used for all 3 scene modes, but the difference is that when scene3DOnly is set, we simply don’t compute some of the extra data that’s needed for other modes, which would result in problems if you try and use them. Line strings in particular need to be broken up at the edge of the map and split into 2 (or more) when in 2D or CV. While there are definitely more places we can optimize for scene3DOnly, most of it is currently related to Primitive geometry like that.

So if you only care about 3D, definitely set scene3DOnly, but just make sure you’re app really only plans on using that mode.