From 87fceaa76d4f30add1e83db1bcd0fb27d432c343 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Thu, 20 Oct 2016 17:12:50 -0400 Subject: [PATCH 1/3] Add point cloud styling section --- Styling/README.md | 33 +++++++++++++++++++ Styling/schema/pnts.style.schema.json | 23 +++++++++++++ .../schema/style.numberExpression.schema.json | 7 ++++ Styling/schema/style.schema.json | 2 +- 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 Styling/schema/pnts.style.schema.json create mode 100644 Styling/schema/style.numberExpression.schema.json diff --git a/Styling/README.md b/Styling/README.md index fec93c9ba..998835706 100644 --- a/Styling/README.md +++ b/Styling/README.md @@ -24,6 +24,7 @@ Example: Creating a color ramp based on building height. * Matt Amato, [@matt_amato](https://twitter.com/matt_amato) * Tom Fili, [@CesiumFili](https://twitter.com/CesiumFili) * Patrick Cozzi, [@pjcozzi](https://twitter.com/pjcozzi) +* Sean Lilley, [@lilleyse](https://github.com/lilleyse) Contents: @@ -40,6 +41,7 @@ Contents: * [RegExp](#regexp) * [Conversions](#conversions) * [Variables](#variables) + * [Point Cloud](#point-cloud) * [Notes](#notes) * [File Extension](#file-extension) * [MIME Type](#mime-type) @@ -469,6 +471,37 @@ ${temperatures.values[0]} === 70 ${temperatures['values'][0]} === 70 // Same as (temperatures[values])[0] and temperatures.values[0] ``` +### Point Cloud + +In addition to evaluating a point's `color` and `show` properties, a point cloud style may evaluate `pointSize`, or the size of each point in pixels. The default `pointSize` is `1.0`. +```json +{ + "color" : "color('red')", + "pointSize" : "${Temperature} * 0.5" +} +``` + +Implementations may clamp the evaluated `pointSize` to the system's supported point size range. For example, WebGL renderers may query `ALIASED_POINT_SIZE_RANGE` to get the system limits when rendering with `POINTS`. + +Point cloud styles may also reference per-point semantics including position, color, and normal to allow for more flexible styling of the source data. +* `${POSITION}` is an array of three values representing the xyz coordinates of the point before the `RTC_CENTER` and tile transform are applied. When the positions are quantized, `${POSITION}` refers to the position after the `QUANTIZED_VOLUME_SCALE` is applied, but before `QUANTIZED_VOLUME_OFFSET` is applied. +* `${COLOR}` evaluates to a Color type, where each of the rgba color components are in the range `0.0` to `1.0`. +* `${NORMAL}` is an array of three values representing the normal of the point before the tile transform is applied. When normals are oct-encoded `${NORMAL}` refers to the decoded normal. + +For example: + +```json +{ + "color" : "${COLOR} * color('red')'", + "show" : "${POSITION}[0] > 0.5", + "pointSize" : "${NORMAL}[0] > 0 ? 2 : 1" +} +``` + +#### Point Cloud Shader Styling + +**TODO : add note about GLSL implementations requires strict type comparisons among other things: https://github.com/AnalyticalGraphicsInc/cesium/issues/3241** + ### Notes Comments are not supported. diff --git a/Styling/schema/pnts.style.schema.json b/Styling/schema/pnts.style.schema.json new file mode 100644 index 000000000..9511fced7 --- /dev/null +++ b/Styling/schema/pnts.style.schema.json @@ -0,0 +1,23 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "pnts.style.schema.json", + "title" : "Point Cloud Style", + "type" : "object", + "description" : "A 3D Tiles style with additional properties for Point Clouds.", + "allOf" : [{ + "$ref" : "style.schema.json" + }, { + "properties" : { + "pointSize": { + "oneOf": [{ + "$ref": "style.numberExpression.schema.json" + }, { + "$ref": "style.condition.schema.json" + }], + "description": "Determines the size of the points in pixels.", + "default": 1.0 + } + } + }], + "additionalProperties" : false +} diff --git a/Styling/schema/style.numberExpression.schema.json b/Styling/schema/style.numberExpression.schema.json new file mode 100644 index 000000000..cd2994981 --- /dev/null +++ b/Styling/schema/style.numberExpression.schema.json @@ -0,0 +1,7 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "style.numberExpression.schema.json", + "title" : "number expression", + "type" : ["number", "string"], + "description" : "3D Tiles style expression that evaluates to a number." +} diff --git a/Styling/schema/style.schema.json b/Styling/schema/style.schema.json index d01730c10..a8c5317ec 100644 --- a/Styling/schema/style.schema.json +++ b/Styling/schema/style.schema.json @@ -20,7 +20,7 @@ }, { "$ref" : "style.condition.schema.json" }], - "description" : "Determines the 'highlight color' multiplied with the feature's intrinsic color.", + "description" : "Determines the color blended with the feature's intrinsic color.", "default" : "Color('#FFFFFF')" }, "meta" : { From 6f09dc9db6c1b51a161a3bc652c712162556ec75 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Fri, 21 Oct 2016 10:58:43 -0400 Subject: [PATCH 2/3] Swap names --- Styling/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Styling/README.md b/Styling/README.md index 998835706..f993c1c08 100644 --- a/Styling/README.md +++ b/Styling/README.md @@ -23,9 +23,8 @@ Example: Creating a color ramp based on building height. * Gabby Getz, [@ggetz](https://github.com/ggetz) * Matt Amato, [@matt_amato](https://twitter.com/matt_amato) * Tom Fili, [@CesiumFili](https://twitter.com/CesiumFili) -* Patrick Cozzi, [@pjcozzi](https://twitter.com/pjcozzi) * Sean Lilley, [@lilleyse](https://github.com/lilleyse) - +* Patrick Cozzi, [@pjcozzi](https://twitter.com/pjcozzi) Contents: From 918fbba3c0d50c18225c892df12c2432ba5f1f3a Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Mon, 9 Jan 2017 14:49:23 -0500 Subject: [PATCH 3/3] Vector updates --- Styling/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Styling/README.md b/Styling/README.md index f993c1c08..a662e8ec9 100644 --- a/Styling/README.md +++ b/Styling/README.md @@ -472,7 +472,7 @@ ${temperatures['values'][0]} === 70 // Same as (temperatures[values])[0] and tem ### Point Cloud -In addition to evaluating a point's `color` and `show` properties, a point cloud style may evaluate `pointSize`, or the size of each point in pixels. The default `pointSize` is `1.0`. +A [Point Cloud](../TileFormats/PointCloud/README.md) is a collection of points that may be styled like other features. In addition to evaluating a point's `color` and `show` properties, a point cloud style may evaluate `pointSize`, or the size of each point in pixels. The default `pointSize` is `1.0`. ```json { "color" : "color('red')", @@ -480,20 +480,20 @@ In addition to evaluating a point's `color` and `show` properties, a point cloud } ``` -Implementations may clamp the evaluated `pointSize` to the system's supported point size range. For example, WebGL renderers may query `ALIASED_POINT_SIZE_RANGE` to get the system limits when rendering with `POINTS`. +Implementations may clamp the evaluated `pointSize` to the system's supported point size range. For example, WebGL renderers may query `ALIASED_POINT_SIZE_RANGE` to get the system limits when rendering with `POINTS`. A `pointSize` of `1.0` must be supported. -Point cloud styles may also reference per-point semantics including position, color, and normal to allow for more flexible styling of the source data. -* `${POSITION}` is an array of three values representing the xyz coordinates of the point before the `RTC_CENTER` and tile transform are applied. When the positions are quantized, `${POSITION}` refers to the position after the `QUANTIZED_VOLUME_SCALE` is applied, but before `QUANTIZED_VOLUME_OFFSET` is applied. -* `${COLOR}` evaluates to a Color type, where each of the rgba color components are in the range `0.0` to `1.0`. -* `${NORMAL}` is an array of three values representing the normal of the point before the tile transform is applied. When normals are oct-encoded `${NORMAL}` refers to the decoded normal. +Point cloud styles may also reference semantics from the [Feature Table](../TileFormats/PointCloud/README.md#feature-table) including position, color, and normal to allow for more flexible styling of the source data. +* `${POSITION}` is a `vec3` storing the xyz Cartesian coordinates of the point before the `RTC_CENTER` and tile transform are applied. When the positions are quantized, `${POSITION}` refers to the position after the `QUANTIZED_VOLUME_SCALE` is applied, but before `QUANTIZED_VOLUME_OFFSET` is applied. +* `${COLOR}` evaluates to a `Color` storing the rgba color of the point. When the feature table's color semantic is `RGB` or `RGB565`, `${COLOR}.alpha` is `1.0`. If no color semantic is defined, `${COLOR}` evaluates to the application-specific default color. +* `${NORMAL}` is a `vec3` storing the normal, in Cartesian coordinates, of the point before the tile transform is applied. When normals are oct-encoded `${NORMAL}` refers to the decoded normal. If no normal semantic is defined in the feature table, `${NORMAL}` evaluates to `undefined`. For example: ```json { "color" : "${COLOR} * color('red')'", - "show" : "${POSITION}[0] > 0.5", - "pointSize" : "${NORMAL}[0] > 0 ? 2 : 1" + "show" : "${POSITION}.x > 0.5", + "pointSize" : "${NORMAL}.x > 0 ? 2 : 1" } ```