Option --shaderscolumn deprecated
Notice: Option --shaderscolumn is deprecated and will be removed in a upcoming release (breaking change)
With option shaderscolumn it's possible to define the shader per triangle in the database, using a predefined JSON format. See https://github.com/Geodan/pg2b3dm/blob/master/styling.md
Although a very powerful mechanism, reasons for deprecation are:
-
function is not used much;
-
function is complex and slows down new developments;
-
function does not work when triangulation is performed by pg2b3dm (for example with lines or non triangulated geometries)
Alternative options are:
-
Set styling options for the complete tileset --default_color, --default_metallic_roughness;
-
Use client side styling, see https://github.com/Geodan/pg2b3dm/blob/master/styling.md#client-side-styling.
PR see https://github.com/Geodan/pg2b3dm/pull/172
hello do I understand correctly that this PR will break usage of tesselate_building that sets shaders column? so it is planned that tesselate_building with pg2b3dm will create buildings with uniform color?
my use case can't use client-style styling because the output is intended for Cesium for Unreal which doesn't support that yet https://github.com/CesiumGS/cesium-unreal/issues/1392
yeah it's a breaking change with result uniform styled geometries, good to you know you are using this feature. This change might need some reconsideration. Are you using different styling for building roofs and walls?
I don't have any particular data, but I was told by superior that its wanted feature and I already made REST API that wraps this conversion that can color features by attribute mapping, attribute intervals and interval to color interpolation, and configuration can be different for roof, wall and floor. I will ask them to participate in this conversation.
I think it would be better if it was possible to style it on client side, but it's just not supported in cesium for unreal.
As alternative I’m thinking to have 1 style per geometry (so not 1 style per triangle) that would reduce complexity and work in all cases
what is geometry in this context? a polygon?
yes one of the input geometry types LineStrings/Polygon/MultiPolygon/PolyhedralSurface/TIN
Input table in this case will look like:
| Geometry | Shader |
|---|---|
| polygon1 | {'PbrMetallicRoughness': {'BaseColor': ['#008000']}} |
| polygon2 | {'PbrMetallicRoughness': {'BaseColor': ['#00FFFF']}} |
Will this work for you?
yes, thank you
@bertt Yes, I agree with @mittermichal. Coloring each polygon differently would be very beneficial for us. Anyway, does the deprecation of shaderscolumn mean you plan to deprecate tesselate_building in the future?
Thanks for your awesome libraries! ❤️
@ivopisarovic I'm thinking if the above solution is in place (with 1 style per geometry) to rewrite the tesselate_building tool a bit, so for each building there will be 3 geometries in the table (for roof, walls, floor) with an extra attribute for the type. The style can then be set in the style column. Would that work for you?
Note it will take some time to implement these changes so for now the current solution will still work.
@bertt Sure, it would be awesome! :) No problem it will take time. We can help with testing later if you need.
I've found another non breaking solution:
For geometry collection types like MultiLine, MultiPolygon and PolyHedralSurface there is a new possibility to have a shader per inner geometry.
For example consider a Multipolygon geometry of 2 squares:
MULTIPOLYGON Z(((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),((2 2 0, 2 3 0, 3 3 0, 3 2 0, 2 2 0)))
The number of shaders can be:
- 1: all triangles are styled with the same shader;
- 2: each square is styled with a different shader; (This is the Added method)
- 4: each triangle of each square is styled with a different shader.
Tool tesselate_building will still work the same, but can be simplified (by making use of this new method).
See https://github.com/Geodan/pg2b3dm/pull/188 for the changes involved.
Closing this issue.
do I understand correctly that the order of geometry in geometry collection corresponds to order in shadercolumn BaseColors list?
yep