CesiumGS / CesiumGS/cesium-unity

Point clouds render incorrectly on Mac

Open
#241 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
535
Forks
132
Avg merge
6h 45m
Merged PRs (30d)
1

Description

@joseph-kaile discovered that point clouds don't render correctly on Mac (or more specifically, Metal). Using Unity 2021.3.16f:

> I'm seeing some strange behavior in mac. I replaced the Melbourne tileset in the sample scene with the point cloud version. I do see the points, however when I move the camera around, random colors jump around in the screen.
> ![out](https://user-images.githubusercontent.com/97980867/223935067-fb07b7d6-30a4-4df3-8043-f54d3484db19.gif)

We tested on `main` and found that these artifacts happen even with the basic point cloud rendering. I couldn't find any posts about it being a problem with Unity, but I found someone else having this issue: https://github.com/bkaradzic/bgfx/issues/2822

> ![image](https://user-images.githubusercontent.com/32226860/224098195-5dbe3280-45c0-4c5e-b225-d201b3e24b9c.png)

> I've run into this as well. I know the general solution, but I'm not sure where it would go as a fix within bgfx. Basically on Metal the point size needs to be a vertex shader output. From Apple: The vertex shader must provide [[point_size]], or the point size is undefined. https://developer.apple.com/documentation/metal/mtlprimitivetype/point

I don't think we're doing anything wrong on our side? It seems like something inside Unity's shader code isn't setting the default point size for meshes rendered with `MeshTopology::POINTS`. I'll submit a bug report and post when / if I get a response.

EDIT: @joseph-kaile also found this [Unity forum post](https://forum.unity.com/threads/meshtopology-points-very-strange-on-ios-unity-2017-3-0-b10.505792/) confirming it's a Unity and Metal interaction.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.