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

Out of Bounds Error with smoothing enabled #2

Open
Sternenwarte88 opened this issue Nov 20, 2023 · 5 comments
Open

Out of Bounds Error with smoothing enabled #2

Sternenwarte88 opened this issue Nov 20, 2023 · 5 comments

Comments

@Sternenwarte88
Copy link

Hey, don´t be harsh with me, it´s my first issue and I hope it´s okay,
I got an out of bound error when I got smoothing enabled.

IndexOutOfRangeException: Index was outside the bounds of the array.
NeuralTerrainGeneration.TerrainHelper.SetTerrainHeights (UnityEngine.Terrain terrain, System.Single[] heightmap, System.Int32 width, System.Int32 height, System.Single heightMultiplier, System.Boolean scale) (at Assets/NeuralTerrainGeneration/Scripts/TerrainHelper.cs:40)
NeuralTerrainGeneration.NeuralTerrainGeneratorTool.FromScratchGUI (UnityEngine.Terrain terrain) (at Assets/NeuralTerrainGeneration/Scripts/NeuralTerrainGeneratorTool.cs:282)
NeuralTerrainGeneration.NeuralTerrainGeneratorTool.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.TerrainTools.IOnInspectorGUI editContext) (at Assets/NeuralTerrainGeneration/Scripts/NeuralTerrainGeneratorTool.cs:122)
UnityEditor.TerrainInspector.OnInspectorGUI () (at <7aeb7d7a52d04045b8a1c734633fa931>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.b__0 () (at <7aeb7d7a52d04045b8a1c734633fa931>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I tried to debug with rider and noticed that in the function, rider debugger didn´t pass this following logic:

    float[,] newHeightmap = new float[width+1, height+1];
        for(int x = 0; x < width; x++)
        {
            for(int y = 0; y < height; y++)
            {
                newHeightmap[x, y] = heightmap[x + y * width] * scaleCoefficient;
            }
        }

It´s line 35 on TerrainHelper.cs.

If I turn of smoothing, the Terrain gots without errors generated. For reproduction, I made a new Terrain and I tried an Demo scene, where it also happends.

Worker type I tried it with different types, also Auto and Stigma and Kernel are set to Kernel:6 Stigma:3. I also tried different numbers but every time kernel /2 for stigma.

@hayden-donnelly
Copy link
Member

Hey, thanks for reporting this. Which Unity version are you on? Also did you install locally by cloning this repo, or did you install through the asset store?

@kellycode
Copy link

kellycode commented Nov 24, 2023

Took a look at this issue: Downloaded from asset store an hour ago. Same error with smoothing enabled. Created default terrain with no changes, no mats. Only happens with Worker Type "Auto" or "Compute Precompiled". All other workers work fine with the exception of "C Sharp Ref" seems to stick in a "Compiling Scripts" thread (I let it run for five minutes and killed the task).

Otherwise, extremely nice asset, very useful. Thank you

Unity Version 2022.3.13f1
OS: Windows 11 Version 10.0.22621 Build 22621
NVIDIA GeForce RTX 3070

@hayden-donnelly
Copy link
Member

Thanks for the info. I'll fix this as soon as I have the time.

@StephanLoecher
Copy link

Hey Sorry,
was longer not here, ehm yeah I got it from the Asset Store and got nearly the same specs. Only got an Nvidia GTX 1050 Ti.

@Slaverdure06
Copy link

Any update ? Stated using it from the asset store and the problem is still there!

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

No branches or pull requests

5 participants