Can I use my optix code as a plugin in Unity?

I currently have a standalone Optix application with its own renderer, but with my custom GPU code. I am evaluating adding this to a Unity project, can this work as a plugin in Unity? I see a UnityOptixPlugin in github, but it is 5 years old.

Welcome @brian.h.wagener!

Yes, I believe so. OptiX is just an SDK that you can use in almost any environment, provided you have an appropriate Nvidia driver installed. We don’t have Unity plugin expertise, so there may be some logistics for you to sort out there, but there’s no reason I’m aware of that you couldn’t use OptiX in a Unity plugin, and the old plugin project you found might be a nice precedent reference. This old plugin used OptiX 4, back when OptiX had it’s own separate DLLs. With OptiX 7, things might be even easier than before since the DLLs you need are part of the driver and found/loaded automatically. Do be aware that this plugin used OptiX Prime, which is does not leverage the RTX hardware and is now deprecated. The latest version of OptiX 7 has a sample in the SDK that is meant to demonstrate OptiX Prime - like functionality, called “optixRaycasting”.


David.

1 Like