Houdini - Instancing Redshift proxies

General / 24 October 2020

Geoing along with the theme of abusing my machine's GPU, I've moved onto Redshift. Combined with Embergen (and now Houdini's minimal solver), my GPU is now officially the heavy hitter in my machine. Gotta find some work for the CPU to do! Initially, I was worried that 24GB of graphics memory wouldn't be enough for heavy scenes but it seems Redshift can smash through it no worries (with the correct scene setup). Here's what I've found so far:

Redshift is fast

Holy fuck was this a surprise. Coming from Mantra and Arnold, I was honestly shocked. A couple of weeks ago, I used Arnold to render out a single frame of a simulation done in Embergen, and it took 3 hours. Not only that, but it was still noisy! That was with Arnold GPU, Arnold CPU took around 30 minutes for the same noise level. When I set the same scene up in Redshift, the entire render was done in less than 20 seconds with NO noise! Redshift and Embergen together means a full simulation can be designed from scratch, simulated, and rendered in less than an hour.

Redshift's documentation sucks

Ok, it's not THAT bad but coming from Maya and Arnold it's seriously lacking. I miss having example files and images on every page of documentation. I didn't realise how much I took for granted the ability to just look up a menu item and have documentation pop up instantly. In fact, a lot of the time there wouldn't be any specific documentation at all. One other thing that they can't be faulted for is how whenever you try to Google Redshift help, the search results are overrun by Amazon Redshift and astronomical phenomena! 

Instancing large amounts of geometry

When I first tried out Redshift, one of the first things I tried was seeing how it handled instanced geometry. There's no guarantee that it'd work well but, you guessed it, it did. I found that Redshift is compatible with native Houdini instancing which was great at first. Made it pretty easy to just get going without much thinking. Using this method, I was able to get my scene up to 20 billion polygons without either Houdini or Redshift caring in any real way. The only issue was a large reduction in interactivity in the Redshift viewport. Luckily, this was easily solved using Redshift proxies.

Redshift proxies

One thing I found when trying to get Redshift proxies working in Houdini was that it was pretty easy to get them working. But! It wasn't quite as easy to get them working, instanced. You can't just load them in with a file SOP and if you use the visualise proxy node, it just brings it in as regular geometry negating any real benefit. The way that I found works is by using the instancefile attribute. To be fair, this is mentioned in the documentation, they just neglected to mention the best way to actually use the attribute. In hindsight, it seems to be the same way you'd use it in Houdini normally, but I'd never done it before so? Anyway, here's how it works:

  1. Save out your proxy files you want instanced. Make sure you're saving out .rs files and make sure their filenames are sequenced. I like to pad them to 4 digits just because why not? Remember to name them in sequence because it'll make it easier to load in later on.
  2. Slap down an attribute create on the points you want to instance to.
  3. Create a string attribute called "instancefile"
  4. Add the path to the file's you saved out including the filename and extension.
  5. Replace the sequence part of the filename with an expression that gives you a random number padded to the same number of digits as you did in the filenames. Assuming you have 3 .rs files you want to load and you padded them with 4 digits, here is an example expression:
padzero(4, fit01(rand(@ptnum),1,4))

I haven't actually verified the above expression because I'm away from my work machine at the moment (also why there's no screenshots), but it should get you going in the right direction.

After that, you just need to verify the Redshift instancing settings are correct at the object level and it should work fine when you render! Only issue here is you can't visualise it in the viewport. Except you can: by seperated out the render flag in the SOP level, you can make a seperate node branch just for viewport visualisation and another for rendering. The way I do it is put the render flag on the points I want to instance to and put the viewport flag on an instance to points node where the geometry being loaded in is a viewport compatible version of the redshift proxy. Depending on the setup, it might not be the exact same. As an example, unless you've used the same attribute for both branches, the instances you see at render time might not be the same ones you see in the viewport.

Conclusion

Sorry for the severe lack of imagery this time around, I had no access to my work machine and my macbook is currently incompatible with Redshift. Seems like that won't be true for long though with Metal support coming to Redshift in the near future! I hope this has been at least a bit helpful. It's fairly basic stuff but it could help someone I don't know? Catch you next time!