defold / defold

Defold is a completely free to use game engine for development of desktop, mobile and web games.
https://www.defold.com
Other
4.05k stars 288 forks source link

Broken 3D models have cumulative effect and lead to errors. #9183

Open errorstrike opened 2 months ago

errorstrike commented 2 months ago

Defold_report.zip

This error happens only with one type of models, but every time. How did it happen. I used Instant Meshes for retopology photogrammetry models from Scketchfab. I did it many times. Same models (with baked textures) worked well at Windows and Debug mod but didn't work in HTML5. I tried to use Blender tools to repair implicite defects of this type of models. After about 20th attempt, Defold starts to deny this type of model with 2 types of errors on screenshots below. I restarted computer, deleted projects, deleted Defold and downloaded it again, but nothing changes. Another models work well. So, I think, this broken type of models has cumulative effect. And I don't know how to return my PC in previous condition. However it is not so important for me, I can try to search another retopology tool. Microsoft Surface Windows 10. Note: models of this type looks well in Blender and Debug mod and Windows build, but they are broken implicitly. For example, after export from Blender the model distort in window of Blender, but after "Convert to mesh" looks well again.

Expected behaviour

Models which are made in Instant Meshes and Blender work like as any other models in Defold.

Actual behaviour

2024-07-08 Defold Report 2024-07-08 Defold Report2 At first 20 times this type of models only didn't work in HTML5, but after that, make errors on screenshorts every time. Another types of models works well.

Steps to reproduce

Make retopology of high-poly model in Instant Meshes, export in Blender 4.1.1, bake textures from original model, export as .glb without textures, but textures themselves exporting separatly. In Defold make Game object with Model component file with this .glb file about 20 times.


Build time2024-06-25T16:26:09.046426
Defold channeleditor-alpha
Defold editor sha3642fa5b700b8d6e74e3f0595e75cd50eff54459
Defold engine shad6882f432beca85d460ec42497888157c356d058
Defold version1.9.0
Error1329d36a55ea436fb63155c944d6ed3c
GPUIntel(R) Iris(R) Plus Graphics
GPU Driver4.6.0 - Build 31.0.101.2125
Java version17.0.5+8
OS archamd64
OS nameWindows 10
OS version10.0
JCash commented 2 months ago

Created a test project. issue-9183.zip

The build works on macOS and Firefox 127.0.2:

image

The editor complains about:

Caused by: java.lang.IndexOutOfBoundsException: null
    at clojure.lang.PersistentVector.arrayFor(PersistentVector.java:158)
    at clojure.lang.PersistentVector.nth(PersistentVector.java:162)
    at clojure.lang.APersistentVector.invoke(APersistentVector.java:293)
    at clojure.core$mapv$fn__8430.invoke(core.clj:6912)
    at clojure.core.protocols$fn__8144.invokeStatic(protocols.clj:168)
    at clojure.core.protocols$fn__8144.invoke(protocols.clj:124)
    at clojure.core.protocols$fn__8099$G__8094__8108.invoke(protocols.clj:19)
    at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
    at clojure.core.protocols$fn__8121.invokeStatic(protocols.clj:75)
    at clojure.core.protocols$fn__8121.invoke(protocols.clj:75)
    at clojure.core.protocols$fn__8073$G__8068__8086.invoke(protocols.clj:13)
    at clojure.core$reduce.invokeStatic(core.clj:6828)
    at clojure.core$mapv.invokeStatic(core.clj:6903)
    at editor.model_scene$mesh__GT_renderable_data.invokeStatic(model_scene.clj:160)
    at editor.model_scene$make_renderable_mesh.invokeStatic(model_scene.clj:284)
    at editor.model_scene$make_renderable_model$fn__75191.invoke(model_scene.clj:300)
    at clojure.core$mapv$fn__8430.invoke(core.clj:6912)
    at clojure.lang.PersistentVector.reduce(PersistentVector.java:343)
    at clojure.core$reduce.invokeStatic(core.clj:6827)
    at clojure.core$mapv.invokeStatic(core.clj:6903)
    at editor.model_scene$make_renderable_model.invokeStatic(model_scene.clj:301)
    at editor.model_scene$make_renderable_mesh_set$fn__75196.invoke(model_scene.clj:315)
    at clojure.core$mapv$fn__8430.invoke(core.clj:6912)
    at clojure.lang.PersistentVector.reduce(PersistentVector.java:343)
    at clojure.core$reduce.invokeStatic(core.clj:6827)
    at clojure.core$mapv.invokeStatic(core.clj:6903)
    at editor.model_scene$make_renderable_mesh_set.invokeStatic(model_scene.clj:316)
    at editor.model_scene$fn__75205.invokeStatic(model_scene.clj:332)
    at editor.model_scene$fn__75205.invoke(model_scene.clj:328)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.lang.Var.invoke(Var.java:384)
    at editor.model_scene$ModelSceneNode$behavior$renderable_mesh_set$fn__75411.invoke(model_scene.clj:421)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.model_scene$ModelSceneNode$behavior$renderable_mesh_set.invokeStatic(model_scene.clj:421)
    at editor.model_scene$ModelSceneNode$behavior$renderable_mesh_set.invoke(model_scene.clj:421)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at editor.model_scene$ModelSceneNode$behavior$scene$fn__75420.invoke(model_scene.clj:421)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.model_scene$ModelSceneNode$behavior$scene.invokeStatic(model_scene.clj:421)
    at editor.model_scene$ModelSceneNode$behavior$scene.invoke(model_scene.clj:421)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at internal.node$pull_first_input_value.invokeStatic(node.clj:1204)
    at editor.model$ModelNode$behavior$scene$fn__76506.invoke(model.clj:457)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.model$ModelNode$behavior$scene.invokeStatic(model.clj:457)
    at editor.model$ModelNode$behavior$scene.invoke(model.clj:457)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at internal.node$pull_first_input_value.invokeStatic(node.clj:1204)
    at editor.app_view$AppView$behavior$active_scene$fn__64762.invoke(app_view.clj:332)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.app_view$AppView$behavior$active_scene.invokeStatic(app_view.clj:332)
    at editor.app_view$AppView$behavior$active_scene.invoke(app_view.clj:332)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at internal.node$pull_first_input_value.invokeStatic(node.clj:1204)
    at editor.scene_visibility$SceneVisibilityNode$behavior$outline_name_paths_by_selection_state$fn__58192.invoke(scene_visibility.clj:117)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.scene_visibility$SceneVisibilityNode$behavior$outline_name_paths_by_selection_state.invokeStatic(scene_visibility.clj:117)
    at editor.scene_visibility$SceneVisibilityNode$behavior$outline_name_paths_by_selection_state.invoke(scene_visibility.clj:117)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at editor.scene_visibility$SceneVisibilityNode$behavior$selected_outline_name_paths$fn__58262.invoke(scene_visibility.clj:117)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.scene_visibility$SceneVisibilityNode$behavior$selected_outline_name_paths.invokeStatic(scene_visibility.clj:117)
    at editor.scene_visibility$SceneVisibilityNode$behavior$selected_outline_name_paths.invoke(scene_visibility.clj:117)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at editor.scene_visibility$SceneVisibilityNode$behavior$selected_hideable_outline_name_paths$fn__58245.invoke(scene_visibility.clj:117)
    at internal.node$trace_expr.invokeStatic(node.clj:44)
    at editor.scene_visibility$SceneVisibilityNode$behavior$selected_hideable_outline_name_paths.invokeStatic(scene_visibility.clj:117)
    at editor.scene_visibility$SceneVisibilityNode$behavior$selected_hideable_outline_name_paths.invoke(scene_visibility.clj:117)
    at clojure.lang.Var.invoke(Var.java:393)
    at internal.node.NodeImpl.produce_value(node.clj:295)
    at internal.node$node_value.invokeStatic(node.clj:454)
    at internal.system$node_value.invokeStatic(system.clj:354)
    at dynamo.graph$do_node_value.invokeStatic(graph.clj:840)
    at dynamo.graph$node_value.invokeStatic(graph.clj:843)
    at editor.scene_visibility$fn__58526$fnk58523_positional__58527.invoke(scene_visibility.clj:243)
    at editor.scene_visibility$fn__58526$fnk58523__58539$fn__58540.invoke(scene_visibility.clj:243)
    at editor.scene_visibility$fn__58526$fnk58523__58539.invoke(scene_visibility.clj:243)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at editor.handler$invoke_fnk.invokeStatic(handler.clj:256)
JCash commented 2 months ago

For the HTML5 build issue, could you see if the model.split_meshes property in game.project may help? It's a helper in order to split large meshes for platforms that don't support 32-bit indices.

image
errorstrike commented 1 month ago

2024-07-11 Github(1) Split meshes doesn't affect. But I used Empty project, but not Basic 3D project. Also, I used Google Chrome.

2024-07-11 Github(2) Basic 3D project also has the same error with this asset.

2024-07-07 Photogrammetry in Blender(025) Photogrammetry model has complex bugs and dangerous little enements. Manual retopology requare a lot of time. 2024-07-07 Photogrammetry in Blender(033) Instant Messhes makes 5-sides fases, holes and edges with 3 faces. And, may be troubles with normals. I think it's hard to Defold to read so broken model. Right now I am searching the way to avoid these troubles. It possible to make voxel remesh with big size of voxels, but I would like to save sharp edges and little details.

errorstrike commented 1 month ago

2024-07-07 Photogrammetry in Blender(081) I did win against this bug! I understood which model's troubles Defold cannot pass through! https://forum.defold.com/t/tutorial-3d-model-quality-in-blender-photogrammetry/77457?u=igrayuchi

errorstrike commented 1 month ago

https://github.com/errorstrike/Defold-3D-model-html5-bug It's just a simple 3D teplate, but with "Game object" file with the "Model" component and 2 ".glb". First ".glb" works in HTML5, second doesn't. But it is very similar models.

errorstrike commented 1 month ago

https://github.com/errorstrike/Defold-heavy-model-HTML5-bug It works in Debug and Windows, but not in HTML5. "Model-Split Mesh" doesn't help. I tried to repeat all steps like with previous model, but nothing happens. At previous time it was 20k faces. At this time 190k. For low poly map, it's enough for very large map, I think, about 1x1km. So, I test possibilities. And this model has size only 12Mb. So, it's possible to download in Browser! 2024-07-17 Gihub Report

errorstrike commented 1 month ago

I made the test of limitation of faces in HTML5. I made subdivision of Blender's monkey for 5 models and arranged them in the Scene. Models with 31k faces and higher are not supportesd in HTML5 (I used basic 3D temlate).

2024-07-13 photogrammetry(013)

errorstrike commented 1 month ago

In 1.9.1 8192x8192 thml5 texture uploading with 20k quads model became very fast.

errorstrike commented 3 weeks ago

2024-08-12 Drone Map Works2 Latest test 15 342 verts, 8192x9192. It works

britzl commented 3 weeks ago

Latest test 15 342 verts, 8192x9192. It works

Nice! Is that a free scene? Do you have some good high res test content that you can share?

errorstrike commented 3 weeks ago

I did view full list of photogrammetry apps and gaussian splatting apps. I bought 10mm lens for Canon crop-factor camera body. 3DF Zephyr is the most convinient and stable photogrammetry app with free or perpetual license at about $200. PostShot is the best and most simple Gaussian Splatting app. But Gaussian Splatting is not a mesh. The best choise is "Sugar" gaussian splatting mesh extractor. But is requaiers 24 GB VRAM (I have 6). So I plan to use 3DF Zephyr and publish some models at Sketchfab as downloadable or not downloadable. AI grab all downloadable models. I am participant of #Noai. For converting hi-poly photogrammetry to low-poly game assets I use "Instant Meshes" and Blender (but Autodesk Meshmixer and Meshlab can be useful sometimes). About licence: I don't remember licence of this model (at least is free for non-comertial use). But Scketch Fab has a lot of downloadable models which can be used for test. Models from my Canon-camera looks good in Defold. But Free version of 3DF Zephir has limitation of 50 photos. So right now I cannot make large scale model. The maximum is a side of building (with hi-detailes). My rought fast-made test model with 50 photos-limitation which works in Defold (includin HTML5): https://skfb.ly/pnLTW I plan to buy later: https://store.steampowered.com/app/438450/3DF_Zephyr_Lite_Steam_Edition/ Also instead of Instant Meshes it possiable to make entirely manual retopology. But it is for final assets. However, I would like to make all game engine tests with photogrammetry assets only to be sure that it will be work later. So I did start from photogrammetry.

selimanac commented 2 weeks ago