Comments (7)
If it fixes the problem, we should make it an option on the LabelCollection. This requires a minor shader tweak. Do you want to try it? I can help you.
from cesium.
So I took a crack at it and it definitely makes text look way better. The "quick" test I did was change line 46 in BillboardCollectionVS.glsl from
gl_Position = agi_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
to
gl_Position = agi_viewportOrthographic * vec4(floor(positionWC.xy), -positionWC.z, 1.0);
Which now causes billboards to align to pixel. I assume the next step would be to add a set/get AlignToPixel method to Billboard and have billboard collection pass that to the shader. This would default to false, but LabelCollection would default it to true (since it uses a BillboardCollection underneath).
My main problem is that I have no idea what I'm doing. My first guess would be to turn originAndShow into originAndShowAndAlign and add a branching condition to call floor or not, based on the value of Alight, but I know branching conditions can be bad. Am I anywhere near close with my idea? How should I do this?
from cesium.
As long as the branch is coherent, I wouldn't worry about it. Coherence is
easy to define for fragment shaders in screen space, but is less obvious
for vertex shaders; however, I assume it is simply the order of vertices in
the draw call. For kicks, alignToPixel could be zero or one, and we could
do lerp(positionWC.xy, floor(positionWC.xy) , alignToPixel)
or other
tricks, but this isn't any better.
Can we just always align to a pixel? In what cases does this hurt visual
quality?
On Thu, May 10, 2012 at 6:48 PM, Matthew Amato <
[email protected]
wrote:
So I took a crack at it and it definitely makes text look way better. The
"quick" test I did was change line 46 in BillboardCollectionVS.glsl fromgl_Position = agi_viewportOrthographic * vec4(positionWC.xy,
-positionWC.z, 1.0);to
gl_Position = agi_viewportOrthographic * vec4(floor(positionWC.xy),
-positionWC.z, 1.0);Which now causes billboards to align to pixel. I assume the next step
would be to add a set/get AlignToPixel method to Billboard and have
billboard collection pass that to the shader. This would default to false,
but LabelCollection would default it to true (since it uses a
BillboardCollection underneath).My main problem is that I have no idea what I'm doing. My first guess
would be to turn originAndShow into originAndShowAndAlign and add a
branching condition to call floor or not, based on the value of Alight, but
I know branching conditions can be bad. Am I anywhere near close with my
idea? How should I do this?
Reply to this email directly or view it on GitHub:
from cesium.
Aligning to pixel can make moving billboards appear jumpy as they snap from pixel to pixel, I notice this on my machine. We may be able to get the "best of both worlds" by only rounding the y component. This will still make the text sharper, but also cut down on the jumpiness. I tried this out on my machine and I think it might be the best solution.
gl_Position = agi_viewportOrthographic * vec4(positionWC.x, floor(positionWC.y), -positionWC.z, 1.0);
from cesium.
Sounds like a good idea. We can always add an option later. If we add the
option, we can consider doing at the collection level, not per billboard.
This way we would not need to store the flag per vertex; instead, it would
be a uniform.
On Fri, May 11, 2012 at 11:40 AM, Matthew Amato <
[email protected]
wrote:
Aligning to pixel can make moving billboards appear jumpy as they snap
from pixel to pixel, I notice this on my machine. We may be able to get
the "best of both worlds" by only rounding the y component. This will
still make the text sharper, but also cut down on the jumpiness. I tried
this out on my machine and I think it might be the best solution.gl_Position = agi_viewportOrthographic * vec4(positionWC.x,
floor(positionWC.y), -positionWC.z, 1.0);
Reply to this email directly or view it on GitHub:
from cesium.
Cozzi, assuming there are no issues with my change, can you close this out? Thanks.
from cesium.
Looks good. Good catch updating the JavaScript code that is used to compute the screen-space position of a billboard.
from cesium.
Related Issues (20)
- Cesium Install Fails on Gentoo @Playwright HOT 3
- Create points and billboards set different colors, execute clear all entities, and then create again, the color of the point will apply the color of the billboard HOT 1
- How can set Material class->fabric->uniforms->texture in repeat Mode ?default is clamp HOT 1
- Billboards rendering partially in 2D at particular zoom level HOT 1
- strokeWidth setting does not take effect HOT 2
- Add serial numbers to each demo in Sandcastle HOT 1
- Two node_modules directories need to be added to.gitignore HOT 3
- Cesium3DTileset flickers in large data. HOT 3
- Add `cspell` checking
- Orthographic camera projection HOT 4
- Can the options in WebMapServiceImageryProvider support customTags field? HOT 6
- `Unhandled promise rejection: undefined thrown` in CI
- External tilesets are disallowed inside multiple contents
- valid glTF fails to load in CesiumJS HOT 3
- Can't find ion-sdk-widgets/Source/TransformEditor HOT 1
- RequetErrorEvent during Jest testing. HOT 1
- Request a function `Cartesian3.intersect` HOT 1
- Move `Viewer` functionality to `CesiumWidget` class HOT 1
- `WallGraphics`'s Property `outlineWidth` do not work HOT 2
- PostProcessStage not work correctly HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cesium.