Optimize 3D data for 2D rendering in PostGIS DB

137 Views Asked by At

I have 3D models in my PostGIS DB. This data is basically big sets of triangle faces coming from Autocad DXFs, mostly.

I use it for visualizing in THREEJS based webapp and it works fine. But I have 2D view which is based on OpenLayers. OpenLayers WebGL renderer is not good (not ready for lines and polygons). I use vectortiles (produced by postgis directly) for clint-vector rendering and mapserver for server-raseter rendering.

Both approaches work but I have too much edges displayed (sometimes I have browser memory usage problems while using MVT). I need to "optimize" my 3D data to minimize "throughput". I think I can do 2 things for this:

1) Merge coplanar faces;

2) Cut invisible faces (looks like z-buffer algoritm but for vector-data with orthogonal camera).

I tried to do both things with postgis but it works extremely slow to use it even on pre-processing stage. I'm looking for some good advices. May be I need to use PostGIS topology system or clustering for it. But I didn't find any good docs/examples.

1

There are 1 best solutions below

0
Treize Cinq On

I do like this :

  1. Not render a simple mesh but many squares.
  2. Adapt the widthSegments & heightSegments
  3. Export data in .json
  4. Assign data to mesh

And it do this : http://glayve.com/relief/verdon.html