Optix 7.2 Build in Texture Mipmapping

Hi I don’t see any option for automatic mipmap generation for textures in Optix.
Is there a way for this to work?

The OptiX 7 API itself doesn’t know anything about textures.

Everything related to textures is managed with native CUDA host calls, creating array or mipmapped array data and texture objects, which are then accessed on device side by using CUDA texture fetch instructions you’ll find inside the CUDA toolkit header texture_fetch_functions.h.

As such there is not built-in mechanism to generate mipmap chains inside OptiX.
If you only have the level of detail 0 and want mipmaps, then you would need to generate these yourself somehow.

For the texture object creation part, you can find example code inside my OptiX 7 apps which can create texture objects with either the CUDA Runtime or Driver API calls for all possible texture targets (1D, 2D, 3D, cubemap) without or with mipmaps and without or with layers where available. But these functions only work on already available picture data.

These two sources are the comparison of the same functionality with CUDA Runtime and Driver API.
Look at all of the Texture::create functions in there.

Also note that there is no automatic method to put mipmaps inside the texture objects to good use inside a ray tracer.
You’d need to be able to provide the level of detail or derivative parameters used in the CUDA texture fetch functions with “Lod” or “Grad” suffixes.
For that you would usually implement tracking of differential rays inside the ray tracer which would allow calculating the current derivatives at a hit point which in turn lets the resp. texture grad function select the best mipmap LODs.

Thanks for your help.