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

FIX BUG: Terrain mesh is randomly broken because of brick's top face #3

Closed
stone-SJH opened this issue Apr 11, 2021 · 2 comments · Fixed by #2
Closed

FIX BUG: Terrain mesh is randomly broken because of brick's top face #3

stone-SJH opened this issue Apr 11, 2021 · 2 comments · Fixed by #2

Comments

@stone-SJH
Copy link
Contributor

PR: #2

In the WorldGenerationTest.unity scene, you're generating some huge mesh without setting Mesh.indexFormat to UInt32(the default value is UInt16), which causing meshes with vertex count > 65535 fail to render normally.
Unity doc here: https://docs.unity3d.com/ScriptReference/Mesh-indexFormat.html

However, using UInt32 indices format instead of UInt16 will probably drop performance and need more memory (for example, X-5 Z-3 ChunkSlice#4, which has 101920 verts and 221400 triangles, cost around 6.5MB for indices using UInt32 or around 1.5MB using UInt16). So a better solution might be split your huge meshes into sub-meshes(verts < 65535) and still using UInt16, if you have time, you can have a try about this :)

@tetreum
Copy link
Owner

tetreum commented Apr 11, 2021

Funny because you can see here

combinedMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
that is something that i already did when i was bruteforcing the entire brick model rather than the shown faces xDD And then i never thought of it again xDDD
The thing is, i belive it throwed me an error back then. Why isn't it doing the same in those cases?

@tetreum
Copy link
Owner

tetreum commented Apr 11, 2021

I've added you to https://github.com/tetreum/brickcraft#credits and also on https://tetreum.github.io/brickcraft/?/help
Thank you so much!

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