Comments (6)
The Implicit Tiling / Availability section in the specification describes the "entry point" for this data:
- The JSON part of the subtree refers to buffers. Each buffer is either an 'Internal Buffer' that stored directly in the
.subtree
file, or a buffer that is stored as an 'External Buffer', using a URI. The data of a buffer is just a raw chunk of data. It is a sequence of bytes, with no inherent meaning. - The JSON part also defines bufferViews. Each buffer view refers to a "slice" of a buffer, using the
byteOffset
andbyteLength
properties.- (Note: This is heavily inspired by the buffer/bufferView concept of glTF
- The availability objects in the JSON part (
tileAvailability
,contentAvailability
, andchildSubtreeAvailability
) refer to abitstream
, which is just the index of one of the buffer views. So these availability objects still refer to a raw block of bytes.
(Note: I just noticed a small error in the implementation note - see #766 - but this is unrelated to the broader question)
The crucial point in view of your question is given by the statement from the specification:
Availability bitstreams are packed in binary using the format described in the Booleans section of the 3D Metadata Specification.
The linked section describes how to interpret the raw bytes of such an availability buffer view. Specifically: The availability is encoded bit-wise inside the raw buffer view data. Each byte of the buffer view data contains 8 bits, indicating the availability of up to 8 elements.
Some pseudocode:
bufferData = ...; // some vector<byte>
bufferViewData = ...; // a subsection of the buffer data, stored as a vector<byte>
bool isTileAvailable(int index) {
int byteIndex = index / 8;
int bitIndex = index % 8;
int bitValue = (bufferViewData[byteIndex] >> bitIndex) & 1;
if (bitValue == 1) return true;
return false;
}
For basic tests, you might consider loading a simple test data set like https://github.com/CesiumGS/3d-tiles-samples/tree/main/1.1/SparseImplicitQuadtree. It contains a subtreeInfo.md
with very (very) detailed information about the data that is stored in the subtree, including, the exact bits that are set inside the respective availability bitstreams, for example, at https://github.com/CesiumGS/3d-tiles-samples/blob/main/1.1/SparseImplicitQuadtree/screenshot/subtreeInfo.md#tile-availability
from 3d-tiles.
I've just understood the each tile's availability is stored in bits instead of bytes, and 8 bits are converted to bytes and stored in the .subtree files.
The crux of my confusion lies in how individual bits are organized and packed into bytes. I have attempted to perform numerical conversion, but it seems that the results do not align with the expected byte representation.
Could you please provide detailed insights into the process of converting bits to bytes for storing tile availability? Understanding this process is crucial for me to correctly interpret and manipulate the availability data.
Any guidance or clarification on this matter would be greatly appreciated.
Thank you for your assistance!
from 3d-tiles.
I have recently observed an interesting correlation when reversing an 8-bit sequence, such as "10110000", which results in "00001101". Remarkably, the hexadecimal representation of the reversed sequence is "0x0d", which aligns with the expected byte representation. I am curious to know whether this is merely a coincidence or if there is a deeper underlying principle at play.
Could you please provide insights into whether there is a fundamental relationship or principle that explains this phenomenon?
Thank you for your assistance in exploring this intriguing observation.
from 3d-tiles.
from 3d-tiles.
The term endianness usually refers to the order of bytes within a multi-byte type. Here, the question is about the order of bits within a byte.
I have recently observed an interesting correlation when reversing an 8-bit sequence, such as "10110000", which results in "00001101". Remarkably, the hexadecimal representation of the reversed sequence is "0x0d", which aligns with the expected byte representation. I am curious to know whether this is merely a coincidence or if there is a deeper underlying principle at play.
In the tables that are shown in that subtreeInfo.md
(and that you showed in the screenshot), I did hesitate quite a while. I was afraid that either bit order could be confusing, depending on the understanding or expectation that a reader might have. So I tried to resolve the ambiguity here, by explicitly saying
Bits [0...7] :
in the description.
Usually, when you show the bits of one byte, the order will be
7 6 5 4 3 2 1 0
In a byte with value 6
, the bits 2
and 1
will be set, meaning that it will usually be displayed as
0 0 0 0 0 1 1 0
.
In the tables, the bits are shown with the order
0 1 2 3 4 5 6 7
(as indicated by the [0...7] part), meaning that the bits for a value of 6 will be
0 1 1 0 0 0 0 0
.
Now you may ask why I did this. And the answer is that I tried to make these table rows more similar to the the images at https://github.com/CesiumGS/3d-tiles/tree/main/specification/ImplicitTiling#tile-availability , where the "Tile Availability" bitstream is shown from left to right (i.e the bit with index 0 is shown at the leftmost side)
When you take the bits from the tables, in the order in which they are shown, then they will be
10110000 01001100 10000000
matching the order of the bits in these images.
from 3d-tiles.
The "[0...7]" part of the description was intended to make clear which bit order is used for the description. If this is confusing, then it could be changed, but ... I wonder how it should be changed. So unless there are specific requests for changes, I assume that there are no actionable items here.
from 3d-tiles.
Related Issues (20)
- Clarify the use of non-8-bit-channels in property textures HOT 1
- How to format data HOT 1
- glTF metadata uses integers where it should use "glTF IDs" HOT 1
- Inconsistency in tile schema and its description
- Cesium 1.1 tiling data failed to load
- Clarify details about `featureCount` and `nullFeatureId` HOT 4
- Can Earth Explorer 3D Map with Augmented reality be added as Viewer?
- Can Map Data Explorer iOS and Android be added as Viewer - it supports 3DTILES
- Selection Issue with GLB Model Organized by Tileset.json HOT 2
- Basic, minimal examples; sources for README figures HOT 10
- EXT_mesh_features Clarification: How many feature ids does an indexed geometry have when ids are implicitly derived? HOT 7
- EXT_mesh_features Rendering: How to visualize "interpolated" features? HOT 8
- Implementation notes refer to `bufferView` where `bitstream` should be used
- 3D-Tiles 1.1 implicit tile : Octree HOT 2
- 3D-Tiles 1.1 voxel HOT 1
- Clarification for content availability of implicit tileset roots HOT 4
- 3D-Tiles 1.1 voxel HOT 3
- 3D-Tiles 1.1 voxel's customShader HOT 1
- 3D-Tiles 1.1 binary .voxel file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 3d-tiles.