spimort / TerraBrush

MIT License
723 stars 27 forks source link

Mac crash - fyi #139

Open fblair02 opened 2 months ago

fblair02 commented 2 months ago

Discussed in https://github.com/spimort/TerraBrush/discussions/138

Originally posted by **fblair02** September 18, 2024 May or may not be of interest b/c Mac. Godot 4.3 mono - Mac w/.NET) was rebooting randomly and hanging on save. Finally got a clean import to load, but when running the demo project/scene got this: ------------- Godot Engine v4.3.stable.mono.official.77dcf97d8 - https://godotengine.org Vulkan 1.2.283 - Forward+ - Using Device #0: Apple - Apple M1 Max ================================================================ handle_crash: Program crashed with signal 11 Engine version: Godot Engine v4.3.stable.mono.official (77dcf97d82cbfe4e4615475fa52ca03da645dbd8) Dumping the backtrace. Please include this when reporting the bug to the project developer. [1] invoke_previous_action(sigaction*, int, __siginfo*, void*, bool) [2] 2 libsystem_platform.dylib 0x000000018b67e584 _sigtramp + 56 [3] ResourceLoader::_thread_load_function(void*) (in Godot) + 1560 [4] WorkerThreadPool::_process_task(WorkerThreadPool::Task*) (in Godot) + 580 [5] WorkerThreadPool::_thread_function(void*) (in Godot) + 256 [6] Thread::callback(unsigned long long, Thread::Settings const&, void (*)(void*), void*) (in Godot) + 120 [7] Thread::~Thread() [8] 8 libsystem_pthread.dylib 0x000000018b64df94 _pthread_start + 136 [9] 9 libsystem_pthread.dylib 0x000000018b648d34 thread_start + 8 -- END OF BACKTRACE -- ================================================================ --- Debugging process stopped ---
spimort commented 2 months ago

Oh wow ok! 😮

So, were you able to see the scene in the editor before running it? Were you able to use the tools? I don't have a mac myself, so it will be hard to investigate for sure, but if it's something I can fix with your help, I'm down!

Let me know 🙂!

fblair02 commented 1 month ago

I played around with it for a bit yesterday. I can't get the demo scene/project to consistently allow me to get to the point of building the C# project - when I load it in the editor starts to render and it kills Godot.

I can get it to work to a degree if I start a new project and copy the addon into it. When I get the project set up and add a Terrabrush node, the terrain is black to transparent. I can't get it to paint textures or add objects or foliage, but it does appear to make the height deformations (it takes some maneuvering to see it, but it's there.).

I can save the scene, but when I try to exit Godot - either fully or out to the Project menu - it hangs and has to be force-quit. Once I do that, the project is corrupted or something - it crashes Godot before I can get the editor fully loaded.

I'll fire it up later and capture some video of the behavior - apart from that error, I'm not getting anything in the logs or on the console.

Also, I'm happy to help if I can.

fblair02 commented 1 month ago

I've attached MSBuild logs - some deprecation warnings, but no issues on the project build.

msbuild_issues.csv msbuild_log.txt

fblair02 commented 1 month ago

Alrighty - sorry for the delay; day job decided to get 'colicky'.

Here's some videos of project stuff. Should be fairly self-explanatory. DemoProject = working with the demo project; NewProject is just creating a new project and copying some things in. The big 'DemoProject' video is from the start; the smaller one is after the demo has crashed and trying to reopen it. Still nothing in logs.

https://drive.google.com/drive/folders/1L7mTt-tCtbt3SD5nDAhnSNvPJGRRTsJU?usp=sharing

Also, just as an aside, I'm very open to the idea that I'm doing something wrong; so let me know.

spimort commented 1 month ago

No problem for the delay, I have a full time job as well, I know what it is! 🙂

Ok, so for the first two vids, I don't know why it crashes. What I would recommend is to start the Godot with the console (does it exists on mac?). On Windows, I have another executable file called "Godot_v4.3-stable_mono_win64_console.exe". It allows me to start Godot from a terminal and have more logs. Maybe that would help to see what happens.

For the last vid, it's the most promising one! One thing I did notice is that you don't choose the right texture file for the Albedo. Take "Grass004_1K-JPG_Color.jpg" instead of "Grass004.png". The "Grass004.png" is just the preview of the result texture that comes from the website.

If you don't want the grass to be glowy, you can also take the inverted roughness.

Also, the crashes you got while painting comes from this I think. https://github.com/godotengine/godot/pull/95420 https://github.com/spimort/TerraBrush/issues/133

I'm waiting for a new version of Godot to make sure it works.

Also, when you do a modification on the properties of TerraBrush, make sure you hit the "Update Terrain" button (if the terrain is already created) located in the toolbar at the top. This will apply the modifications to the current Terrain.

Apart from that, I think that in a new project it kinda works, right?

Let me know if that helps! 🙂

fblair02 commented 1 month ago

Heya - thanks for that.

With a new project, it mostly works-ish. If it doesn't crash, Godot will hang on exit - either closing the project to go back to the Project menu or trying to exit altogether.

I can run from the console, but the output is pretty unsatisfying - basically, as soon as I edit a project, I lose console and it goes back to the terminal prompt:

Franks-MacBook-Pro-3:Godot_Plugins frankblair$ /Applications/Godot_mono.app/Contents/MacOS/Godot 
Godot Engine v4.3.stable.mono.official.77dcf97d8 - https://godotengine.org
OpenGL API 4.1 Metal - 88.1 - Compatibility - Using Device: Apple - Apple M1 Max

Project is missing: /Users/frankblair/GodotProjects/terrabrushtest/project.godot
Project is missing: /Users/frankblair/GodotProjects/TerraBrush/project.godot
Editing project: /Users/frankblair/GodotProjects/terrabrushtest-new
Franks-MacBook-Pro-3:Godot_Plugins frankblair$ 

Choosing the right albedo makes the texture look better, that's for certain - oopsie.

Unfortunately, any time I hit 'Update Terrain', the terrain disappears and it crashes out of Godot.

If I have a texture set up at the start, and hit 'Create Terrain' it will take that texture (looks nice) and I can deform it (even nicer). But if I don't - if I create the terrain first and then add textures - it won't paint the textures on the numeric grid. I can deform it, but no textures appear and 'Update Terrain' crashes out. It doesn't appear to corrupt the project file, though - I can go back in. Until I try to save and quit - it hangs on quit.

I also found that if I set up the project fresh - through building and enabling the plugin - but don't add the TerraBrush node - it still hangs on exit. TBH, I'm leaning toward the root problem being something with .NET and the Mac. In the interest of being useful, as well as ornamental, here's a dump from when I killed the hung Godot process:

KillProcessDump-2024_09_21.txt

This is the only C# project I've attempted on the Mac (I actually got the .NET version just for this plugin). I'll fire up a 'Hello world' C# project on the Mac to test the '.NET not paying nice with Mac' theory.

[UPDATE:] regarding - "TBH, I'm leaning toward the root problem being something with .NET and the Mac. "... it doesn't appear to be that. I found a sample project, imported it, built it, and it seems to work fine including quitting out. But it's not a plugin with tooling.

fblair02 commented 1 month ago

Also, as a followup - I mentioned getting a Windows laptop earlier - I set it up there and (spoiler alert:) it works great.

spimort commented 1 month ago

damn ok! I'm not surprised that it works on Windows since this is the OS I use, but I'm surprised about the Mac version.

Maybe something to do with the shaders/vulkan?

I wish I could test it on a mac but It's not something possible at the moment.

Can you try other plugins for godot in C#? Maybe from here : https://github.com/godotengine/awesome-godot

fblair02 commented 1 month ago

Well, it is not limited to this plugin. I picked up this C# plugin - b/c it looked useful, too - and installed it. It does the same thing re: hang on exit, even without actually using it. I can get further with it and as long as I save regularly it doesn't appear to harm anything; but I have to force-quit it when I exit the project.

https://cookiebadger.github.io/assetplacer-docs/index.html

It also doesn't appear to be plugins in general - SimpleGrass and Terrain3D both appear to work, separately and together. But there is some form of toxicity in the relationship between C# plugins and the C# Godot_mono on the Mac.

spimort commented 1 month ago

Oh ok ! I'm happy to hear that this is not my plugin, but I'm sad to see that this happens on mac!

I wonder if there is anything logged on the Godot Github Issues?

spimort commented 1 month ago

Maybe this? https://github.com/godotengine/godot/issues/94631#issuecomment-2246241278

fblair02 commented 1 month ago

So, I don't think it's that issue b/c that's related to exporting a project to run on MacOS. My issues are in the editor and I can't find a comparable setting in project settings.

spimort commented 1 month ago

ok I see! Have you tried to post this issue on the Github of Godot? Maybe they have ideas.