Hello, Sunflow.

OpenGL render of generative ityscape+ View larger.

So, you guys saw a still like this from the last time I posted. Basic OpenGL stuff with a couple lights and some simple cube-like structures. Immediately after getting that far, I wanted to get this stuff rendered in Sunflow. Now, Sunflow is an open-source global illumination renderer built with Java. But at it’s core it’s a ray tracer, which basically means you’ve can make stuff that looks real because it simulates real light rays. Moreover, it has different kinds of cameras… and one of those cameras can render a pretty realistic depth of field and even bokeh.

Here’s the thing, I’m working in Cinder, which means I needed to write something that took my geometry and dumped out a Sunflow Scene File (.sc). But first, I had to figure out how the hell to get the OpenGL viewport projection matrix mapped correctly to the Sunflow camera — and moreover, I had to figure out how to take all these OpenGL transformations (rotate, translate, etc.) and turn them into something Sunflow understood.

Today, I finally wrapped my head around the two main OpenGL matrices. I’ll go into the specifics for folks that are interested in a later post, but the point is this: I can write code and render stuff using OpenGL in Cinder, press a key, and dump out all my Sunflow Scene File data (to the console for now).

Here’s what the above image looks like when it’s rendered with a couple point lights and a pinhole camera:

Sunflow render of generative cityscape with a couple point lights+ View large.

And here’s what it looks like with ambient occlusion (and no point lights)!

Sunflow render of generative cityscape with ambient occlusion+ View large.

But that stuff’s not too interesting. What’s interesting is what happens when you start playing with the sunsky light and the thinlens camera:

Sunflow render of generative cityscape with sunsky light and depth of field+ View large.

And here’s what happens when you play with the Phong shader and too many lights and don’t want to tweak things until they actually look good!

Sunflow render of generative cityscape with point lights, a spehere light, and a Phong shader+ View large.

All of this has me excited because now I can move quickly with framing and general colors and textures and such in OpenGL, then get super-nice renders from Sunflow. Yay open-source!

  • http://www.airtightinteractive.com felix

    now you’ve done it! how long do those renders take?

  • http://www.mikecreighton.com Mike Creighton

    Those last two probably took about an hour each. They’re 1280×720. I had antialiasing turned up fairly high with a good number of samples for each light source, so I could get really soft shadows. Also, using that thinlens with a really shallow depth of field requires a lot of extra time.