iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.07k stars 290 forks source link

[PROPOSAL] Add option to mask points based on features #2307

Open HoloTheDrunk opened 3 months ago

HoloTheDrunk commented 3 months ago

Context

Making use of the points' information to selectively hide certain points from picking/rendering based on a user-provided condition would help develop more complex functionality much more easily without having to dig around inside iTowns itself. The simplest and likely most widely useful form of this is offering the option to hide points based on their classification.

Expected Behavior

The user should be able to provide, in its fullest form, a data structure describing conditions on which to ignore certain points or, in its simpler form, a list of classification values to ignore for example.

Actual Behavior

There is as far as I am aware no way to easily achieve this selective rendering using iTowns as of writing this issue;

Possible Cause/Fix/Solution

For the fullest form, the data structure would be converted into glsl code and written into the vertex shader before recompiling it. The simple form only requires passing a UBO containing the values to ignore to the shader. In either case, vertices output by the VS with vColor #000000 could then simply be discarded during the fragment shader;

The "fullest form" described above is a shot in the dark and the actual real-life usefulness of such a potentially over-engineered system must be given proper consideration.

jailln commented 3 months ago

That would be great indeed :) I think we should do it through the Style API, maybe by using a syntax similar to 3D Tiles Style. WDYT?

HoloTheDrunk commented 3 months ago

This looks nice if we are to implement a subset of the specification, but I am not in a position to make any decision. The GLSL shader generation shouldn't be too tricky even accounting for the UBO array padding issues, what do you think @Desplandis ? This is the relevant section.