Scene models

Updated at:
Copy as MD

GanosBase Scene is a storage structure for 3D models, built as a spatio-temporal engine extension for PolarDB for PostgreSQL (Compatible with Oracle). It stores rich 3D model data—materials, textures, skeletons, and animations—and supports spatial queries, analysis, and rendering at city scale.

For SQL function references, see Scene SQL references.

Features

  • Unified scene data management: GanosBase Scene manages oblique photography and glTF data in a unified storage model. It uses multi-level data views to store large objects and improve read and write performance.

  • Coordinate system support: GanosBase Scene enhances support for Earth-centered Earth-fixed (ECEF) and east-north-up (ENU) coordinates, enabling centralized processing and analysis of geographic coordinates and 3D scene data.

  • Advanced spatial operations: GanosBase Scene supports spatial relationship identification, closed clipping, geometric simplification, and texture reorganization. This enables retrieval and viewing of massive city-level 3D scene data in seconds.

  • Multi-format compatibility: GanosBase Scene is compatible with OSGB, glTF, and GLB data formats.

Key concepts

Supported data formats

GanosBase Scene provides two native 3D data types: glTF and OSGB. It also supports the GLB binary variant of glTF as a compatible format.

glTF

GL Transmission Format (glTF) is an open standard designed to reduce the size of 3D assets and the time required to load and use them. glTF stores 3D model data in JSON and uses the .gltf (JSON/ASCII) or .glb (binary) file extension. Both formats can reference external binary data and texture resources.

glTF supports geometry, appearance, scene graph hierarchy, and animation. It is cross-platform and defined by the Khronos Group—the organization behind OpenGL and Vulkan—making it the de facto standard for 3D assets on the web.

OSGB

OpenSceneGraph Binary (OSGB) is the native binary format of OpenSceneGraph, an open-source 3D graphics rendering engine. OSGB encodes scene data including geometry, materials, textures, lighting, and animation. It supports high-performance I/O, compression, and random access, and is widely used in visual simulation, gaming, virtual reality, and scientific visualization and modeling.

Spatial reference system

A spatial reference system (SRS) defines how a Scene object maps to a location on Earth's surface. GanosBase uses an integer SRID to reference an SRS definition. Each Scene object carries its own SRID value.

For details, see Spatial reference.

scene_columns view

The scene_columns view lists all Scene-type columns in the current database. It follows the Open Geospatial Consortium (OGC) Simple Features Specification for SQL and can be extended.

Column Type Description
f_table_catalog varchar(256) Database name
f_table_schema name Schema of the table
f_table_name name Table name
f_scene_column name Name of the Scene-type column

To list all Scene-type columns in the current database:

SELECT * FROM scene_columns;

Spatial index

GanosBase provides Generalized Search Tree (GiST) indexes for Scene data. GiST operates on bounding boxes, which makes it well suited for spatial relationship queries—such as intersection and inclusion—on large 3D datasets, without requiring a full sequential scan.

Index Description
GiST Fast spatial relationship queries based on bounding boxes; the standard spatial index method for Scene data

To create a GiST index:

CREATE INDEX <index_name>
ON <table_name>
USING GIST(<column_name>);

Use cases

Oblique photography management and visualization

Oblique photography is the primary source of 3D basemap data in surveying and mapping. GanosBase Scene imports, stores, and processes oblique photography data natively. Store raw data in Object Storage Service (OSS) and build Scene types in the database—this separates storage from compute and avoids data redundancy while keeping spatial queries, analysis, and rendering cost-effective.

osgb_visualization.gif

Spatial data mining

GanosBase Scene supports cross-model spatial relationship queries. Common use cases include:

  • Detecting whether buildings overlap (3D intersection)

  • Finding all buildings within a geographic range (spatial inclusion)

  • Extracting geometry and surface attributes of a specific structure—such as a building on a campus—for downstream analysis

image

Campus and urban planning

GanosBase Scene runs advanced spatial analysis entirely in the database, reducing GPU resource consumption:

  • Visibility analysis: determine camera placement on a campus, or assess sightlines for event security planning

  • Shadow ratio analysis: evaluate solar exposure for building or solar power station site selection

Lightweight preprocessing functions—3D model simplification, and texture clipping and simplification—reduce model complexity before frontend rendering, improving performance for upper-layer applications.

viewshed.gifshadow_ratio.gif

Quick start

This section covers the full workflow: creating the extension, creating a table, inserting data, querying, creating an index, and running spatial queries.

Prerequisites

Before you begin, make sure you have:

  • A PolarDB for PostgreSQL (Compatible with Oracle) instance

  • Superuser or extension-creation privileges on the target database

Create the extension

CREATE EXTENSION Ganos_scene CASCADE;
Note

Create the extension in the public schema to avoid permission issues.

CREATE EXTENSION Ganos_scene WITH SCHEMA public CASCADE;

Create a table

CREATE TABLE t_scene (
  id   integer,
  data scene
);

Insert data

Insert three glTF scene objects into the table:

INSERT INTO t_scene (id, data)
VALUES
  (1, '{"type" : "gltf", "affine" : [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], "content" : {"accessors":[{"bufferView":0,"componentType":5126,"count":42,"max":[1.0,1.0,1.0],"min":[-1.0,-1.0,-1.0],"type":"VEC3"},{"bufferView":1,"componentType":5126,"count":42,"max":[1.0,1.0,1.0],"min":[-1.0,-1.0,-1.0],"type":"VEC3"},{"bufferView":2,"componentType":5126,"count":42,"max":[0.0],"min":[0.0],"type":"SCALAR"},{"bufferView":3,"componentType":5121,"count":240,"max":[41],"min":[0],"type":"SCALAR"}],"asset":{"generator":"Ganos Scene","version":"2.0"},"bufferViews":[{"buffer":0,"byteLength":504,"target":34962},{"buffer":0,"byteLength":504,"byteOffset":504,"target":34962},{"buffer":0,"byteLength":168,"byteOffset":1008,"target":34962},{"buffer":0,"byteLength":240,"byteOffset":1176,"target":34963}],"buffers":[{"byteLength":1416,"uri":"data:application/octet-stream;base64,AAAAAAAAgD8AAAAAAAAAP70bTz96N54+AAAAP70bTz96N56+AAAAAEDEWT9Qlga/AAAAAEDEWT9QlgY/QMRZP1CWBj8AAAAAAAAAv70bTz96N56+AAAAv70bTz96N54+QMRZv1CWBj8AAAAAAAAAAAAAgL8AAAAAAAAAP70bT796N56+AAAAP70bT796N54+AAAAAEDEWb9QlgY/AAAAAEDEWb9Qlga/QMRZP1CWBr8AAAAAAAAAv70bT796N54+AAAAv70bT796N56+QMRZv1CWBr8AAAAAAACAPwAAAAAAAAAAvRtPP3o3nr4AAAC/vRtPP3o3nj4AAAC/UJYGPwAAAABAxFm/vRtPP3o3nj4AAAA/vRtPP3o3nr4AAAA/UJYGPwAAAABAxFk/AACAvwAAAAAAAAAAvRtPv3o3nr4AAAA/vRtPv3o3nj4AAAA/UJYGvwAAAABAxFk/vRtPv3o3nj4AAAC/vRtPv3o3nr4AAAC/UJYGvwAAAABAxFm/AAAAAAAAAAAAAIA/ejeevgAAAL+9G08/ejeePgAAAL+9G08/ejeePgAAAD+9G08/ejeevgAAAD+9G08/AAAAAAAAAAAAAIC/ejeevgAAAD+9G0+/ejeePgA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IhICMkHCAkGCMgBCQjJSYnFSUnHyYlAycmJSgpHyUpFSglDSkoIxYBBCMBGBYjBQEWBxskBAckCBsHHCQbAhQnAwInBRQCFScUJh0GAyYGHx0mCAYdCxciDAsiDhcLGCIXIRoPDCEPHBohEQ8aKBMKDSgKFRMoDgoTEB4pDRApER4QHyke"}],"meshes":[{"primitives":[{"attributes":{"NORMAL":1,"POSITION":0,"_USER_1":2},"indices":3,"mode":4}]}],"nodes":[{"mesh":0}],"scenes":[{"nodes":[0]}]}}'::scene),
  (2, '{"type" : "gltf", "affine" : [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], "content" : {"accessors":[{"bufferView":0,"componentType":5121,"count":36,"max":[7],"min":[0],"type":"SCALAR"},{"bufferView":1,"componentType":5126,"count":8,"max":[2.5,0.5,0.5],"min":[1.5,-0.5,-0.5],"type":"VEC3"}],"asset":{"generator":"ganos","version":"2.0"},"bufferViews":[{"buffer":0,"byteLength":36,"target":34963},{"buffer":0,"byteLength":96,"byteOffset":36,"target":34962}],"buffers":[{"byteLength":132,"uri":"data:application/octet-stream;base64,AgEAAQIDBAIAAgQGAQQABAEFBgUHBQYEAwYHBgMCBQMHAwUBAADAPwAAAL8AAAC/AAAgQAAAAL8AAAC/AADAPwAAAD8AAAC/AAAgQAAAAD8AAAC/AADAPwAAAL8AAAA/AAAgQAAAAL8AAAA/AADAPwAAAD8AAAA/AAAgQAAAAD8AAAA/"}],"meshes":[{"primitives":[{"attributes":{"POSITION":1},"indices":0,"mode":4}]}],"nodes":[{"mesh":0}],"scenes":[{"nodes":[0]}]}}'::scene),
  (3, '{"type" : "gltf", "affine" : [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], "content" : {"accessors":[{"bufferView":0,"componentType":5121,"count":36,"max":[7],"min":[0],"type":"SCALAR"},{"bufferView":1,"componentType":5126,"count":8,"max":[6.5,0.5,0.5],"min":[5.5,-0.5,-0.5],"type":"VEC3"}],"asset":{"generator":"ganos","version":"2.0"},"bufferViews":[{"buffer":0,"byteLength":36,"target":34963},{"buffer":0,"byteLength":96,"byteOffset":36,"target":34962}],"buffers":[{"byteLength":132,"uri":"data:application/octet-stream;base64,AgEAAQIDBAIAAgQGAQQABAEFBgUHBQYEAwYHBgMCBQMHAwUBAACwQAAAAL8AAAC/AADQQAAAAL8AAAC/AACwQAAAAD8AAAC/AADQQAAAAD8AAAC/AACwQAAAAL8AAAA/AADQQAAAAL8AAAA/AACwQAAAAD8AAAA/AADQQAAAAD8AAAA/"}],"meshes":[{"primitives":[{"attributes":{"POSITION":1},"indices":0,"mode":4}]}],"nodes":[{"mesh":0}],"scenes":[{"nodes":[0]}]}}'::scene);

Query scene data

Retrieve all rows as text:

SELECT id, ST_AsText(data)
FROM t_scene;

Create a spatial index

Create a GiST index on the data column to accelerate spatial queries:

CREATE INDEX idx_t_scene
ON t_scene
USING GIST(data);

Run spatial queries

All examples below use ST_3DMakeCuboid(3, 3, 3) as the query bounding box.

Find objects that intersect with a 3D bounding box:

SELECT id
FROM t_scene
WHERE ST_3DIntersects(data, ST_3DMakeCuboid(3, 3, 3));
-- Returns: 2

Find objects fully contained within a 3D bounding box:

SELECT id
FROM t_scene
WHERE ST_Contains(ST_3DMakeCuboid(3, 3, 3), data);
-- Returns: 1

Run spatial computations

Compute the intersection geometry between a scene object and a bounding box:

SELECT ST_AsText(ST_Intersection(data, ST_3DMakeCuboid(3, 3, 3)))
FROM t_scene
WHERE id = 2;

Merge multiple glTF scene objects into one:

SELECT ST_AsText(ST_Combine(data))
FROM t_scene;

Remove the extension

To remove the extension and all associated objects:

DROP EXTENSION Ganos_Scene CASCADE;

What's next