Loading an HDR Image into a Metal Texture

I am working on implementing Image Based Lighting in a ray tracing project. In order to get the sampling to work predictably, I will need to load and process an HDR image into a MTLTexture.

While using a MTKTextureLoader to load .jpg and .png files has been super-smooth, loading a .hdr file in Swift seems to have a few barriers.

I have tried to follow the Processing HDR Images with Metal sample code [ Objective C ], but it relies on some finessing of pointers that I can't duplicate in Swift.

Is there currently a best way to move an HDR image into a Metal texture using Swift?

Thanks so much!

Replies

You could take the ObjC image loading code in the sample and access it in your Swift code via a bridging header.

There is an example from a user on GitHub that does this natively in Swift.
Very good, thanks so much! Will look through the Satin source code on GitHub.