[Feat] 'pixels'-like unit without depth scaling
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Target Use Case
The 'pixels' unit is frequently used to draw features with a fixed screen size. As per the documentation, a scaling factor is applied when the pitch is non-zero in other to provide a sense of depth. While for the mapping use-case (where the pitch is often constrained) this is valid, for other situations the effect is not desirable and confusing for users, especially when dealing with Point Clouds where the camera can often point at the horizon, resulting in huge features near the camera.
The source of this behavior is the projection shader code which sets the gl_Position.w to a different value depending on the depth in clip space. The project_pixel_size_to_clipspace function doesn't take this into account and only applies the offset to gl_Position.xy
Proposal
It is possible to workaround this behavior by modifying the shader (see demo: https://jsfiddle.net/felixp/5kj497mw/)
class FixedSizeExtension extends LayerExtension {
getShaders() {
return {
inject: {
'vs:DECKGL_FILTER_SIZE': 'size *= 0.7 * gl_Position.w;'
}
};
}
}
However this isn't very clean, and it would be nice if deck supported a unit which used pixels without the depth scaling.
I'm not sure what is the best name to use, as we want to keep 'pixels' back-compatible, perhaps sizeUnits: 'screen' or sizeUnits: 'static'?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the coordinate-systems documentation and the projection shader code described in the issue, then compare the existing 'pixels' behavior with the provided FixedSizeExtension demo. Define how a new non-depth-scaled unit should behave while preserving 'pixels' compatibility, and verify the result for point-cloud views near the horizon.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics, data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100