Karma Lens Droste Effect

Experimented with this because I wanted to see if I could make regular scenes wacky, and remembered Rob Pieke’s projection plugin in the Renderman docs.

The ‘Droste’ effect is used to produce Escher style results, as explained here

Current tests already give really cool results:

To achieve this I simply distort the rays that the physical (now not so physical) lens shader produces, which is less efficient than just applying this as a post process in comp. However, there are benefits to seeing the effect in the Karma viewport as you work.


I’ve tidied up the scene file a little and made it self contained (no external .vfl files), so hopefully you can dig into it.

Things of note:

  • I’ve simplified the lens shader so it’s based off of the “Simple Lens” example in the SideFX docs (https://www.sidefx.com/docs/houdini/solaris/karma_lens_shader.html)
  • Check the “Type Properties >> Code” tab of the /stage/camera_lens_material_library/drostelens1 definition, it contains the droste implementation
  • The camera shader is overriden in the “Camera >> Karma >> Lens Shader VOP” parm

Scene File Download

(click on the Houdini logo)

Building OpenEXR on Windows

I had issues getting a prebuilt version of OpenEXR working properly in my project so I decided to just build it myself, I ran into a couple of issues so I’ve quickly summarised them here incase anyone else has the same problem. In my case, I needed it to work on Windows 7 in Visual Studio 2013.

IlmBase Libs

IlmImf and other projects will complain about an error like this:

error MSB6006: "cmd.exe" exited with code -1073741515.

As explained in this Stack Overflow post, you have to manually copy the IlmBase libs (Half, IlmImf, Imath etc) into the OpenExr release/debug build directory  to successfully build.

Zlib unistd.h error

After I fixed that, I then got compile errors from within Zlib related to unistd.h being missing on Windows. Again, Stack Overflow saved my bacon and explained that you need to edit line 287 in zconf.h, changing

#if 1




After this I managed to build it properly and use it in my project.