# Pointcloud Attenuation breaks alpha clipping

**URL:** <https://community.cesium.com/t/pointcloud-attenuation-breaks-alpha-clipping/44018>\
**Category:** Cesium for Unity\
**Created:** [November 6, 2025, 9:52am UTC](https://community.cesium.com/t/pointcloud-attenuation-breaks-alpha-clipping/44018 "2025-11-06T09:52:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JanikCodes](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janikcodes/32/31941_2.png) [@JanikCodes](https://community.cesium.com/u/JanikCodes)\
**Post date:** [November 6, 2025, 9:52am UTC](https://community.cesium.com/t/pointcloud-attenuation-breaks-alpha-clipping/44018/1 "2025-11-06T09:52:58Z")

</div>

Hi! I’m using CesiumTileExcluder to only render a specific area of my map, like a table.

From this amazing [PR](https://github.com/CesiumGS/cesium-unity/pull/248) I created a shader that modifies the fragment alpha value so everything outside the bounds of my specific area is not visible. This works fine if I’m using Pointclouds normally but once I enable the Attenuation boolean it breaks and renders regardless if it’s outside or not.

Does Attenuation use a different material than the 3DTiles opaqueMaterial? Or is that a bug?

Appreciate the help

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [November 10, 2025, 5:33am UTC](https://community.cesium.com/t/pointcloud-attenuation-breaks-alpha-clipping/44018/2 "2025-11-10T05:33:04Z")

</div>

Hi @JanikCodes,

It looks like you’re correct: it’s a bug (or a missing feature, at any rate) that custom materials aren’t used for attenuated point clouds. There’s a mention of this in the last comment in this issue:

> <https://github.com/CesiumGS/cesium-unity/issues/201#issuecomment-1536741958>
>
> Intro 
> \--- 
> Building off of #197, we'll want to add something akin to \[\`PointC…loudShading\` in CesiumJS\](https://cesium.com/learn/cesiumjs/ref-doc/PointCloudShading.html) to Cesium for Unity. This will improve the visual quality of point clouds in Unity, should users choose to add it to their point clouds.
> 
> The main benefits of point cloud shading are:
> \- \*\*attenuation\*\*, which allows more control over point size (points are currently drawn as a single pixel)
> \- \*\*eye dome lighting (EDL)\*\*, which shades points so that they appear to have more depth. This will be important when we allow users to increase point size, since constant-color point clouds will appear like big globs of color without it.
> 
> This \[Sandcastle\](https://sandcastle.cesium.com/?src=3D%20Tiles%20Point%20Cloud%20Shading.html) demonstrates \`PointCloudShading\`'s effects.
> 
> | No shading | Attenuation only | Attenuation + EDL |
> | ---------- | --------------- | ---------------- |
> | !\[image\](https://user-images.githubusercontent.com/32226860/216718409-9eef03bb-350c-4b86-ae12-8d7f639ee51d.png) | !\[image\](https://user-images.githubusercontent.com/32226860/216718433-9f6b8166-8629-446c-8f2b-f2cbcf098bb4.png) | !\[image\](https://user-images.githubusercontent.com/32226860/216718482-7217a567-8651-4cff-9e87-dbce445b60f3.png) |
> 
> In CesiumJS, attenuation accounts for various factors and adjusts the \`gl\_pointSize\` accordingly. EDL is accomplished by rendering the depth values of the point cloud to a separate texture, then blending them with the point cloud colors. (\[CesiumJS implementation here\](https://github.com/CesiumGS/cesium/blob/27abb992eb5a434f1c9391f5e926643473ebc985/packages/engine/Source/Scene/PointCloudEyeDomeLighting.js)) So to summarize, the following is necessary to implement point cloud shading:
> \- a way to visualize points at larger sizes
> \- the ability to write to two outputs, depth + color
> \- the ability to blend the two outputs together
> 
> Unity implementation
> \-- 
> Points are currently rendered just like other tilesets. The only difference is that the mesh is constructed with \`MeshTopology.Points\` instead of \`MeshTopology.Triangles\`. This is a great start, but there's no way to control the size of the points that are rendered. I also don't know how to get the depth values of only the points that are rendered
> 
> Here, I'm chronicling all of the methods I've considered / tried.
> \- ❌ Use the PSIZE attribute in a Unity shader
> - This involves \[forcing Unity to use OpenGL\](https://answers.unity.com/questions/807548/how-do-i-use-psize-in-a-unity-454-shader.html), which is pretty unideal.
> \- ❌ Write a geometry shader to expand the points to quads
> - Geometry shaders are not \[supported by Metal\](https://developer.apple.com/forums/thread/88325).
> \- ❔ Draw instanced quad meshes wherever the point positions are
> - This only works with \[\`DrawMeshInstanced\`\](https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstanced.html). I was not able to get \[\`DrawMeshInstancedProcedural\`\](https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedProcedural.html) or \[\`DrawMeshInstancedIndirect\`\](https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedIndirect.html) to work because apparently the instance ID attribute is not available in those functions, so it's 0 for every instance 🤔 
> - This method involves some duplication of data, since one of the arguments to \`DrawMeshInstanced\` is a \`Matrix4x4\[\]\` array.
> - You'd have to convert the desired point size to an actual world scale for each quad -- something like the way \[\`minimumPixelSize\` affects a model's scale in CesiumJS\](https://github.com/CesiumGS/cesium/blob/828d6799916196a6f9c79dd8e5b001d58305e093/packages/engine/Source/Scene/Model/Model.js#L2092).
> - This \_is\_ compatible with Shader Graph, so it might be easier to integrate with what we do for #200.
> - I haven't looked into how I'd extract the depth values with this method yet, if it's possible.
> \- ❔ Use a compute shader to compute point size, then expand the points to quads.
> - This should be supported by all the platforms Cesium for Unity supports, according to the \[documentation\](https://docs.unity3d.com/Manual/class-ComputeShader.html).
> - This can be used as an alternative to a geometry shader, and can also help with rendering to multiple outputs.
> - This \_isn't\_ compatible with Shader Graph, since it only expects one position output. This could have implications for #200.
> 
> I'll update this issue as I go so I can document my various approaches / struggles / woes with the Unity implementation.

---

<div class="post-metadata">

**Author:** ![JanikCodes](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janikcodes/32/31941_2.png) [@JanikCodes](https://community.cesium.com/u/JanikCodes)\
**Post date:** [November 10, 2025, 12:28pm UTC](https://community.cesium.com/t/pointcloud-attenuation-breaks-alpha-clipping/44018/3 "2025-11-10T12:28:24Z")

</div>

Ive replied to the issue. Having shader support for that would be amazing.
