yinyunie / depth_renderer

Rendering color and depth images for ShapeNet models.
MIT License
86 stars 20 forks source link

Background not transparent #7

Closed YuQiao0303 closed 1 year ago

YuQiao0303 commented 1 year ago

Hi author! Thank you for this repo! Using the code, I succesfully get the rendered png images with black backgrounds. What if I want to have transparent background? I try the following code but it dosen't seem to work. Could you please help? if g_background_image_path == 'TRANSPARENT': if bpy.app.version < (2, 80, 0): bpy.context.scene.render.alpha_mode = 'TRANSPARENT' bpy.context.scene.render.image_settings.color_mode = 'RGBA' # else: bpy.context.scene.render.image_settings.color_mode = 'RGBA' # blender 2.8 bpy.context.scene.render.film_transparent = True # 0 for "SKY"; 1 for "TRANSPARENT

YuQiao0303 commented 1 year ago

I can't believe after trying for so long and finally propose an issue, and seconds later I found the solution. It's to set in 'setting.py': g_rgb_color_mode = 'RGBA' #'RGB'.

yinyunie commented 1 year ago

haha, thanks a lot for your effort. hope it can help others.