XPandora / PhysGaussian

[CVPR 2024 Highlight] PhysGaussian: Physics-Integrated 3D Gaussians for Generative Dynamics
939 stars 38 forks source link

Qusetion about config #26

Open SakuBorder opened 1 month ago

SakuBorder commented 1 month ago

Questions about PhysGaussian

Hello! I'm very interested in your work, but I have a few questions:

  1. How to define materials?

    • Is it correct that if I want a specific part to move, I should define the material for that part in the config?
  2. If the above is correct, what should I do if the moving part spans two materials?

  3. I noticed that when I use the metal material and modify the config (using the config provided below), I encounter the following error:

Warp CUDA error 700: an illegal memory access was encountered (/buildAgent/work/a9ae500d09a78409/warp/native/warp.cu:223)
Warp CUDA error 700: an illegal memory access was encountered (/buildAgent/work/a9ae500d09a78409/warp/native/warp.cu:223)
...
Warp CUDA error 700: an illegal memory access was encountered (/buildAgent/work/a9ae500d09a78409/warp/native/warp.cu:1136)
[E 06/04/24 21:21:36.171 20404] [cuda_driver.h:operator()@90] CUDA Error CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered while calling stream_synchronize (cuStreamSynchronize)

terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'

metal_config.json

{
    "opacity_threshold": 0.02,
    "rotation_degree": [0.0],
    "rotation_axis": [0],
    "substep_dt": 1e-4,
    "frame_dt": 4e-2,
    "frame_num": 125,
    "nu": 0.3,  
    "E": 2e11,  
    "material": "metal",
    "density": 7800,  
    "g": [0, 0, 0],  // Ensure g is a list with three elements
    "grid_v_damping_scale": 0.9999,
    "rpic_damping": 0.0,
    "boundary_conditions": [
        {
            "type": "cuboid",
            "point": [
                1,
                1,
                0.5
            ],
            "size": [
                0.5,
                0.5,
                0.28
            ],
            "velocity": [
                0,
                0,
                0
            ],
            "start_time": 0,
            "end_time": 1e3,
            "reset": 1
        },
        {
            "type": "particle_impulse",
            "force": [
                -1.8e-1,
                0.0,
                0.0
            ],
            "num_dt": 1,
            "start_time": 0
        }
    ],
    "additional_material_params": [
        {
            "point": [
                1.0,
                1.0,
                1.5
            ],
            "size": [
                1.0,
                1.0,
                0.5
            ],
            "nu": 0.3,
            "E": 2e11,
            "density": 7800
        }
    ],
    "mpm_space_vertical_upward_axis": [0,0,1],
    "mpm_space_viewpoint_center": [0.95,1.07,1],
    "default_camera_index": -1,
    "show_hint": false,
    "init_azimuthm": -36.7,
    "init_elevation": 8.96,
    "init_radius": 4.11,
    "move_camera": true,
    "delta_a": 0.4,
    "delta_e": 0.0,
    "delta_r": 0.0
}
zeshunzong commented 3 weeks ago
  1. No. currently the material is specified for all particles (or equivalently, gaussian kernels), although what you want can also be done as an easy extension.
  2. Long story short, you need to modify the MPM code a bit to allow different particles to work on different constitutive models.
  3. This usually happens when particles move out of domain. You can try to add bounding_box boundary condition.
SakuBorder commented 3 weeks ago

3. bounding_box boundary condition

Thank you for your response. Does this mean that:

1、For the various extensions you provided, such as plastic, metal, etc., I need to modify the MPM code according to the specific physical properties, rather than just changing the configuration file? 2、For these materials, is the bounding box boundary condition essential and needs to be determined based on the material?

zeshunzong commented 3 weeks ago

I think you misunderstood the mechanism behind MPM.

Say you have 100 particles in total. Currently when you set the material to be metal in the config, what really happens in the MPM solver is that you are simulating with 100 "metallic" particles, i.e. each particle following the metal's constitutive model. This constitutive model is invoked in the stress computation. If you want to have different materials for different parts (say left 50 particles are sand and the right 50 particles are metal), then you need to label each particle with its correct material. In the current codebase all particles share the same material label (underhood, just a scaler 0 1 2 3 for switch case). You would need to make the material into an array so that each particle stores its own material.

For the bounding box, basically cuda will complain if any one particle (regardless of material) is heading to infinity or so, the bounding box is to just add a safe box to bound all particles inside