Google Earth and Cesium examples

483 views
Skip to first unread message

Patrick Cozzi

unread,
Feb 10, 2015, 11:36:02 AM2/10/15
to cesiu...@googlegroups.com
Folks,

To help developers move from Google Earth to Cesium, we ported 30 Google Earth examples and demos to Cesium:


This includes the most popular Google Earth demo, the Monster Milktruck:


Try it.  It's fun to catch air off the cliffs in the Grand Canyon.

We also added a second tutorial for Google Earth developers, which is available here:


Please help spread the word.

Patrick
--

Hyper Sonic

unread,
Feb 10, 2015, 12:59:17 PM2/10/15
to cesiu...@googlegroups.com
Thanks for the links. Do all or most of those 30 examples have editable sandcastle counterparts? I noticed it only showed non-editable relevant code on those links.

The Monster Milktruck example is definitely fun! It seems to be sampling terrain height every frame and obtaining results quickly. I don't see any promise/whens, just globe.getHeight. It also seems to be getting surface normal information used to orient the truck and determine travel and bounce direction.
Message has been deleted

Hyper Sonic

unread,
Feb 10, 2015, 2:23:03 PM2/10/15
to cesiu...@googlegroups.com
Apparently it's approximating the normal using a function called estimateGroundNormal by sampling altitude 1 unit away in the 4 cardinal directions. Clever idea. The graph is mis-labeled though, should be 0=east,1=west,2=north,3=south.

Berwyn McKilligan

unread,
Feb 10, 2015, 3:56:29 PM2/10/15
to cesiu...@googlegroups.com
Thanks

This will definitely be of great use for folks making the transition

for the examples of pin dragging, hittest, drawing  ect...  it may be useful to turn on terrain  or have a second example with terrain to show the use of getPickRay, similar to the 'Retrieving Ground Altitude Data' example 


var ray = viewer.camera.getPickRay(movement.endPosition),
                            cartesian = scene.globe.pick(ray,scene);


Kevin Ring

unread,
Feb 10, 2015, 6:55:32 PM2/10/15
to cesiu...@googlegroups.com
This is great, nice work guys!

Some feedback on the "Ground Altitude Data" example.  The method this example uses for querying terrain heights is kind of ok when you're zoomed in, but it returns total nonsense when you're zoomed out.  To see what I mean, zoom out until the entire globe is visible and then hover the cursor in the Pacific ocean off the coast of California.  Cesium reports heights like -40k kilometers.

This is because low detail triangles cut deeply through the Earth.  You can improve this somewhat by interpolating heights instead of positions.  Figure out what triangle you're in, get the heights at each of the three vertices of the triangle, find your barycentric coordinates within the triangle, interpolate the height at those barycentric coordinates.  This gives better results, but still not amazing.

In National Map we go a step further and report a height +/- error bounds while moving the mouse, and then do an accurate height sample when the mouse stops moving.

Code for both techniques is here if it helps:

Note that I had to add a pickTriangle method to Cesium's Globe.  pickTriangle is identical to pick except that it also returns the vertices of the triangle that the pick hit instead of just the Cartesian location.  Code for that is in the "nm" Cesium branch.

Kevin

--
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.



--

Hyper Sonic

unread,
Feb 11, 2015, 11:41:46 AM2/11/15
to cesiu...@googlegroups.com
The pickTriangle function sounds great. It would then be easy to obtain the triangle's normal by crossing 2 of its edges.

I did notice this line in the Monster Milktruck demo
"// TODO: would be nice to have globe.getGroundNormal() in the API."

Monster Milktruck's sampling heights on 4 nearby locations to determine the normal isn't particularly efficient. Having access to the 3 vertices of the triangle would be much better.

Matt Whalley

unread,
Feb 11, 2015, 1:02:04 PM2/11/15
to cesiu...@googlegroups.com
One difference I've noticed is that ge.ALTITUDE_ABSOLUTE in GE is MSL and the altitude in Cesium is WGS84 (the difference is called undulation). When transitioning code from GE to Cesium one needs to account for this difference.

Matthew Amato

unread,
Feb 11, 2015, 1:16:31 PM2/11/15
to cesiu...@googlegroups.com
Matt, while you're definitely correct, I wanted to add that support for various altitude modes is on the near term roadmap so this won't be a problem for long.

--

Patrick Cozzi

unread,
Feb 11, 2015, 4:14:45 PM2/11/15
to cesiu...@googlegroups.com

> @Hyper: "Do all or most of those 30 examples have editable sandcastle counterparts? I noticed it only showed non-editable relevant code on those links."

No, but you should be able to copy and paste into Sandcastle with little trouble.  You can also view source to see the complete example.

@Matt, thanks. We'll mention it in the tutorial.

Patrick
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages