group.set_param('geometry', [gmodel]) group.commit() instance = ospray.Instance(group) instance.commit() material = ospray.Material('pathtracer', 'obj') material.commit() gmodel.set_param('material', material) gmodel.commit() world = ospray.World() world.set_param('instance', [instance]) light = ospray.Light('ambient') light.set_param('color', (1.0, 1, 1)) light.set_param('intensity', 1.0) light.commit() world.set_param('light', [light]) world.commit() renderer = ospray.Renderer('pathtracer') renderer.set_param('aoSamples', 1) renderer.set_param('backgroundColor', (1.0, 1.0, 1.0, 1.0)) renderer.commit() format = ospray.OSP_FB_SRGBA channels = int(ospray.OSP_FB_COLOR) | int(ospray.OSP_FB_ACCUM) | int(ospray.OSP_FB_DEPTH) | int(ospray.OSP_FB_VARIANCE)
material = ospray.Material(RENDERER, 'obj') material.commit() materials = [material] if len(materials) == 1: gmodel.set_param('material', material) else: mindices = numpy.random.randint(0, len(materials), N, dtype='uint32') print(numpy.min(mindices), numpy.max(mindices)) gmodel.set_param('material', ospray.data_constructor(mindices, True)) gmodel.commit() world = ospray.World() world.set_param('instance', [instance]) light1 = ospray.Light('ambient') light1.set_param('color', (1.0, 1.0, 1.0)) light1.set_param('intensity', 0.8) light1.commit() light2 = ospray.Light('distant') light2.set_param('direction', (-1.0, -1.0, -1.0)) light2.set_param('intensity', 0.8) light2.commit() lights = [light1, light2] world.set_param('light', lights) world.commit() #print(world.get_bounds())