def render_spec_component(jsd_dict): jsd_dict = copy.deepcopy(jsd_dict) for mat_name in jsd_dict['materials']: mat_jsd = jsd_dict['materials'][mat_name] if mat_jsd['type'] == 'svbrdf_inline': mat_jsd['diffuse_map'][:] = 0.0 with jsd.JSDRenderer(jsd_dict, ssaa=3, gamma=None) as r: r.camera.clear_color = (0.0, 0.0, 0.0) return r.render_to_image()
def render_specular_lightmap(jsd_dict, **kwargs): jsd_dict = copy.deepcopy(jsd_dict) for mat_name in jsd_dict['materials']: mat_jsd = jsd_dict['materials'][mat_name] if mat_jsd['type'] == 'svbrdf_inline': mat_jsd['diffuse_map'][:] = 0.0 mat_jsd['specular_map'][:] = 1.0 elif mat_jsd['type'] == 'beckmann_inline': mat_jsd['params']['diffuse_map'][:] = 0.0 mat_jsd['params']['specular_map'][:] = 1.0 else: raise RuntimeError('Unknown mat type.') with jsd.JSDRenderer(jsd_dict, **kwargs) as r: r.camera.clear_color = (0.0, 0.0, 0.0) return r.render_to_image()
def render_specular_albedo(jsd_dict, **kwargs): jsd_dict = copy.deepcopy(jsd_dict) new_mat_jsd = {} for mat_name, mat_jsd in jsd_dict['materials'].items(): if mat_jsd['type'] == 'svbrdf_inline': new_mat_jsd[mat_name] = dict(type='basic_texture', texture=mat_jsd['specular_map']) if mat_jsd['type'] == 'beckmann_inline': new_mat_jsd[mat_name] = dict( type='basic_texture', texture=mat_jsd['params']['specular_map']) elif mat_jsd['type'] == 'blinn_phong': new_mat_jsd[mat_name] = dict(type='basic', color=mat_jsd['specular']) else: new_mat_jsd[mat_name] = dict(type='basic', color=(0.0, 0.0, 0.0)) jsd_dict['materials'] = new_mat_jsd with jsd.JSDRenderer(jsd_dict, **kwargs) as r: r.camera.clear_color = (0.0, 0.0, 0.0) return r.render_to_image()
def render_jsd(jsd_dict, format='rgb', **rend_opts): with jsd.JSDRenderer(jsd_dict, **rend_opts) as renderer: image = renderer.render_to_image(format=format) return image
def render_full(jsd_dict, **kwargs): with jsd.JSDRenderer(jsd_dict, **kwargs) as r: r.camera.clear_color = (0.0, 0.0, 0.0) im = r.render_to_image() return im