sample blog banner copy.jpg

Blog

Goings on at the Because We Cannery

Revit to Radiance (via an expensive translator...)

So something I've done some work with over the years is a rendering engine called Radiance. Radiance is unique amoust rendering engines as it actually calculates the lighting, it doesn't 'fake' anything, so you can get some real design feedback from it. In other words, if your rendering looks bad, it means the lighting or daylighting is bad, and you've got design problems to fix. Most other rendering engines are focused on making a 'sexy' image ASAP (and rightfully so) and so you can't 'trust' the results for it's just faking everything.

However, Radiance isn't widely used because it's slower, harder, and requires you to know something about daylighting and lighting design to get good results out of it (that 'not faking it' comes back to bite you).  That and the fact that it's a very old school command-line Unix tool makes it's learning curve vertical, and if I didn't have a Unix god for a friend to pester with stupid questions I would have never learned it.

I've always felt that Radiance is kinda like the oil painting of Architectural Renderings: It's hard, and takes a long time to master, but will let you produce images no other medium can produce. Most rendering engines are more akin to watercolors, sketches, or airbrushed paintings: fast, loose, easy, and easy to make look great. Right tool for the job and all that, so Radiance isn't used much, 'cept by lighting designers, for most Architects just want a sexy image in the least amount of time possible.

Anyways, the right job came along, and I got to dust off my Radiance skills I haven't used in a while. We've got a project at my day job that's all Leeds and daylit and such. Had to get a good idea if it was really going to behave the way we designed it to, and Max alone couldn't get us there. However, seeing that we were doing the project in Revit, we had a nice, complete, clean model to work from. With a little bit of noodling I figured out how to go from Revit to Radiance with little pain (but a very expensive translator, sadly).

This is a 'falsecolor' image of the interior of the project, showing the lighting levels from the windows and skylight. The colors match that little legend in the corner, so that we now know how much natural 'free' light those tabletops are gonna get. Pretty cool, huh? (god I'm such a dork)

Here's what I do:
1. I export the 3D model from Revit as a polyface mesh to a DWG file, with elements turned on or off to filter out what I don't want in my final Radiance model.

2. I then file link that DWG into Max 8, which allows the Revit materials to remain 'intact'.

3. Revit likes to model glass as a solid plate. Radiance likes glass to be a flat plane. So in Max I select all the glass by going into the Material Library, setting it to only show the scene materials, picking the glass, and then using the very handy 'Pick Elements By Material' button on the Materials Palette. This then gives me all the glass. I then apply a 'Edit Poly' Modifier to the glass, and pick the 'Y' under 'Make Planer'. This 'flattens' all the glass, which as long as it's not horizontal (like in a skylight) fortunately for us has the y-axis pointing in the right direction to make this happen correctly.

4. I then export the model from Max as an .Obj file, with elements grouped by material, no normals, and faces set to quads. I've found this gives the cleanest mesh in Radiance so far, but I'm still tweaking with this to see if it can be better.

5. Then I use the Obj2Rad tool that comes with Radiance to convert the exported .Obj file to a Radiance file. I'm running Radiance under Cygwin using this fellow's wonderful pre-complied binaries. It's the easiest way to get it to work under Windows I've found. Someday I need to set up a 'heavy lifter' OS X or Linux rendering box I can SSH these jobs to instead, get them to run faster (Radiance runs at little better than half speed on Cygwin from what I understand)...

6. Now we are almost done. We need a .Mat Radiance material definition file to go with our .Rad file. what I do is use Awk, Grep, and Uniq to parse the .Rad file, pull out all the Material Names, sort them,  delete the duplicates, and then save them into a .Mat file. Once I get that process smooth I'll post it here, I'm still stumbling with it a little.

7. And now we're done! We just make a .Rif file, a sun definition file, and start rendering away. If we change the Revit model, we simply re-export to DWG, the change pulls into Max automatically next time we open that file, we re-export to .Obj, reconvert OBJ2RAD, and then we're ready to re-render.

Now. Here's a caveat. I'm cheap. so I'm trying to do this with the tools on hand. This company makes a version of Radiance you can use as a plug-in to Max, just as if it was vRay or some other rendering engine. I've used their demo, and it looks keen. but it's almost $2k worth of keen, so...

And someday I'd like to do this without needing Max at all. That would be swell. Gotta talk to some programmer friends of mine...

Jeffrey McGrew