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

Importing 256th region doesn't work #233

Closed
langyaWang22 opened this issue Oct 19, 2023 · 5 comments · Fixed by #250
Closed

Importing 256th region doesn't work #233

langyaWang22 opened this issue Oct 19, 2023 · 5 comments · Fixed by #250
Labels
big terrains Issues that need to be addressed for big terrains bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@langyaWang22
Copy link

When importing a height map (16384x16384), an error occurred at the location shown in the figure, and the error was constantly reported when selecting terrain nodes.
jpg

@TokisanGames
Copy link
Owner

What version or commit of Terrain3D?

You stated "when importing", but this screen shot is not of the importer, so it's not during the import process. Did importing produce any errors? How did you import the data then get it in this other scene? AFAIK it's not possible to save 16k resource files. #159

You wrote "an error". Are you referring to the visual artifact on screen or the 44k errors? What exact process did you go through to do this? We've had 16k imports just fine without issue.

@langyaWang22
Copy link
Author

What version or commit of Terrain3D?

You stated "when importing", but this screen shot is not of the importer, so it's not during the import process. Did importing produce any errors? How did you import the data then get it in this other scene? AFAIK it's not possible to save 16k resource files. #159

You wrote "an error". Are you referring to the visual artifact on screen or the 44k errors? What exact process did you go through to do this? We've had 16k imports just fine without issue.

Version terrain3d_ 0.8.3-alpha_ Gd4.1.1
Sorry, I didn't explain it clearly. There was a problem during the import process.
Import error occurred in one corner of the terrain (X.MAX, Z.MAX)
In addition, when selecting the Importer node and moving the mouse to the error area, the following error will occur:
core/io/image.cpp:3265 - Index p_x = 1315 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1316 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1317 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1318 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1319 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1320 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1321 is out of bounds (width = 1024).
core/io/image.cpp:3265 - Index p_x = 1322 is out of bounds (width = 1024).

jpg

@TokisanGames
Copy link
Owner

In the current master branch and Godot 4.1.2, I'm able to import 16k x 16k without error messages. There were artifacts outside of the global region boundary, fixed in 4fc9b4c, but that is different than the issue reported here.

The only problem is that last added region shows as flat. There's likely an array index error somewhere. When that is fixed, this ticket will be closed.

Also note:

@TokisanGames TokisanGames added the bug Something isn't working label Oct 26, 2023
@TokisanGames TokisanGames added this to the Beta milestone Oct 26, 2023
@TokisanGames TokisanGames added the big terrains Issues that need to be addressed for big terrains label Oct 26, 2023
@TokisanGames
Copy link
Owner

TokisanGames commented Nov 1, 2023

The region_map is an array of 256 bytes, which holds the ID number of each region. Since there are 256 regions available and each byte can hold 0-255, this would work fine. However we currently store 0 if no region is present. So, we need a range of 0-256, or 257 values. Most likely the last region is being created and stored with region id 256, which wraps to 0, which means no region.

We'll have to figure out a different way to ID the regions or store the IDs. Perhaps either making the ID number an array of 2 byte ints, or storing whether regions exist in a separate array of bits, which could fit in 8 bytes. Probably the former so we can expand to much larger terrains later. Perhaps region_offsets can be used to identify if regions exist.

@TokisanGames TokisanGames changed the title Height map import error Importing 256th region doesn't work Nov 1, 2023
@TokisanGames TokisanGames added the good first issue Good for newcomers label Nov 3, 2023
rds1983 added a commit to rds1983/Terrain3D that referenced this issue Nov 18, 2023
@TokisanGames
Copy link
Owner

Fixed in #250

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
big terrains Issues that need to be addressed for big terrains bug Something isn't working good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants