OpenImageIO
OpenImageIO copied to clipboard
an example program using OIIO's batched environment lookup
I've worked my way into some of the texture system code and wrote an example program using the batched version of OIIO::environment. I found the OIIO documentation sufficient but terse, so I think others may find my program helpful - it consists largely of comments. At the same time I'm trying to promote my library zimt, which I use for the boilerplate code to deal with the workload with multithreaded SIMD code. It turns out that zimt and OIIO work together nicely, there is little friction due to argument passing. zimt produces and accepts SIMDized data with 16 lanes, OIIO handles these data as batches and uses it's own flavour of SIMD internally. To make the program even more fun, there's a bit of Imath quaternion magic to deal with the directional vectors. Have a look, the code is here
The program is even quite useful: it produces an arbitrarily oriented and sized rectilinear view of the environment. Comments welcome - and if you lot at OIIO don't appreciate posts like this, let me know and I'll not do it again.
I enjoyed working with OIIO's 'environment' and 'texture' functions, and I wanted to use them in a 'real' program and compare them to other environment lookup code. This took up a life of it's own and resulted in the 'envutil' project, which currently has two programs: 'envutil', which can be used to convert between lat/lon and cubemap environment images (a bit like exrenvmap), and 'extract', a utility to produce reprojected and/or cropped images from lat/lon or cubemap environments. This is conceptually like a 'virtual camera' with which you can take snapshots from the environment. The github project page is here, and I've uploaded an experimental debian package. @lgritz: if you read this, maybe you remember our discussion of SIMDized texture lookup. In both programs, I use a technique which I call 'twining': in-lined supersampling with subsequent weighted pixel binning. This is fast and anti-aliases well (unless the scale changes are very large), and the code I present is SIMDized all the way through (the debian package has AVX2 code). My initial tests with this method yielded nice results, and I'd like to see it compared with other methods - I think it may turn out a valuable addition to the tool set, especially when processing speed is an issue.