CesiumGS / 3d-tiles

Specification for streaming massive heterogeneous 3D geospatial datasets :earth_americas:
2.14k stars 469 forks source link

3D-Tiles 1.1 voxel's customShader #772

Closed cjhdsg closed 6 months ago

cjhdsg commented 6 months ago

I am trying to load 3DTiles voxels, and store a field ‘aa’ for each voxel cell. How can I get the property value of ‘aa’ in custom shader and set different alpha according to 'aa' value? My property is stored in [.bin] file connected by [voxel.json] file.

Thank you for your assistance!

const customShader = new Cesium.CustomShader({ fragmentShaderText: `void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) { material.diffuse = vec3(0.5,0.5,0.5);

      float aValue = fsInput.voxel.aa; // Here is wrong! I want to get the value of property 'aa'

      material.alpha = 0.5;
  }`,
});
lilleyse commented 6 months ago

@cjhdsg It should be fsInput.metadata.aa. See the Voxels Sandcastle for a full example.

For future questions like this please post on the Cesium Community Forum.