Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tileset with no normals has render and loading issues #540

Open
r-veenstra opened this issue Dec 19, 2024 · 1 comment · May be fixed by #541
Open

Tileset with no normals has render and loading issues #540

r-veenstra opened this issue Dec 19, 2024 · 1 comment · May be fixed by #541

Comments

@r-veenstra
Copy link

I have a tileset used in https://github.com/CesiumGS/cesium-unreal-demos which renders incorrectly in the editor, and also appears to hang the editor on playing the scene (hangs at "reloading domain" and never appears to proceed). It works fine in Unreal.

Using Unity 2022.3 and Cesium for Unity 1.14.0. No errors or warnings appear in the console.

image

image

Asset ID: 2887128
Token: Use the existing samples token

I have the same tileset exported with normals, and it appears to work fine.
Working Asset ID: 2887129

@kring
Copy link
Member

kring commented Dec 20, 2024

This is a couple of different bugs.

The first is that the code for populating the vertex color data is incorrect for the case where we don't have normals, and so we have to generate flat normals. This is the cause of the random multicolored triangles. I fixed this here (no PR yet):
2d36729

The second problem is caused by overflowing 16-bit mesh indices. When we generate flat normals, we need to "unshare" the vertices. Every unique triangle gets three of its own unique vertices. This necessarily increases the number of vertices in the mesh. If the number of vertices was originally less than 65535, but the unshared version is more than that, then we'll overflow the uint16_t and get caught in an endless loop. This is the cause of the hang when attempting to enter Play mode.

You can work around both problems by checking the "Generate Smooth Normals" box. But once the tileset is loaded, it's too late (a load thread will be stuck in an endless loop). So you need to load Unity, change the setting, save, exit Unity, kill the hung Unity process, restart it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants