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

Procedural map generation fails for maps larger than 16x16km #58

Open
Insprill opened this issue Dec 23, 2023 · 2 comments
Open

Procedural map generation fails for maps larger than 16x16km #58

Insprill opened this issue Dec 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Insprill
Copy link
Owner

We need a different approach to generating the height map, since a single texture can't be more than 16x16k pixels.

@Insprill Insprill added the bug Something isn't working label Dec 23, 2023
@WhistleWiz
Copy link
Collaborator

This only affects the map item?
We could simply, on larger sizes, average pixels.
So instead of doing it 1m = 1px, we'd average a 2x2 square into a single pixel. Bigger even, 4x4, etc.

@Insprill
Copy link
Owner Author

Yeah, it's only items. It depends on the terrain resolution as well, since that's what determines the texture size.

int heightmapResolution = terrains[0].terrainData.heightmapResolution;
int terrainWidth = heightmapResolution - 1;
int totalWidth = terrainWidth * Mathf.CeilToInt(Mathf.Sqrt(terrainCount));
Texture2D combinedTexture = new Texture2D(totalWidth, totalWidth, TextureFormat.RGBA32, false);

That's a pretty bad way of doing it, and we should instead pack it into a 4k texture, then smooth the value on small maps and down sample it on larger ones.

@Insprill Insprill moved this to Todo in DV Mapify Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants