MrForExample / ComfyUI-3D-Pack

An extensive node suite that enables ComfyUI to process 3D inputs (Mesh & UV Texture, etc) using cutting edge algorithms (3DGS, NeRF, etc.)
MIT License
2.21k stars 221 forks source link

Error occurred when executing [Comfy3D] Fitting Mesh With Multiview Images #167

Open q576333 opened 3 months ago

q576333 commented 3 months ago

Hi MrForExample, I found an issue that DiffMesh class on diff_mesh.py without the self.gs_params. It seems that miss the gs_params input. image

Following are my face issue in Multi-View-Images_to_3DGS_to_3DMesh(DMTet and DiffRast) workflow. image

807502278 commented 3 months ago

I also encountered it, it appeared after the last update

synystersocks commented 3 months ago

i also have this error, been through the scripts, as far as i can see is the params are shown in the nodes.py -

line 1097 -

with torch.inference_mode(False):

                gs_params = GSParams(
                    training_iterations,
                    batch_size,
                    ms_ssim_loss_weight,
                    alpha_loss_weight,
                    offset_loss_weight,
                    offset_opacity_loss_weight,
                    invert_background_probability,
                    feature_learning_rate,
                    opacity_learning_rate,
                    scaling_learning_rate,
                    rotation_learning_rate,
                    position_learning_rate_init,
                    position_learning_rate_final,
                    position_learning_rate_delay_mult,
                    position_learning_rate_max_steps,
                    initial_gaussians_num,
                    K_nearest_neighbors,
                    percent_dense,
                    density_start_iterations,
                    density_end_iterations,
                    densification_interval,
                    opacity_reset_interval,
                    densify_grad_threshold,
                    gaussian_sh_degree
                )

                if points_cloud_to_initialize_gaussian is not None:
                    gs_init_input = points_cloud_to_initialize_gaussian
                elif ply_to_initialize_gaussian is not None:
                    gs_init_input = ply_to_initialize_gaussian
                else:
                    gs_init_input = mesh_to_initialize_gaussian

                gs = GaussianSplatting(gs_params, gs_init_input)
                gs.prepare_training(reference_images, reference_masks, reference_orbit_camera_poses, reference_orbit_camera_fovy)
                gs.training()

                gs_ply = gs.renderer.gaussians.to_ply()

at line 1222 in nodes.py which passes

                mesh_fitter = DiffMesh(mesh, training_iterations, batch_size, texture_learning_rate, train_mesh_geometry, 
                geometry_learning_rate, ms_ssim_loss_weight, remesh_after_n_iteration, force_cuda_rasterize)

this is part of the - class Fitting_Mesh_With_Multiview_Images:

line - 1147.

i tried adding an input to the node, but i broke other things, any insight would be great :D

807502278 commented 3 months ago

You can add a parameter to the DiffMesh.prepare_training method in the diff_mesh.py file to replace self.gs_params.invert_bg_prob, and then expose it for calling in nodes.py,  or use the diff_mesh.py file of April 29 but add the latest DiffMeshCameraController class

But it's better to wait for the author to update.