Advanced Donut Rendering

CS348B - Image Synthesis

Juan Sepulveda - Ideal Torus, Texturing, and Modeling.
Meng Yu - BSSRDF.

Date submitted: 6 June 2005
Code emailed: 8 June 2005

Click HERE to get the submission image! (1280x1440)
(it may be better to select one at the bottom of this report...)


We choose to render the most photorealistic donuts ever by using Matt Pharr and Greg Humphrey's Photo Realistic Based Renderer (PBRT, see ( Due to their nearly ideal shapes, and the availability of hot glazed donuts, we chose to model the "doughnuts" of Krispy Kreme Doughnuts. Although it was our intent to emulate actual advertising, this project was non-for-profit and for educational purposes only.

Here we will discuss various developments in the project. Donuts are delicious cakes, encapsulated in a flaky layer of dried honey glaze. To represent them correctly we need to utilize various forms of techniques.

Initial Tests

Using Direct Lighting Integrator. 2 samples. 31.4s.

Using Irradiance Cache Integrator. 64 samples. 275s.

Using Path Tracing Integrator. 2 samples. 193.1s.

Using Photon Mapping Integrator. 2 samples. 155.7s.

Using Whitted Integrator. 64 samples. 136.4s.


The "inner sphere" contained inside the glass.

Close up of the dough ball.


These images show some initial experimental results on what PBRT can already do. The three items test three concepts. First on the left, we apply the "windy" texture often used for waves as a bump map, to create a dough ball. Second in the middle, we try to encapsulate a bump-mapped ball inside a smooth glass ball. This is not possible with a direct lighting model so we have to use another kind of surface integrator. Third on the right, we draw the killeroo in glass to demonstrate that enclosed triangle meshes can indeed be made out of glass (because a volume that is not enclosed can not.

From an analysis of the integrators it seems that the path tracing or photon mapping techniques are the most appropriate for drawing donuts. However if we could draw the donut as one object (like the doughball), then draw the glaze as a transparent shell (like the killeroo), then we might benifit greatly from using the Whitted integrator.

If possible we must try at all costs to use the direct lighting integrator for speed. We found that good results are possible with direct lighting if the scene is set up similar to photography studio lighting, which we will return to at the end of the project.

"Cooked" Dough

Our process of cooking the dough simply involves adding a spectral texture map to the object that already holds a bump-map. Our texture is a color gradient with brush stroke noise added. The colors from the gradient were sampled from actual donut photography.

Ideal Torus


Next we decided to implement the ideal torus shape. This required a few heavy changes to the sphere shape. Namely, torus intersection is solved by evaluating a quartic, rather than quadratic function. This provides a two-fold problem. The amount of variables involved in the solution is rather substantial, and the multiplication of many many parameters propogates error. The first of these is solved by the compile, while we found good results solving the second by increasing the numbers to doubles during calculations. Be wary of quartic solvers. The first Quartic solver we tried was incapable of solving for various solutions. This manifest itself as a series of samples missing, as is shown here:



We later found a CORRECT quartic solver by Thomas Kraska from the University of Koeln at:



Finally we use our "cooked dough" technique to generate the donuts. The texture-map / bump-map combination continues to create a baked like look, and by incereasing the reflective property we can make the cake look more or less fried. This leave us to implement the rest of the donut.

Utilizing Modeling Tools

At this point, we have to make the move into manual modeling tools to achieve the next level of realism. To do this, we utilized Maya to draw polygon formed tori and then perturb them by hand. After this we would triangulate them, export them to Wavefront OBJ format, and use Mark Colbert's Wavefront shape plug-in, which he distributes at

A very relistic "dough" deformation can be simulated by selecting a sub-group of closely spaced vertices and either translating them or scaling them. The following is an initial result:



The donut on the left is our original ideal PBRT torus. The donut in the middle has gone through a slightly non-affine transformation, the bottom has been pushed up and the top has been extended, creating dough weight. Then, the donut on the right has taken this and much more perturbation, including a lateral scale to end up slightly more oblong elliptical than the ideal circular tori. Still, all these models retain our same bump- mapping and texture mapping techniques of before.

Procedural "Nature" via Modeling Tools

The next level of complexity was to create imperfections in our donuts procedurally. This is contrary to the "hand perturbed" right-most donut shown above. Now, we intend to break our torus model from a rigid body object to a soft body object. In a rigid body the interrelations between all sub-objects (vertices, faces, etc.) must remain constant. Meanwhile, in a soft body, each sub-object is considered it's own object, creating a particle based system where each vertex is a particle. Putting these particle through a dynamic motion field causes the whole object to become soft, like the dough we are trying to simulate.


Ideal weighted donut vs. field perturbed donut.

Rendering of the field perturbed donut.


The figures above show an example. This donut has undergone a vortex field and a turbulence field. The vortex field, which applies centrifical force of a spinning system to all particles, is a good one for circular dough-made objects such as this. It is equivalent to putting the uncooked donut ring on your finger and spinning it around like a hula hoop. Meanwhile, the turbulence field emulates stresses caused by throwing the donut around. In this case, forces from the two donut sides colide causing the donut to become more oblong in the perpendicular direction.

Texture Mapping a Printed Box

It's not often easy to apply texture mapping to photo-realistic objects because the majority of items in the real world don't require photographic texture mapping (textures scanned or photographed). Even when texture mapping is applied it is usually procedural, such as a wood grain, or a wrinkle in aluminum foil. Some items however, lend themselves nicely, such as a poster on a store window or in this case, a donut box:


Realistic box modeling

Some empty boxes for our final scene.


The textures were scanned off an actual 6-donut Krispy Kreme box. However, there's a catch. This box as shown does not exist in real life. Real 6 donut boxes from Krispy Kreme open vertically and not horizontally. We swapped and extended the scanned box faces in Photoshop to create this special edition box.

Further implementation details include the face choosing and hinging. Since we only use one surface texture to draw each box face, we must take care to decide if we're looking at the back of the face or the front. When looking at the back of the face, we must map it with a blank white face. Meanwhile, for moving the hinge of the box, some amount of transformation magic had to be done. The original box model is made as shown above at a 60 degree angle opening. It was only after we decided to open it by different amounts, by using translations and rotations in the appropriate order. This is overcomplicated by the fact that the box origin is at the box center, and not on the box hinge.

Modeling Milk

What would be better to go along with some donuts than a glass of milk? (DON'T say coffee!) To create a glass of milk we aquired a 3D Studio Max model of a glass from Baumgarten Enterprises We converted this into an obj model using Bill Sherman's quick3D program, which you can find at


Empty glass using irradiance caching.

Full glass using irradiance caching.


Modeling the milk inside the glass proved to be the most difficult part. We had to open the glass in Maya and use the boolean difference and union operators to create a milk solid. Then we had to scale this down slightly and render it using irradiance caching to get through the double diffraction of the glass. In the end, because of the massive increase in rendering time, we decided not to insert the glass in the final scene.

Cold Donuts Anyone?

This section could also be called Texturing 101. In order to create glazed donuts, the most popular of all donuts, we took the texturing and material capabilities of PBRT to the fullest. This final surface has:
  • a bread like spectral texture map for diffuse lighting.
  • a white specular microfacet lighting
  • a bump mapping based on the windy procedural texture
  • a procedural cloud texturing, generated with Photoshop, run through a "mix" texture with the yellow diffuse texture
  • ideal specular reflection via the BSDF.
Which gives us this result:



We spent some amount of time looking at a Krispy Kreme "cold" glazed donut to get this to be perfect. The cloudy texture represents scattered air trapped under the glaze surface. This happens when the glaze is cooling. When the donuts are fresh however, the glaze is still liquid causing a rather different effect...

HOT Donuts Anyone?

The last and culminating step in our project is the implementation of BSSRDF. This also indicates our choice of Krispy Kreme donuts for their hot glazed donuts. Donuts look considerably different between when they are hot and after they get cold.


1. Single Scattering

We followed the algorithm described in Jensen et al. [2001]. For a given pair of (wi, wo), we computed the refracted direction of the outgoing direction and randomly sampled along the refracted ray. With the incoming direction wi, we were able find the intersection of the incoming ray with the surface pi. About half way through our project, we found a recently developed technique for single scattering approximation by Wang et al. [2005]. The authors are inspired by Jensen et al. [2002], which decouples the sampling and computation of illumination in diffuse scattering. The paper presents a similar approach for single scattering. Instead of sampling along the refracted ray, the algorithm samples along the normal vector of the outgoing ray to make precomputation feasible. The paper proves that the approximation achieves high performance and yet generates high quality images. If we had more time, we would be very interested in implementing this algorithm and comparing it with the traditional computation.


2. Diffuse Scattering

Our implementation was based on Jen et al. [2002]. We uniformly sampled the torus in the theta and phi dimensions to compute the irradiance at the sampling positions. We implemented both direct lighting and photon mapping to calculate the irradiance. Our final images are rendered with the direct lighting surface integrator. The image below shows a distribution of the sampling points around the torus surface (generated by an OpenGL program). During the integration steps, originally we stored the samples in a 2D array and only integrated samples around the intersected point, since the contribution of samples follows an exponential fall-off. This worked fine with simple environments, but failed when the lighting setup became complicated and the integration missed important points; where the illumination is high. So instead, we stored the irradiance samples in an octree, which kept track of the clustered values of all samples in the tree nodes. The integrator summed up the values (weighted by diffuse reflectance) in the tree nodes. An error function was used to decide when to stop traversing down the tree. We didn't get a chance to implement the sampling on a trianglemesh, which would give us more flexibility to render other translucent objects such as the milk.

Subsurface Scattering allows us to scatter diffuse and specular reflection around the torus surface, giving the glazing effect. The following image shows the light scattering on a vertical torus.



Scatter of the BSSRDF


3. Glaze material

We tried various combinations of different reflection models with different coefficient values to obtain the correct light interaction on sugar glaze. We tried modeling the glaze as a separate layer from the dough (i.e. one torus inside of the other), but the outer layer doesn't allow enough light to go through and the bump mapping in the inner layer is completely blocked. Our final glaze material contains:
  • diffuse reflection, microfacet reflection (it attaches shininess)
  • fresnelblend (it enhances the blending across multiple layers)
  • specular reflection (with a relatively low portion, it makes the surface smooth, without completely covering the bump mapping)
Which gives us this result:

Before Glaze


The Donut Exposition

Finally we are poised to create a full order of donuts for all tastes. For this, we also created a model of Krispy Kreme's jelly donut.


Donut 0: Hot Glazed

Donut 1: Cold Glazed

Donut 2: Chocolate Iced Glazed

Donut 3: Vanilla Iced Glazed

Donut 4: Strawberry Iced Glazed

Donut 5: Maple Iced Glazed

Donut 6: Sugar

Donut 7: Chocolate Iced Creme Filled

Donut 8: Chocolate Iced Custard Filled

Donut 9: Glazed Lemon Filled

Donut 10: Glazed Rasberry Filled

Donut 11: Powdered Blueberry Filled

Donut 12: Dulce de Leche


Jelly donuts were modeled by deforming a sphere into a disk in Maya, adding "weight" to the dough by shifting certain vertices, and then calling the same turbulence field techniques from before on the model. Creme for all donuts was created by raising the upper half of a top shell for each donut. Finally, the actual jelly squirt coming out of the side of the jelly donuts was created using the boolean difference techniques of Maya, and then doing a lot of vertex shifts to model the squirt dome just right.

Also important are the texture mapping on the sugar, powdered blueberry, and dulce de leche donuts. The sugar texture is mixed similar to the cold glazed clouds, but this pattern is a simple noise field taken through various high pass and contrast filters. The ideal reflection is actually mapped to the exact sugar pixels by reusing the same texture map as a floating monochome map. This causes only the sugar particles to be reflective. The jelly donuts use similar techniques but in this case, their textures were pre-distorted to smooth out the polar distortions caused by classic spherical mapping. This helps to evenly distribute the cloudy and non-cloudy regions, but it can not avoid the natural polar distortion which happens.

Final Images

Final Images were rendered with direct lighting and photo studio style lighting. Each image used a lowdiscrepancy sampler at 32 samples and took about 4 hours to render. There's a big light on the roof of the studio and two umbrella-type area lights on the sides of the camera looking into the scene. These images were staged similar to the actual Krispy Kreme donut advertising, which uses a white background to portray donut perfection. Strange that most of the project involved making imperfections!
Click on any of the images to see the full resolution version!


Cold Glazed versus Hot Glazed


The Donut Collection


A Full Order

References / Resources

  • P. Hanrahan and W. Drueger. Reflection from Layered Surfaces due to Subsurface Scattering. Proceedings of SIGGRAPH'1993.
  • Henrik Wann Jensen, Steve Marschner, Marc Levoy, and Pat Hanrahan. A Practical Model for Subsurface Light Transport. Proceedings of SIGGRAPH'2001, pages 511-518, Los Angeles, August 2001.
  • Henrik Wann Jensen and Juan Buhler. A Rapid Hierarchical Rendering Technique for Translucent Materials. Proceedings of SIGGRAPH'2002, pages 576-581, San Antonio, July 2002.
  • Rui Wang, John Tran and David Luebke. All-Frequency Interactive Relighting of Translucent Objects with Single and Multiple Scattering. Proceedings of ACM SIGGRAPH'2005.
  • Craig Reynolds. Adaptive Polyhedral Resampling for Vertex Flow Animation. January, 1992.
  • Baumgarten Enterprises. 2005.
  • Mark Colbert, PBRT Goodies. University of Central Florida. 2005.
  • T. Kraska, Subroutines for solving cubic, quartic and quintic equations. (
In addition to PBRT, we used: