GroundPrimitive materials examples with Cesium 1.46

1. A concise explanation of the problem you're experiencing.

I'm unable to get GroundPrimitive to work with other materials. I can get GroundPrimitive to work with a solid color Cesium 1.43. But, the GroundPrimitive is showing up underneath my 3D tile data with Cesium 1.47. According to the following link, this functionality should have been added with 1.46. Are there any examples showing how to use this new feature?
https://github.com/AnalyticalGraphicsInc/cesium/issues/5025

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

    rectangle = scene.primitives.add(new Cesium.GroundPrimitive({
        geometryInstances : new Cesium.GeometryInstance({
            geometry : new Cesium.RectangleGeometry({
                rectangle : Cesium.Rectangle.fromDegrees(-76.12, 39.44, -76.10, 39.58),
                vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT
            })
        }),
        appearance : new Cesium.EllipsoidSurfaceAppearance({
            aboveGround : true,
            material: Cesium.Material.fromType('Checkerboard')
        })
    }));

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I'd like to add some texture to our 3D tile data for some image processing tests. The texture needs to be clamped to the 3D tile data.

4. The Cesium version you're using, your operating system and browser.

1.43/1.47, Windows 7, Chrome 67

Another observation is that the clamping works with 1.47 when using world terrain, just not my 3D tile data.

We’re still working on adding support for materials on GroundPrimitives on 3D Tilesets: https://github.com/AnalyticalGraphicsInc/cesium/issues/6636

If just color is sufficient though, you can get the GroundPrimitive to show on top of the 3D Tileset by setting its classificationType on construction. See the documentation here: https://cesiumjs.org/Cesium/Build/Documentation/GroundPrimitive.html

If materials on GroundPrimitives aren’t working even just for terrain though, it could be that your system doesn’t support the WebGL extensions that the feature depends on. What does webglreport.com say? You should just be able to copy-paste all the text from the page straight into a reply.

Thanks for the reply and the link to the issue. I guess I'll stop trying to get it to work for now. Do you have an anticipated version where you will support this feature?

Ah, thanks for the hint at classificationType. I wasn't setting it, and the rectangle would show up on the terrain and the 3D tile with 1.43 but only the terrain with 1.47. After setting it to 3D tile explicitly it shows up where I want it to.

GroundPrimitives seem to work great with world terrain, but I am stuck in an offline environment with 3D tiles.

Aside, is there a way to view documentation for past versions of Cesium?

Thanks!

I don't think it's the issue, but here's the output for WebGL1:

Platform: Win32
Browser User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
Context Name: webgl
GL Version: WebGL 1.0 (OpenGL ES 2.0 Chromium)
Shading Language Version: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit
Renderer: WebKit WebGL
Unmasked Vendor: Google Inc.
Unmasked Renderer: ANGLE (NVIDIA Quadro K2100M Direct3D11 vs_5_0 ps_5_0)
Antialiasing: Available
ANGLE: Yes, D3D9
Major Performance Caveat: No
Vertex Shader
Max Vertex Attributes: 16
Max Vertex Uniform Vectors: 4095
Max Vertex Texture Image Units: 16
Max Varying Vectors: 30
Best float precision: [-2127, 2127] (23)
Transform Feedback
Coming in WebGL 2
Rasterizer
Aliased Line Width Range: [1, 1]
Aliased Point Size Range: [1, 1024]
Fragment Shader
Max Fragment Uniform Vectors: 1024
Max Texture Image Units: 16
float/int precision: highp/highp
Best float precision: [-2127, 2127] (23)
Framebuffer
Max Color Buffers: 8
RGBA Bits: [8, 8, 8, 8]
Depth / Stencil Bits: [24, 8]
Max Render Buffer Size: 16384
Max Viewport Dimensions: [16384, 16384]
Textures
Max Texture Size: 16384
Max Cube Map Texture Size: 16384
Max Combined Texture Image Units: 32
Max Anisotropy: 16
Uniform Buffers
Coming in WebGL 2
Supported Extensions:
ANGLE_instanced_arrays
EXT_blend_minmax
EXT_color_buffer_half_float
EXT_frag_depth
EXT_shader_texture_lod
EXT_texture_filter_anisotropic
WEBKIT_EXT_texture_filter_anisotropic
EXT_sRGB
OES_element_index_uint
OES_standard_derivatives
OES_texture_float
OES_texture_float_linear
OES_texture_half_float
OES_texture_half_float_linear
OES_vertex_array_object
WEBGL_color_buffer_float
WEBGL_compressed_texture_s3tc
WEBKIT_WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_depth_texture
WEBKIT_WEBGL_depth_texture
WEBGL_draw_buffers
WEBGL_lose_context
WEBKIT_WEBGL_lose_context

To see draft extensions in Chrome, browse to about:flags, enable the "Enable WebGL Draft Extensions" option, and relaunch.

And here's the output for WebGL2:

Platform: Win32
Browser User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
Context Name: webgl2
GL Version: WebGL 2.0 (OpenGL ES 3.0 Chromium)
Shading Language Version: WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium)
Vendor: WebKit
Renderer: WebKit WebGL
Unmasked Vendor: Google Inc.
Unmasked Renderer: ANGLE (NVIDIA Quadro K2100M Direct3D11 vs_5_0 ps_5_0)
Antialiasing: Available
ANGLE: Yes, D3D9
Major Performance Caveat: No
Vertex Shader
Max Vertex Attributes: 16
Max Vertex Uniform Vectors: 4095
Max Vertex Texture Image Units: 16
Max Varying Vectors: 30
Best float precision: [-2127, 2127] (23)
Max Vertex Uniform Components: 16380
Max Vertex Uniform Blocks: 12
Max Vertex Output Components: 120
Max Varying Components: 120
Transform Feedback
Max Interleaved Components: 120
Max Separate Attribs: 4
Max Separate Components: 30
Rasterizer
Aliased Line Width Range: [1, 1]
Aliased Point Size Range: [1, 1024]
Fragment Shader
Max Fragment Uniform Vectors: 1024
Max Texture Image Units: 16
float/int precision: highp/highp
Best float precision: [-2127, 2127] (23)
Max Fragment Uniform Components: 4096
Max Fragment Uniform Blocks: 12
Max Fragment Input Components: 120
Min Program Texel Offset: -8
Max Program Texel Offset: 7
Framebuffer
Max Draw Buffers: 8
Max Color Attachments: 8
Max Samples: 8
RGBA Bits: [8, 8, 8, 8]
Depth / Stencil Bits: [24, 8]
Max Render Buffer Size: 16384
Max Viewport Dimensions: [16384, 16384]
Textures
Max Texture Size: 16384
Max Cube Map Texture Size: 16384
Max Combined Texture Image Units: 32
Max Anisotropy: 16
Max 3D Texture Size: 2048
Max Array Texture Layers: 2048
Max Texture LOD Bias: 2
Uniform Buffers
Max Uniform Buffer Bindings: 24
Max Uniform Block Size: 65536
Uniform Buffer Offset Alignment: 256
Max Combined Uniform Blocks: 32
Max Combined Vertex Uniform Components: 212988
Max Combined Fragment Uniform Components: 200704
Supported Extensions:
EXT_color_buffer_float
EXT_texture_filter_anisotropic
OES_texture_float_linear
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_lose_context

To see draft extensions in Chrome, browse to about:flags, enable the "Enable WebGL Draft Extensions" option, and relaunch.

WebGL 2 Functions Implementation Status:
88 of 88 new functions implemented.

copyBufferSubData
getBufferSubData
blitFramebuffer
framebufferTextureLayer
getInternalformatParameter
invalidateFramebuffer
invalidateSubFramebuffer
readBuffer
renderbufferStorageMultisample
texStorage2D
texStorage3D
texImage3D
texSubImage3D
copyTexSubImage3D
compressedTexImage3D
compressedTexSubImage3D
getFragDataLocation
uniform1ui
uniform2ui
uniform3ui
uniform4ui
uniform1uiv
uniform2uiv
uniform3uiv
uniform4uiv
uniformMatrix2x3fv
uniformMatrix3x2fv
uniformMatrix2x4fv
uniformMatrix4x2fv
uniformMatrix3x4fv
uniformMatrix4x3fv
vertexAttribI4i
vertexAttribI4iv
vertexAttribI4ui
vertexAttribI4uiv
vertexAttribIPointer
vertexAttribDivisor
drawArraysInstanced
drawElementsInstanced
drawRangeElements
drawBuffers
clearBufferiv
clearBufferuiv
clearBufferfv
clearBufferfi
createQuery
deleteQuery
isQuery
beginQuery
endQuery
getQuery
getQueryParameter
createSampler
deleteSampler
isSampler
bindSampler
samplerParameteri
samplerParameterf
getSamplerParameter
fenceSync
isSync
deleteSync
clientWaitSync
waitSync
getSyncParameter
createTransformFeedback
deleteTransformFeedback
isTransformFeedback
bindTransformFeedback
beginTransformFeedback
endTransformFeedback
transformFeedbackVaryings
getTransformFeedbackVarying
pauseTransformFeedback
resumeTransformFeedback
bindBufferBase
bindBufferRange
getIndexedParameter
getUniformIndices
getActiveUniforms
getUniformBlockIndex
getActiveUniformBlockParameter
getActiveUniformBlockName
uniformBlockBinding
createVertexArray
deleteVertexArray
isVertexArray
bindVertexArray

Hi,

We don’t have a version we can commit to for materials on primitives on tilesets right now. I have bumped that linked issue with this report, so watch that for updates, and will ping this thread when it’s going to release.

To viewed archived documentation, see the downloads page (https://cesiumjs.org/downloads/). There’s links to past versions of the docs and even Sandcastle.

Thanks,

Gabby

Just to update this thread, ground primitives can now classify 3D Tiles. This was added in https://github.com/AnalyticalGraphicsInc/cesium/pull/7434 and will be part of Cesium 1.54.