Package: psdr-jit
psdr-jitPath-space differentiable renderer withdrjitas the numerical backend.
Old repo:https://github.com/uci-rendering/psdr-cudaInstallationWe useOptiX 7to accelerate ray tracing. Make surecudatoolkit(you may install it usingconda) and an appropriate NVIDIA display driver that supportOptiX 7are installed. The latest version we tested wascudatoolkit==11.7. Then runpipinstallpsdr-jitLocal IntallationTo installpsdr-jitlocally, first clone the repository recursivly (to include the git submodules):gitclone--recursivehttps://github.com/andyyankai/psdr-jit.gitorgitclonehttps://github.com/andyyankai/psdr-jit.gitcdpsdr-jit
gitsubmoduleupdate--init--recursiveThen compile and installpsdr-jitviapipinstall.Notice that it would also installdrjitaspsdr-jitdepends on it.cudatoolkitis also required.Getting Startedimportdrjitimportpsdr_jitExample of Diff renderingimportcv2importsysimporttorchimportpsdr_jitaspsdrimportdrjitfromdrjit.cuda.adimportFloatasFloatD,Matrix4fasMatrix4fDfromdrjit.cudaimportFloatasFloatC,Matrix4fasMatrix4fCsc=psdr.Scene()sc.opts.spp=32# Interior Termsc.opts.sppe=32# Primary Edgesc.opts.sppse=32# Secondary Edgesc.opts.height=512sc.opts.width=512integrator=psdr.PathTracer(3)sensor=psdr.PerspectiveCamera(60,0.000001,10000000.)to_world=Matrix4fD([[1.,0.,0.,208.],[0.,1.,0.,273.],[0.,0.,1.,-800.],[0.,0.,0.,1.],])sensor.to_world=to_worldsc.add_Sensor(sensor)sc.add_BSDF(psdr.DiffuseBSDF([0.0,0.0,0.0]),"light")sc.add_BSDF(psdr.DiffuseBSDF(),"cat")sc.add_BSDF(psdr.DiffuseBSDF([0.95,0.95,0.95]),"white")sc.add_BSDF(psdr.DiffuseBSDF([0.20,0.90,0.20]),"green")sc.add_BSDF(psdr.DiffuseBSDF([0.90,0.20,0.20]),"red")sc.add_Mesh("./data/objects/cbox/cbox_luminaire.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,-0.5],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"light",psdr.AreaLight([20.0,20.0,8.0]))sc.add_Mesh("./data/objects/cbox/cbox_smallbox.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"cat",None)sc.add_Mesh("./data/objects/cbox/cbox_largebox.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"cat",None)sc.add_Mesh("./data/objects/cbox/cbox_floor.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"white",None)sc.add_Mesh("./data/objects/cbox/cbox_ceiling.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"white",None)sc.add_Mesh("./data/objects/cbox/cbox_back.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"white",None)sc.add_Mesh("./data/objects/cbox/cbox_greenwall.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"green",None)sc.add_Mesh("./data/objects/cbox/cbox_redwall.obj",Matrix4fC([[1.,0.,0.,0.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.]]),"red",None)P=FloatD(0.)drjit.enable_grad(P)sc.param_map["Mesh[0]"].set_transform(Matrix4fD([[1.,0.,0.,P*100.],[0.,1.,0.,0.],[0.,0.,1.,0.],[0.,0.,0.,1.],]))sc.configure()sc.configure([0])img=integrator.renderD(sc,0)org_img=img.numpy().reshape((sc.opts.width,sc.opts.height,3))output=cv2.cvtColor(org_img,cv2.COLOR_RGB2BGR)cv2.imwrite("psdr_jit_forward.exr",output)drjit.set_grad(P,1.0)drjit.forward_to(img)diff_img=drjit.grad(img)diff_img=diff_img.numpy().reshape((sc.opts.width,sc.opts.height,3))output=cv2.cvtColor(diff_img,cv2.COLOR_RGB2BGR)cv2.imwrite("psdr_jit_diff_debug.exr",output)More Tutorialgradient evaluation tutorial intutorialfolderObject level optimization example:Neural-PBIR(ICCV 2023)Scene level optimization example:psdr-room(SIGGRAPH ASIA 2023)SDF+Nerf optimization example: to be releasedProject based on psdr-jitTBA