Server-side styling involves storing shader definitions in a JSON column within your database. When running pg2b3dm, you specify which column contains these shaders using the --shaderscolumn option.
Default Material
If --shaderscolumn is not provided, a default PbrMetallicRoughness shader is used with these properties:
- BaseColor:
#FFFFFF (via --default_color) - MetallicRoughness:
#008000 (via --default_metallic_roughness). Metallic factor: 0, Roughness factor: 0.5019608 (128/255). - DoubleSided:
true (via --double_sided)
Material Priority (3DCityDB v5)
When 3DCityDB v5 texture data is detected, the priority is:
- Texture material (from
surface_data_mapping.texture_mapping + tex_image.image_data) - Shader material (
--shaderscolumn) - only used if no textures are active for that tile. - Default material - used if neither texture nor shader is available.
JSON Structure
The JSON document must follow this schema:
{
"EmissiveColors": [list_of_emissivecolors in hex],
"PbrMetallicRoughness": {
"BaseColors": [ list_of_basecolors in hex],
"MetallicRoughness": [list_of_metallic_roughness in hex]
},
"PbrSpecularGlossiness": {
"DiffuseColors": [list_of_diffuse in hex],
"SpecularGlossiness": [list_of_specular_glossiness in hex]
}
}
Note: PbrSpecularGlossiness is deprecated by Khronos; PbrMetallicRoughness is recommended.
{
"EmissiveColors": [list_of_emissivecolors in hex],
"PbrMetallicRoughness": {
"BaseColors": [ list_of_basecolors in hex],
"MetallicRoughness": [list_of_metallic_roughness in hex]
},
"PbrSpecularGlossiness": {
"DiffuseColors": [list_of_diffuse in hex],
"SpecularGlossiness": [list_of_specular_glossiness in hex]
}
}