How to change from 3D to 2D, Columbus view?

3,264 views
Skip to first unread message

Chris Shenton

unread,
Sep 26, 2012, 10:42:22 AM9/26/12
to cesiu...@googlegroups.com
The Cesium Wiki architecture document talks about changing the scene view easily:

A scene can be 3D, 2D, or columbus view. A scene can morph between these views with one line of code.

I've searched the docs and the combined JS code, and can't see how this is done. The default 3D view is working beautifully.  But if I try:

scene.mode = Cesium.SceneMode.SCENE2D;

I get a black screen.  If I try:

scene.mode = Cesium.SceneMode.COLUMBUS_VIEW;

I get my 3D globe (not a flat-ish projection), but my billboard of satellites is now a sinusoidal shape (as I'd expect from a 2D projection) rather than the 3D ring shown in the SCENE3D view. I'm not understanding how to render the CentralBody in the different views.  An example in the Architecture doc would help.


Sorry for my ignorance on Cesium. Hopefully I can turn my ignorance into documentation pull requests at some point.

Thanks.



Patrick Cozzi

unread,
Sep 26, 2012, 10:52:42 AM9/26/12
to cesiu...@googlegroups.com
Hi Chris,

Create a SceneTransitioner object:

var transitioner = new SceneTransitioner(scene);

And then morph to different modes using morphTo functions:

transitioner.morphTo2D();
transitioner.morphTo3D();
transitioner.morphToColumbusView();

For an example, see Source/Widgets/Dojo/CesiumViewerWidget.js.

As you suggest, documentation contributes are very welcome.

Regards,
Patrick





--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cesium-dev/-/GwPfhoqdr3YJ.
To post to this group, send email to cesiu...@googlegroups.com.
To unsubscribe from this group, send email to cesium-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cesium-dev?hl=en.



--
www.seas.upenn.edu/~pcozzi/

Matthew Amato

unread,
Sep 26, 2012, 10:55:39 AM9/26/12
to cesiu...@googlegroups.com
The piece you're missing is the SceneTransitioner class.  This class isn't well documented but is simple enough that you can just look at the code for reference.  Here's some examples:

var transitioner = new SceneTransitioner(scene)

transitioner.morphDuration2D = 1000; //set morph to 1 second long
transitioner.morphDurationColumbusView();  //morphing affect

transitioner.to2D();  //immediate switch, no morph

2D and Columbus modes (as we ll as scene transitioning) still have a lot of work left to be done, which is why it's not as polished as some other areas.  For example camera position is lost after switching modes and using the camera programmatically in different modes is a little tricky.  This should get your started in the mean time though and we're happy to answer any questions.

Matt

On Wed, Sep 26, 2012 at 10:42 AM, Chris Shenton <ch...@koansys.com> wrote:

Chris Shenton

unread,
Sep 26, 2012, 3:22:19 PM9/26/12
to cesiu...@googlegroups.com


On Wednesday, September 26, 2012 10:52:43 AM UTC-4, Patrick Cozzi wrote:
Hi Chris,

Create a SceneTransitioner object:

var transitioner = new SceneTransitioner(scene);

And then morph to different modes using morphTo functions:

transitioner.morphTo2D();
transitioner.morphTo3D();
transitioner.morphToColumbusView();

That's *beautiful*.  Thanks! :-) 

David Taylor

unread,
Aug 4, 2014, 12:20:48 PM8/4/14
to cesiu...@googlegroups.com
How did you get it to work? I just want it to start with Columbus view as default. morph is doing nothing for me. Here is my code

var viewer = new Cesium.Viewer('cesiumContainer');
var transitioner = new SceneTransitioner(viewer.scene);
transitioner
.morphToColumbusView();

da...@ferg.co

unread,
Aug 4, 2014, 12:40:10 PM8/4/14
to cesiu...@googlegroups.com
SceneTransitioner has been removed from the API.

morphTo2D(), morphTo3D(), and morphToColumbusView() are all part of Viewer.Scene now

Matthew Amato

unread,
Aug 4, 2014, 9:59:04 PM8/4/14
to cesiu...@googlegroups.com
If you're using Viewer or CesiumWidget and want to start in a specific scene mode, you can just pass an option to the constructor:

var viewer = new Cesium.Viewer('cesiumContainer', {
    sceneMode : Cesium.SceneMode.COLUMBUS_VIEW
});



--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Taylor

unread,
Aug 5, 2014, 5:48:19 PM8/5/14
to cesiu...@googlegroups.com
awesome thats great thanks!
Reply all
Reply to author
Forward
0 new messages