I found this volume cube node is helpful with making the sponge-like structure. However, I can only apply this effect on the cube. How can I apply this effect to others geometry, like cylinder?
For simple figures like a cylinder, you can check if the position of a voxel from top-down view is inside a circle. You can compare the result with texture using multiply or boolean and:
Sphere is easy also:
You can try to get more complex shapes like torus:
If you want to use a complex object, that hardly can be described using math, you can use boolean operation: