panmari/stanford-shapenet-renderer

Lighting enhencement

Opened this issue · 1 comments

I found rendering lighting was somewhat dark to my application. Although I am very new to Blender, and I am not familiar with any kinds of rendering tools, I leave my solution here for those who desire similar enhancement. I increased lamp energies and added another light source at a different angle.

The below is a very vanilla solution. Please let me know if there is a better way. Since I am rendering objects at different view points, it would be better if lighting sources would consider that.

Original code:

# Add another light source so stuff facing away from light is not completely dark
bpy.ops.object.lamp_add(type='SUN')
lamp2 = bpy.data.lamps['Sun']
lamp2.shadow_method = 'NOSHADOW'
lamp2.use_specular = False
lamp2.energy = 0.015
bpy.data.objects['Sun'].rotation_euler = bpy.data.objects['Lamp'].rotation_euler
bpy.data.objects['Sun'].rotation_euler[0] += 180

My modification:

# Add another light source so stuff facing away from light is not completely dark
bpy.ops.object.lamp_add(type='SUN')
lamp2 = bpy.data.lamps['Sun']
lamp2.shadow_method = 'NOSHADOW'
lamp2.use_specular = False
lamp2.energy = 0.2              # <---- more energy
bpy.data.objects['Sun'].rotation_euler = bpy.data.objects['Lamp'].rotation_euler
bpy.data.objects['Sun'].rotation_euler[0] += 180

# Add one more light source at different location
bpy.ops.object.lamp_add(type='SUN')
lamp3 = bpy.data.lamps['Sun']
lamp3.shadow_method = 'NOSHADOW'
lamp3use_specular = False
lamp3.energy = 0.2
bpy.data.objects['Sun.001'].rotation_euler = bpy.data.objects['Lamp'].rotation_euler
bpy.data.objects['Sun.001'].rotation_euler[0] += 90
ldo commented

Typo:

lamp3use_specular = False

It seems to me a more general solution to this kind of need is to allow creating a template .blend file, with all the desired lighting, rendering and other setup, and have the script import the model into this.