Facepunch / sbox-issues

173 stars 11 forks source link

Saving terrain with large (or differently sized) heightmap #5933

Open crz144 opened 1 month ago

crz144 commented 1 month ago

Describe the bug

After creating a new minimal project and attempting to add a terrain node with an 800x600 height map of solely black and white pixels (attached below), the editor immediately crashed upon saving it. Attempts to open the project from the editor afterwards would put up the splash screen and follow the normal process before promptly crashing with no output. Only clue in the log is on the last line: "tryna compile c:/users/crzur/documents/s&box projects/bhop/Assets/randterrain.tmat"

Seems to be due to image size (and not the fact it's a .png instead of .tga), as 16x16, 17x16 and 17x17 png worked.

To Reproduce

  1. New minimal project
  2. Create terrain node.
  3. Inspector -> Terrain -> Create New Terrain
  4. Once saved, New Terrain Material -> Save
  5. In .tmat inspector, adjust height image to included heightMap.png
  6. Save with the icon at the top, editor crashes and project cannot be opened until terrain associated files are removed.

Expected behavior

If heightmap texture of different size than other elements is supported, the editor should not crash upon saving it. If this is not a supported scenario, an error message noting the requirements for this field should be displayed.

Media/Files

heightMap Log.16.log

Additional context

No response

handsomematt commented 1 month ago

I will fix the crash as that's horrible. I have to wonder is the UX that bad that you're trying to import a height map in a terrain material instead of the big Import Heightmap button.

crz144 commented 1 month ago

My experience (without knowing anything about the Terrain system and low 3d game dev experience):

  1. Inspect Terrain
  2. "Import From Heightmap" header empty (image below)
  3. "Create New" -> "Create New Terrain" -> save.
  4. Import... -> Don't have any of those file types
  5. "Import Splatmap" png, no effect.
  6. Eyes drawn to big terrain materials section
  7. Browse button has no effect due to #5937
  8. New Terrain Material
  9. "'Height Image', that's what I wanted to do a second ago"
  10. Above ensues, project bricked

If you want an opinion, Point 5 in particular should give some feedback about what's wrong with the image I've provided, or what dependent elements are not yet configured. That combined with the error for this case should protect the user from their inexperience.

Point 2: image

handsomematt commented 1 month ago

I've fixed the crash, let me improve the UX.