def render_main(input_dir, output_dir, ms_rate, egl): os.chdir(os.getcwd()) shs = np.load('../env_sh.npy') # NOTE: GL context has to be created before any other OpenGL function loads. from lib.renderer.gl.init_gl import initialize_GL_context initialize_GL_context(width=RENDER_WIDTH, height=RENDER_HEIGHT, egl=egl) from lib.renderer.gl.prt_render import PRTRender render = PRTRender(width=RENDER_WIDTH, height=RENDER_HEIGHT, ms_rate=ms_rate, egl=egl) render_uv = PRTRender(width=RENDER_WIDTH, height=RENDER_HEIGHT, uv_mode=True, egl=egl) for obj_dir in os.scandir(input_dir): if obj_dir.is_dir(): subject_name = os.path.basename(obj_dir) render_prt_ortho(subject_name, output_dir, input_dir, shs, render, render_uv)
def testPRT(obj_path): n = 40 dir_path = obj_path.split("frame")[0] #os.makedirs(os.path.join(dir_path, 'bounce'), exist_ok=True) frame_name = obj_path.split("/")[-1].split(".obj")[0] subject_name = obj_path.split("pifu_small_train/")[1].split("/")[0] video_name = obj_path.split("/frame")[0].split("/")[-1] PRT, F = computePRT(obj_path, n, 2) shs = np.load('/home/ayushagarwal/PIFu/env_sh.npy') from lib.renderer.gl.prt_render import PRTRender rndr = PRTRender(width=512, height=512, ms_rate=1, egl=True)
def testPRT(obj_path, out_path='/home/ayushagarwal/PIFu/final_pifu_train'): n = 40 dir_path = obj_path.split("frame")[0] #os.makedirs(os.path.join(dir_path, 'bounce'), exist_ok=True) frame_name = obj_path.split("/")[-1].split(".obj")[0] subject_name = obj_path.split("pifu_train/")[1].split("/")[0] video_name = obj_path.split("/frame")[0].split("/")[-1] if os.path.exists( os.path.join(out_path, 'GEO', 'OBJ', subject_name, video_name, frame_name + '.obj')): print("Skipped ", frame_name) return None PRT, F = computePRT(obj_path, n, 2) shs = np.load('/home/ayushagarwal/PIFu/env_sh.npy') from lib.renderer.gl.prt_render import PRTRender rndr = PRTRender(width=512, height=512, ms_rate=1, egl=True) render_prt_ortho(obj_path, PRT, F, out_path, frame_name, subject_name, video_name, shs, rndr) del PRT, F, shs, rndr
type=int, default=0, help='yaw range lower bound') parser.add_argument('--yaw_high', type=int, default=360, help='yaw range upper bound') args = parser.parse_args() # NOTE: GL context has to be created before any other OpenGL function loads. from lib.renderer.gl.init_gl import initialize_GL_context initialize_GL_context(width=args.size, height=args.size, egl=args.egl) from lib.renderer.gl.prt_render import PRTRender rndr = PRTRender(width=args.size, height=args.size, ms_rate=args.ms_rate, egl=args.egl) rndr_uv = PRTRender(width=args.size, height=args.size, uv_mode=True, egl=args.egl) if args.input[-1] == '/': args.input = args.input[:-1] subject_name = args.input.split('/')[-1] render_prt_ortho(args.out_dir, args.input, subject_name, shs, rndr, rndr_uv,
type=str, default='/home/shunsuke/Downloads/rp_dennis_posed_004_OBJ') parser.add_argument('-o', '--out_dir', type=str, default='/home/shunsuke/Documents/hf_human') parser.add_argument( '-m', '--ms_rate', type=int, default=1, help= 'higher ms rate results in less aliased output. MESA renderer only supports ms_rate=1.' ) args = parser.parse_args() rndr = PRTRender(width=512, height=512, ms_rate=args.ms_rate) rndr_uv = PRTRender(width=512, height=512, uv_mode=True) if args.input[-1] == '/': args.input = args.input[:-1] subject_name = args.input.split('/')[-1][:-4] render_prt_ortho(args.out_dir, args.input, subject_name, shs, rndr, rndr_uv, 1, 1, pitch=[0])
'egl rendering option. use this when rendering with headless server with NVIDIA GPU' ) parser.add_argument('-s', '--size', type=int, default=512, help='rendering image size') args = parser.parse_args() # NOTE: GL context has to be created before any other OpenGL function loads. from lib.renderer.gl.init_gl import initialize_GL_context initialize_GL_context(width=args.size, height=args.size, egl=args.egl) from lib.renderer.gl.prt_render import PRTRender rndr = PRTRender(width=args.size, height=args.size, ms_rate=args.ms_rate, egl=args.egl) #rndr_uv = PRTRender(width=args.size, height=args.size, uv_mode=True, egl=args.egl) if args.input[-1] == '/': args.input = args.input[:-1] subject_name = args.input.split('/')[-1][:-4] render_prt_ortho(args.out_dir, args.input, subject_name, shs, rndr, None, args.size, 1, 1,