-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Imported models are flat. #82890
Comments
I don't observe this behavior with my test models. You must provide a minimal reproduction project. |
@aaronfranke I did a fresh build of the master branch (v4.2.dev.custom_build [9e455f4]), created a new project, and the issue persists. Didn't think I needed to considering how visible and easily testable this issue is but I'll post just an empty project with my models imported. |
@KnightNine I tested the project you posted with Godot 9e455f4 and Blender 3.6.4 on macOS. It's not flat for me. Maybe it's a problem with the Blender version you are using? |
I can confirm that this happens and it's because of #81138. |
The issue goes away with a reimport for any reason. I tested both just re-importing with the import button and deleting the .import folder. So it seems the issue here is that the mesh upgrade path is not being triggered for this mesh. I will investigate further |
@KnightNine Can you please elaborate on how you created the MRP? When I reimport the model the issue goes away. The issue also goes away if I reimport from an earlier dev release and run it in current master. This indicates that the issue is specific to how you imported the model in. To be clear, I can only reproduce if I use the copy of the mesh in the .import folder. Anything imported in Master or older appears to work correctly. Accordingly, like AaronFranke, I am suspecting that the blender version be causing this issue |
@clayjohn |
Minimal Reproduction Project. I.e. "flatt test.zip" |
@clayjohn Anyways I downloaded a fresh version of blender a and tried enabling "Force Disable Compression" before reimporting.... the issue still persists. 💀 Idk where to go from here. |
Its definitely not hardware related as I get the flat model when using your .import folder. Did you update the version of blender in the Editor Settings as well (filesystem/import/blender/blender3_path)? |
@clayjohn I have a project that I use to test development versions, and since #81138 was merged, I've had various issues with the models, from them appearing flat to disappearing from the camera's view. It seems that the AABBs don't work even if I force the compression to be disabled. 2023-10-06.16-26-10.mp4Note: I did delete the .godot folder. |
yes I did. |
@clayjohn Ok, I've noticed something very strange. When I use the artifact from the master branch, these problems occur, but when I use a version that I've compiled from my own computer, everything works somewhat better. 2023-10-07.13-05-24.mp42023-10-07.13-08-36.mp4 |
Same here, the AABBs aren't correct even when compression is disabled. I'm gonna try to undo #81138 so that I can take advantage of godot's recent fixes without this issue until this is fixed. |
also faced issue with flat imported models with my project separate from repro posted, with latest master commit 6916349 I exported a simple model from blender (ver 3.3.1) to .obj, glb, and .dae to test (did not try .blend).
setting force_disable_mesh_compression to true in ResourceImporterOBJ.xml fixes the obj import for me |
the AABBs are still broken with .dae.
are the AABBs fixed with that method?
Strange, though I may be completely wrong, seems like a threading issue from my experience. The print causes a delay which allows something to update that would be unable to without it. Does the engine use threads for these base functions? |
sorry i wasn't clear. No, AABB wasn't fix for me as well with force_disable_mesh_compression = true, just mesh vertices. Also it seems flaky for me, just tried again with turning off compression, but it no longer fixes the mesh vertices either |
I am hoping for a workaround, as there seems to be no quick way of removing the PR merge from my fork of Godot with my limited knowledge of git if there even is a way. 😭 Edit: |
This might have been fixed by #83056 After careful testing again, I still can't reproduce the issue properly. Loading the MRP I can observe the flat meshes, but inspecting the meshes, it is clear that they have been saved in a way that is broken. Accordingly, the issue likely lies in the importer or in the way the meshes were formed/saved originally. For me, the meshes are always fixed on reimport. A few points from above are especially interesting:
Investigating a little further led me to #83169 which may help this issue. Since I can't reproduce on my hardware, I am just guessing. But implicitly converting the 64 bit version to 32 bits and back could explain this issue. It also makes sense with the observed behaviours listed above. As the exact behaviour will be undefined in this case. Could someone who is building locally test on master with #83169 applied and let me know if it fixes the issue? |
Re-opening until we have confirmation that this is fixed. I'm still not sure |
@clayjohn Problems persist |
@LiveTrower Problems persist after pulling from master and building fresh in the last hour and reimporting your models? Can you also let me know what system and build settings you are using? |
@clayjohn I tested the artifact from the master branch v4.2.beta.custom_build [b137180] and the problem persists, but it seems that the artifact from PR #83169 wasn't compiled. |
@clayjohn
@clayjohn just to clarify on this since I didnt pay attention to AABB on this first post, only on mesh vertices:
|
@kevinkuo52 |
I've now tested on a Windows 10 system to see if its a Windows related issue and I still can't reproduce. I have also tested debug and non-debug builds to see if that is the issue and can't reproduce (both on Linux and on Windows). I'm going to keep investigating, but it is challenging to confirm anything without being able to reproduce the issue. Because the AABBs are broken both when using compressed and uncompressed, it seems there is something broken with calculating, storing, or retrieving the mesh AABBs. I will investigate that further and see if I can identify a situation where AABBs may change depending on build, OS, or hardware. |
Okay, I've made another PR that might help with this. I can't find anywhere where the AABB generation has changed. So my current theory is that at certain points of the pipeline the mesh is treated as compressed, while at others it isn't, leading to a disconnect between the size of the AABB and the underlying surface data. Please test it and let me know if it helps |
@clayjohn I tried PR #83211 but everything remains the same. |
Is there any chance that you are accidentally testing an old build? Perhaps a build with a slightly different name/config? |
I don't think so. 2023-10-12.15-44-58.mp4 |
some more notes:
I can't seem to have break points hit if i dont build it with dev_build=yes, even with -e arg pass in to launch straight to editor. Will see if i can fix that or ask in new contributor channel to unblock. |
@kevinkuo52 I have no issues with command scons platform=windows for 64 |
since scons platform=windows for 64 works for LiveTower, maybe root cause is different. after debugging for some time, i believe the issue is related to how the aabb variable here got optimized out weirdly by the compiler (maybe because of some code logic pattern on aabb) compile with compile with optimize=debug instead or when printing aabb once: Assembly: aabb optmized out:
aabb not optmized out
I will continue this direction |
@kevinkuo52 That seems very likely. It must be a compiler-specific issue which is why AaronFranke and myself can't reproduce. Looking at the code with your post in mind. I am struck that there is a situation where the AABB may not get set at all: namely, when the mesh does not use normals or tangents. In that case, we fill the vertex array with positions only and then move on and godot/servers/rendering_server.cpp Lines 459 to 473 in fd33c7b
Instead of operating on
|
Looks like I am able to reproduce the issue now, but only on Windows and only when using compiled builds from our Github Actions (I tested https://github.com/godotengine/godot/actions/runs/6576288429/job/17865371862 for reference). Building locally with the exact same options does not reproduce the issue. My exact compiler version is MSVC 14.36.32532. For those of you who can reproduce the issue when building locally, can you also post what compiler version you are using? |
@clayjohn |
Just to clarify,
Tried it, it does seem to mitigate the issue. Tho not sure if its an actual fix, suspect there's some underlying issue that cause aabb to have weird behavior when optimized out? Side note: I see it's set here |
Arrays can also be created by users directly with the ArrayMesh. In which case both floats and doubles are accepted. SurfaceTool always uses floats though and that is fine. |
My working theory is that the compiler sees that |
Godot version
v4.2.dev.custom_build [f71259b]
System information
Windows 10
Issue description
IT'S FLATT!?!?
My custom changes shouldn't affect this but can someone confirm that this happens in the raw build?
Steps to reproduce
Minimal reproduction project
flatt test.zip
The text was updated successfully, but these errors were encountered: