EdwardSmith1884 / 3D-IWGAN

A repository for the paper "Improved Adversarial Systems for 3D Object Generation and Reconstruction".
MIT License
195 stars 56 forks source link

Render with GPUin DataSetPrep.py #9

Closed li-zemin closed 6 years ago

li-zemin commented 6 years ago

Hello, I rendered pictures of multi views for 3D models with Blender. The versions of Blender is 2.79. And I want to speed the process up via GPU settings in Blender. I removed the annotations of several lines of code in render_model_views.py as follow:

bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
bpy.context.scene.cycles.device = 'GPU'
bpy.ops.render.render(True)

I run the DataSetPrep.py, but when I check the process in GPU card, I can't find blender. And is there any method to solve this problem? Thank you!

EdwardSmith1884 commented 6 years ago

Hi, there are 3 main rendering settings in Blender: Blender Render, Blender Game, and Cycles Render. Cycles is for rendering animations and is the only setting with GPU support. I tested just now and using the Cycles render is slower then the regular blender render with and without the GPU and it produces lower quality images. However if you still want to, the code would be:

bpy.context.scene.cycles.device = 'GPU'
bpy.context.scene.render.engine = 'CYCLES'

If that still does work I recommend opening the blender GUI, selecting the setting manually and seeing if there is an error.

li-zemin commented 6 years ago

Thank you for your reply. I clone your code from the repositories. And your new method for rendering is faster than this method.

EdwardSmith1884 commented 6 years ago

Ah yes, it's a lot more optimized