3D-R2N2 icon indicating copy to clipboard operation
3D-R2N2 copied to clipboard

How to generating voxelized models & rendering images from the ShapeNet v1 dataset?

Open AlexsaseXie opened this issue 4 years ago • 17 comments

I only found a preprocessed dataset download link in your repo, but I'm interested in how voxelization and rendering is done from the original ShapeNet v1 dataset. Can you shed light on how these 2 processes are done or are there any code that I can refer to? Thanks

AlexsaseXie avatar Oct 29 '19 07:10 AlexsaseXie

Same question here. Do we need to "fake" camera intrinsic matrix?

YiruS avatar Nov 08 '19 23:11 YiruS

I am also very interested in this.

noamgat avatar Dec 03 '19 07:12 noamgat

totally agree, I have no idea about this issue. where can I find it ?

LifeBeyondExpectations avatar Mar 17 '20 03:03 LifeBeyondExpectations

The author released the rendering script in this commit. After some sort of modification you can use it to render the view images by blender --python blender_renderer.py.(Install blender first)

AlexsaseXie avatar Mar 17 '20 04:03 AlexsaseXie

As for rendering images, I modified the script (added some more features). I'll post a link to my repo when im finished.

markuspaschi avatar Mar 17 '20 11:03 markuspaschi

@markuspaschi Could you kindly share your rendering script?

hiyyg avatar May 01 '20 20:05 hiyyg

I modified the script and made it work on ShapeNet.v1/ Here are some hints (Working on Ubuntu 16.04):

  • If you install blender by apt install blender, the blender you got will be 2.76b and should have no numpy. You cannot easily install numpy for the python environment of blender.
  • You cannot import config even if it's in the same dir. Modify such import into a single blender_render.py instead.
  • Use for loop to render 24 views of each model
  • Use python.multiprocess or python.thread or blender -t to accelerate the whole process.

Optional: if you want to get the depth map as well, use OpenEXR first (thus blender's output format is OpenEXR) and then tranfer it into pngs you want.

AlexsaseXie avatar May 23 '20 03:05 AlexsaseXie

Hi @AlexsaseXie ,how did you set the value of "cfg.RENDERING.MAX_CAMERA_DIST" in blender_renderer.py? And could you please share anything else that need to be modified?

Yishun99 avatar Aug 25 '20 07:08 Yishun99

Hi @AlexsaseXie ,how did you set the value of "cfg.RENDERING.MAX_CAMERA_DIST" in blender_renderer.py? And could you please share anything else that need to be modified?

That value is 1.75. I got that from this link which tells you how to generate camera matrix from the parameters of 3D-R2N2.

AlexsaseXie avatar Aug 25 '20 07:08 AlexsaseXie

Thank you very much. @AlexsaseXie

Yishun99 avatar Aug 25 '20 07:08 Yishun99

I wrote a Master Thesis about 3D-Methods including Pixel2Mesh (in German). But my repository can be found here: https://github.com/markuspaschi/ShapeNetTools Go into DataSet_Tools/Renderer to find hints about how I used the blender renderer to create images. I changed some parameters, its probably not perfect (but it may be a starting point for some people).

markuspaschi avatar Sep 04 '20 07:09 markuspaschi

I modified the script and made it work on ShapeNet.v1/ Here are some hints (Working on Ubuntu 16.04):

  • If you install blender by apt install blender, the blender you got will be 2.76b and should have no numpy. You cannot easily install numpy for the python environment of blender.
  • You cannot import config even if it's in the same dir. Modify such import into a single blender_render.py instead.
  • Use for loop to render 24 views of each model
  • Use python.multiprocess or python.thread or blender -t to accelerate the whole process.

Optional: if you want to get the depth map as well, use OpenEXR first (thus blender's output format is OpenEXR) and then tranfer it into pngs you want.

Thanks for you sharing. When i run blender_render.py, i have met some errors, eg. KeyError: 'bpy_prop_collection[key]: key "Lamp" not found' AttributeError: 'BlendData' object has no attribute 'lamps' I have no ideal about how to deal with these errors. Have you met such errors? Thanks a lot.

DreamBlack avatar Dec 01 '20 06:12 DreamBlack

This may be late but you are probably using a new blender api (2.91) which doesn't support these attributes. You should use version 2.79 of blender and blenderpy, the first one is easy to install but I am struggling with the second one (blenderpy).

djaniak avatar Jan 13 '21 19:01 djaniak

Hi @AlexsaseXie, have you found how to generate voxelized models? I'm also interested in it.

Wi-sc avatar Jun 21 '21 10:06 Wi-sc

Hi @AlexsaseXie @markuspaschi , do you know why the colors of the model in rendered images are different in ubuntu and windows though I have set the color_model to RGBA ?

The model in meshlab

21388cc7-e0d9-4d00-b605-135402d6b534

In Ubuntu (blender 2.79)

01

In Windows (blender 2.79)

02

winnechan avatar Jul 25 '22 10:07 winnechan