device side mipmaps

Hey,

I have mipmaps setup for my textures on the host side, but now want to set them up on the device side. I can use rtTexLod to load the various mipmap levels, but I can’t see anything in the examples on how to calculate the level to set based on the ray distance?

There are a couple topics on the forums about the state of mipmaps in the SDK but it seems to go back and forth based on how old they are.

Most mention the Ray Differentials example in the old SDK, but I understand that is being re-factored at this time.

Thanks,

-Colin

The technique of ray differentials doesn’t change and you can simply look at the old code of the rayDifferentials example in the OptiX 3.9.x versions.
The relevant OptiX API is also mostly identical, just some TextureSampler parameters went into the attached buffer parameters in the meantime.

You’ll find older SDKs via the “OptiX Legacy Downloads” link at the bottom of OptiX download page you reach by the “Get OptiX” link here:
https://developer.nvidia.com/optix
You can install all different versions of OptiX SDKs side by side on the same system.
I recommend to check the “do not create shortcuts” option during installation.

Code to upload mipmaps to the device can be found in the OptiX Introduction examples (07 und up) on github. https://devtalk.nvidia.com/default/topic/998546/optix/optix-advanced-samples-on-github/
(Performance tip: In contrast to how I’m doing it there, it’s potentially faster to map all mipmap level buffers of one texture at once, upload all mipmap images, and then unmap all buffers again.)