-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PointPrimitive and PointPrimitiveCollection #2632
Conversation
Thanks for this. I've also thought about introducing something like this
since there is a cost for how general billboards are.
I'd like to look at this before it's merged - just a heads up that I won't
be able to until next week.
|
No rush. This is large and changes existing behavior, so it needs thorough review. |
pointPrimitive.color = Property.getValueOrDefault(pointGraphics._color, time, defaultColor, color); | ||
pointPrimitive.outlineColor = Property.getValueOrDefault(pointGraphics._outlineColor, time, defaultOutlineColor, outlineColor); | ||
pointPrimitive.outlineWidth = Property.getValueOrDefault(pointGraphics._outlineWidth, time, defaultOutlineWidth); | ||
pointPrimitive.pixelSize = Property.getValueOrDefault(pointGraphics._pixelSize, time, defaultPixelSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to add a scene.clampPointSize
similar to scene.clampLineWidth
to avoid assigning a size the card/drivers don't support. I also assume all cards have fairly large maximums?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've added this to the vertex shader, where in the most recent version this takes place after outline width and scale-by-distance effects have been included in the total glPointSize.
The typical size limits are shown on the very bottom chart on webglstats.com. Looks like the availability of extra-large (1023px) points has grown substantially in just the past year. Typical CZML point size real-world uses are far below 63 pixels, so they read as above 99% availability on this chart.
Just an FYI, the main reason for the visual difference is #2130, once that is fixed, the points should look equally good in both cases (though this will probably be in master before then, so the point is moot). |
Another demo: 1 million pointPrimitives scaled by distance. Give it time to load, and keep an eye on the Sandcastle console tab. |
Sorry @emackey, it will be this weekend, really. |
The billboard collection could also use a single draw call. I actually wrote it so long ago that |
@emackey did you run code coverage? What is it? I'm on Mac. |
'../Core/Cartesian3', | ||
'../Core/Cartesian4', | ||
'../Core/Color', | ||
'../Core/createGuid', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't used.
If we want this to make 1.9, I would want to merge it by Wednesday. 1.10 would also be fine for this. |
Conflicts: Source/Scene/BillboardCollection.js
This has 1.9 merged into it now, and is ready to go. |
I added point/terrain clamping to #2685. |
varying vec4 v_pickColor; | ||
#endif | ||
|
||
float getNearFarScalar(vec4 nearFarScalar, float cameraDistSq) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this a czm_
function that is shared with billboards and has a unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Is there any way to unit test a czm function directly? I don't see tests for any of the other czm_
functions. PointPrimitiveCollectionSpec
does contain tests for scaleByDistance
and translucencyByDistance
which will make use of this once it's shared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate question, is there any way to build documentation that includes czm
?
@emackey what is test coverage for |
That's all I got. This looks good otherwise. Thanks for all the work, @emackey. |
Test coverage is fairly complete, actually I just found and fixed a hole in |
As far as I can tell, we have tests for Automatic Uniforms, but no tests for The functionality of the new This is ready. |
We don't have tests for all of the builtin functions, but the ones we do have can be found in BuiltinFunctionsSpec.js |
Thanks @bagnell. Test added. Ready. |
Looks great, thanks again @emackey. |
PointPrimitive and PointPrimitiveCollection
This PR adds two new classes
PointPrimitive
andPointPrimitiveCollection
. It does not make any changes to theEntity.point
API, however the back end ofEntity.point
is now connected to the newPointPrimitive
system instead of billboards. This means that existing Entity and CZML points will automatically make use of the new system, with no changes.PointPrimitive
and its collection are similar toBillboard
and its collection, with the following differences:PointPrimitive
usesglPointSize
instead of textured quads (for 1/4th the vertices and no indicies).PointPrimitive
does not have any image or texture atlas system at all.PointPrimitive
does not supportEyeOffset
,PixelOffset
, orPixelOffsetScaleByDistance
.PointPrimitive
directly supports concepts fromEntity.point
, such as outline color/width.PointPrimitiveCollection
uses a single draw call, as opposed toBillboardCollection
's 16k billboards per draw due to 16-bit indicies (64k verts per draw, at 4 verts per billboard).PointPrimitiveCollection
does not suffer from ascale
value being mismatched with a raster image of a circle of the wrong size.That last claim is perhaps subjective, so I'll attach some screenshots of a CZML file from SatelliteViewer. Here it is in master, with Billboards, followed by the same with PointPrimitives from this PR:
Additional performance testing of this branch is most welcome. The biggest gains seen thus far are mostly in the creation of points, although the rendering does appear to yield a small percentage gain in FPS as well.
Here is a Gist of a Sandcastle demo that will create arbitrary numbers of PointPrimitives or Billboards, based on a number and a flag at the top of the file. Generally I find that creating PointPrimitives is an order of magnitude or so faster than creating the same number of Billboards. My machine will crash a Chrome tab if I ask for more than about 400k Billboards, but will let me render about 800k PointPrimitives at the high end.