Today I revealed which ring was a photo of a real 3D printed ring and which was a computer render for my 2015 Freakin’ Sweet Knots Giveaway. The ring can be purchased here. I promised to show you the process I went through to match up a photo and render, so here it goes.

The idea for the contest came about in May of 2014 when I posted two pictures of rings to Facebook. One was a photo that I took with my iPhone with an attached macro lens, and the other was a computer render out of Blender. I didn’t have a lot of experience rendering realistic scenes, nor with Blender in general, but I wanted to give the Cycles renderer a serious try. I liked how easy it was to set up a scene based on realistic lighting conditions. I found that it’s much slower than a traditional rasterization renderer, but you need much less setup to get very nice results. Anyway, I was surprised when I posted the two photos that most people chose my render as the real picture. If you want to give it a go, here are the two from earlier in 2014:

twisted_ring_compare

I wasn’t all that happy with how well they matched up, but was surprised by the response I got when posting it. Just because they didn’t match up didn’t mean it wasn’t a fun game to identify the real one!

To stir up some social interaction around the holidays I decided to do it again. This time I wanted to get the photo and render as close as I could. I started by inspecting an image that I’d already taken:

DSC_0054-Edit-2

 

First, I made adjustments to the model that somewhat mimicked the process the actual ring went through when 3D printed.  The ring is 3D printed in wax, one layer at a time. The resolution that it is printed at is quite detailed, but still can’t capture the infinitely precise crevices that the original model has. To remove some of that detail and fill in those crevices, I rasterized the model to a level set and back to a mesh using stl_boolean, a command line tool I wrote as part of the stl_cmd suite that uses OpenVDB’s sparse volume representation. The process is similar to rasterizing vector graphics to an image, but a level set is made up of a 3D array of voxels rather than a 2D array of pixels. The resulting mesh better approximated what the ring looked like after being 3D printed (notice how the crevices are filled in).

voxelized

 

The mesh generated by stl_boolean was very dense, so in Blender I added a decimate modifier to bring the number of triangles from about 1.2 million down to around 220,000. The resulting decimation resulted in some tessellation artifacts, which you can see above. Those artifacts worried me until I found that they looked like natural nicks in the ring once rendered.

Next I wanted to address how rough the crevices are. After being 3D printed in wax, a plaster mold is formed around it. The plaster is fired, the wax melts out and is replaced with molten sterling silver. When the plaster is removed the surface finish is very rough. It goes through a couple polishing steps, but the crevices are very difficult if not impossible to smooth out.

I used Smart UV Project to generate UVs for the model. I used an angle limit of 33 and an island margin of .2. Then, using the Blender Renderer, I baked out an ambient occlusion map to an 8K image (possibly overkill, but I had a lot of triangles). I used just 20 samples so it would finish in a reasonable amount of time. Then I used Blender’s Dirty Vertex Colors to also include some of the curvature that was too subtle for ambient occlusion to pick up. I combined the two as a crevice map that I could use later. I turned off ambient occlusion, switched back over to the Cycles renderer and loaded the ambient occlusion map in through a texture. Here’s a render and node graph showing the crevice map:

crevice_map

 

After combining the crevice map with a noise map, feeding that into displacement and then using a mix shader to combine rough and polished silver materials, I got a good looking silver material!

silver_with_rough_crevices

 

Now I needed to start matching the lighting. I first tried to match the lighting in the photo above. I took some rough measurements of the two main lights I knew I was using as well as of the light box.

measurements1

measurements2

 

I used the measurements to rough out models for the lights and light box. I’m not a modeler so I was happy with these:

lamp_model

 

lightbox_model

After spending some time positioning the lights, I realized that it was going to be really hard to figure out the exact lighting conditions I had in the other photo. I used two lights as my main light source, but wasn’t really sure how I positioned them, and I also may have had some other lights including a window. Rather than waste a bunch more time trying to figure it out by trial and error, I decided to instead place the lights in a position that I could get them into in real life and retake my photo to match my render.

blender_setup_ss

photo_lighting_setup

That got me much closer, much faster!  I liked the reflection that I had in the original photo and I remember taking it on the back of a shiny piece of paper that came out of a picture frame. I had no idea what happened to that, so I grabbed a couple pieces of 4×6 photo paper. The material for the photo paper is pretty straight forward:

glossy_paper

 

After retaking the photo, I knew I had to make some minor changes to my material. The original photo was taken when I first got the ring. This photo was after the ring had time to tarnish, especially in the crevices. I darkened the crevices and added some orange to the rough silver material and I was happy with how it matched up.

 

In the end, I think the trickiest part was getting the camera position and depth of field to look correct. Blender allows you to specify camera settings like you would on a real camera, so I input the focal length of my lens and the f-stop I used for my aperture size. Unfortunately, using the f-stop setting didn’t get the right depth of field at all, so I switched to specifying a radius manually. I had no idea what the radius should be, so I did it all by look. Also, very subtle changes to the camera position and angle can dramatically change exactly what is in focus, so I spent a lot of time tweaking values. In the end this was the photo I was mimicking:

DSC_0003-Edit

 

 

And here is the render:

ring7

 

Thanks to everyone who participated and congratulations to Mary Beth from Raleigh, North Carolina who correctly identified the top ring as the real photo and was randomly selected from the 37 people who correctly guessed the top photo.

Leave a Reply


− 3 = five

Orders placed between May 7- June 10 will not be filled until the week of June 12th. As a thank you for your patience, please use coupon code SPRINGTIME at checkout to receive 25% off.