CZML icon heading (orientation?)

680 views
Skip to first unread message

mortac8

unread,
Sep 10, 2012, 1:52:00 PM9/10/12
to cesiu...@googlegroups.com
I have a .kmz that uses a <heading> values coupled with an arrow icon to display movement patterns.  Is there any way I can apply the proper heading to the arrow icon?  Is it possible to use Orientations with icons?

Matthew Amato

unread,
Sep 10, 2012, 2:09:13 PM9/10/12
to cesiu...@googlegroups.com
Unfortunately, not yet. We plan on supporting this in the future and
are obviously always looking for contributors who would like to help
out. The first step would be to add a rotation property to Billboard
and update the shaders to use it. After that it's a matter of adding
CZML support for it and then adding code to handle it in the KML
translator. We also have more complicated use cases that involve more
properties than a simple heading, but I haven't had a chance to
discuss them on the wiki yet, perhaps I'll update the roadmap within
the next couple of days to include it.
> --
> 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/-/cDfm9RClyaIJ.
> 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.

mortac8

unread,
Sep 20, 2012, 8:48:23 PM9/20/12
to cesiu...@googlegroups.com
I think I can handle the Billboard properties and the CZML support and KML translation.  However I just tried messing with the shaders and that blows my mind a bit.  Any tips for applying a rotation to the shaders?  My WebGL skills don't exist yet.  

Thanks!

Patrick Cozzi

unread,
Sep 21, 2012, 6:05:02 PM9/21/12
to cesiu...@googlegroups.com
Hi Ashley,

To get started, in BillboardCollectionVS.glsl, replace

    vec2 halfSize = u_atlasSize * imageSize * 0.5 * scale * czm_highResolutionSnapScale;
    halfSize *= ((direction * 2.0) - 1.0);

    positionWC.xy += (origin * abs(halfSize)) + halfSize;
    positionWC.xy += (pixelOffset * czm_highResolutionSnapScale);
    positionWC.xy = mix(positionWC.xy, floor(positionWC.xy), u_clampToPixel);

with

    vec2 halfSize = u_atlasSize * imageSize * 0.5 * scale * czm_highResolutionSnapScale;
    halfSize *= ((direction * 2.0) - 1.0);

    float theta = 30.0 * czm_radiansPerDegree;
    mat2 rotation = mat2(
        cos(theta), sin(theta),
       -sin(theta), cos(theta));
    halfSize = rotation * halfSize;       

    positionWC.xy += (origin * abs(halfSize)) + halfSize;
    positionWC.xy += (pixelOffset * czm_highResolutionSnapScale);
    positionWC.xy = mix(positionWC.xy, floor(positionWC.xy), u_clampToPixel);

Here we construct a 2x2 rotation matrix that rotates 30 degrees counter-clockwise in screen-space.  I assume you'll want to define rotation per-billboard, which means you'll want to add a new attribute to the top of the shader, and then pass the data in as done for the other attributes in BillboardCollection.js.

Given all the optimizations, it will be a bit of work but not too hard; however, there is one subtle problem:  the guaranteed minimum number of vertex attributes by WebGL is 8, and billboards are already using 8.  If we exceed this, we are not guaranteed to run on all WebGL implementations.  Check out WebGL Report.  Most desktops have 16, so it might be OK for your case, but for the general case, we need to look more closely at combing and/or eliminating attributes.  I will actually look at this a bit next week for another billboard feature, but I'm not sure that I'll take it far enough to support any number of attributes.

Regards,
Patrick


To view this discussion on the web visit https://groups.google.com/d/msg/cesium-dev/-/uvm7VSEpkyIJ.

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.

David Hite

unread,
Apr 2, 2013, 2:44:13 PM4/2/13
to cesiu...@googlegroups.com
Hi,
Has any work been done on adding orientation to icons (billboards)?
-Dave

Patrick Cozzi

unread,
Apr 3, 2013, 11:32:39 AM4/3/13
to cesiu...@googlegroups.com
Hi Dave,

I don't believe anyone has worked on this yet.  If you need something quick, it shouldn't be too hard to tweak the billboards as I described earlier.

Patrick

Daniel Bagnell

unread,
Jun 17, 2013, 2:39:31 PM6/17/13
to cesiu...@googlegroups.com
Hi Dave,

Billboard rotation and orientation are now available in master and will be in the next release. There is an aligned axis property that is a unit vector in world space that will define the billboards up direction. For example, setting this property to the unit z direction will make the billboards up direction point towards the north pole.

Regards,
Dan

David Hite

unread,
Jul 22, 2013, 5:15:09 PM7/22/13
to cesiu...@googlegroups.com
Hi Dan,
Thanks for the update! Is orientation support added to czml too?
-Dave

Scott Hunter

unread,
Jul 23, 2013, 10:18:44 AM7/23/13
to cesiu...@googlegroups.com
Yes, the alignedAxis property is available in CZML.

Hugo Pinto

unread,
Aug 25, 2013, 8:55:52 AM8/25/13
to cesiu...@googlegroups.com
Hi All, 

I'm trying to get this to work in a CZML file we're producing but can't quite get the configuration right, nor can I find it in either the Specs nor Sandcastle. 

Could I please ask for a patient soul to write just a simple CZML "orientation" property snippet that includes axis aligned heading or orientation?

Thanks in advance,

Hugo

Hugo Pinto

unread,
Aug 25, 2013, 10:44:24 AM8/25/13
to cesiu...@googlegroups.com
Ok, 

Nevermind the question - I was looking in the wrong place. 

It turns out I was expecting the alignedAxis to be a sub-property of the "orientation" property,, but it was actually under DynamicBillboard. 

(I was also looking under https://github.com/AnalyticalGraphicsInc/cesium/wiki/CZML-Content but that's outdated and the property was nowhere to be found).

A quick glance at the code, and, alas, alignedAxis is actually a property of DynamicBillboard, and my code is now working. 

Best,

Hugo
Reply all
Reply to author
Forward
0 new messages