diff --git a/doc/images/filtered_spats_sum_of_weights.png b/doc/images/filtered_spats_sum_of_weights.png new file mode 100644 index 00000000..899cfa6a Binary files /dev/null and b/doc/images/filtered_spats_sum_of_weights.png differ diff --git a/doc/images/filtered_splats_normalized.png b/doc/images/filtered_splats_normalized.png new file mode 100644 index 00000000..a523f0d2 Binary files /dev/null and b/doc/images/filtered_splats_normalized.png differ diff --git a/doc/images/filtered_splats_overlapping.png b/doc/images/filtered_splats_overlapping.png new file mode 100644 index 00000000..b6c19dc4 Binary files /dev/null and b/doc/images/filtered_splats_overlapping.png differ diff --git a/doc/images/filtered_splats_weighted_sum.png b/doc/images/filtered_splats_weighted_sum.png new file mode 100644 index 00000000..991ecbbf Binary files /dev/null and b/doc/images/filtered_splats_weighted_sum.png differ diff --git a/doc/materials_and_rendermodes.md b/doc/materials_and_rendermodes.md index 49272148..2b449acb 100644 --- a/doc/materials_and_rendermodes.md +++ b/doc/materials_and_rendermodes.md @@ -22,4 +22,57 @@ You can change the render mode by calling | ![](./images/lion_fixed_circles.jpg "") | ![](./images/lion_weighted_circles.jpg "") | ![](./images/lion_filtered_splats.jpg "") | | --------------------------------------- | ------------------------------------------ | ----------------------------------------- | | FIXED_CIRCLES with point-size 2. All points have pixel diameter 2.| WEIGHTED_CIRCLES with point-size 1. Size varies depending on distance from camera. | FILTERED_SPLATS with point-size 1. In this mode, points have the same size as with WEIGHTED_CIRCLES, but overlapping points are interpolated. | - \ No newline at end of file + + +## PointCloudMaterial + +PointCloudMaterial is actually a combination of other materials. +It dispatches render calls to the material in use. + +## FixedPointSizeMaterial + +Used when rendermode is set to FIXED_CIRCLE. +The _render(sceneNode, renderer)_ function extracts extracts all pointCloud from sceneNode, +that should be rendered. The _renderPointClouds()_ function invokes the WebGL +draw calls. + +## WeightedPointSizeMaterial + +Used when rendermode is set to WEIGHTED_CIRCLE. +It works the same way as FixedPointSizeMaterial, except with a different vertex shader +that adjusts the point size according to the distance from the viewer. + +## FilteredSplatsMaterial + +Used when rendermode is set to FILTERED_SPLATS. +This material is based on the paper [High Quality Splatting on Today's GPUs](http://graphics.ucsd.edu/~matthias/Papers/HighQualitySplattingOnGPUs.pdf). + +The idea is, that overlapping points should be blended together, if their distance to the viewer is roughly the same. +Simple point rendering usualy leads to overlapping points: +![](./images/filtered_splats_overlapping.png "") + +This material consists of 3 passes: + +1. Depth-Pass Renders the point cloud into a depth buffer. Depth values are pushed away from the viewer with an offset given by uBlendDepth. +Fragments within this offset-range will be blended together. Fragments that are farther away will be discarded during the depth test. +2. Attribute-Pass Renders the point cloud with weighted attributes and blend mode set to ADD. +The weight function gives fragments that are closer to the center a higher weight.
+The result of this pass is a weighted sum of overlapping attributes, stored in the RGB component:
+![](./images/filtered_splats_weighted_sum.png "") +And the sum of weights, stored in the alpha component:
+![](./images/filtered_spats_sum_of_weights.png "") +3. Normalization-Pass In this pass, the output of the previous pass is normalized by +dividing the weighted sum of colors in the RGB component by the sum of weights in the alpha component. +It's essentially a screen-space filter so this time, not the point cloud is rendered but +a rectangle that spans the whole screen with the output of the previous pass +as the its texture. This is one possible result:
+![](./images/filtered_splats_normalized.png "")
+The smoothness of the transition depends on the weight function. By adjusting the weight function, you can get +very smooth or relatively sharp borders. + + + + + + +