How NetBSD came to be shipped by Microsoft.

In 2000, Joe Britt, Matt Hershenson and Andy Rubin formed Danger Incorporated. Danger developed the world’s first recognizable smartphone, the Danger HipTop. T-Mobile sold the first HipTop under the brand name Sidekick in October of 2002.

Danger had a well developed kernel that had been designed and built in house. The kernel came to be viewed as not a core intellectual property and Danger started a search for a replacement. For business reasons, mostly to do with legal concerns over the Gnu Public License, Danger rejected Linux and began to consider BSD Unix as a replacement for the kernel.

In 2006 I was hired by Mike Chen, the manager of the kernel development group to investigate the feasibility of replacing the Danger kernel with a BSD kernel, to select the version of BSD to use, to develop a prototype and to develop the plan for adapting BSD to Danger’s requirements.

NetBSD was easily the best choice among the BSD variations at the time because it had well developed cross development tools. It was easy to use a NetBSD desktop running an Intel release to cross compile a NetBSD kernel and runtime for a device running an ARM processor.

(Those interested in mailing list archaeology might be amused to investigate NetBSD technical mailing list for mail from picovex, particularly from Bucky Katz at picovex.)

We began product development on the specific prototype of the phone that would become the Sidekick LX2009 in 2007 and contracts for the phone were written with T-Mobile. We were about half way through the two year development cycle when Microsoft purchased Danger in 2008.

Microsoft would have preferred to ship the Sidekick running Windows/CE rather than NetBSD, but a schedule analysis performed by me, and another by an independent outside contractor, indicated that doing so would result in unacceptable delay.

A reusable apple material in Blender 2.79b

Introduction

The Facebook group Blender Procedural Textures holds biweekly contest to construct procedural textures. A recent challenge was

You will try to come as close as possible to an apple, BUT I would like the nodes to be structured, grouped and user friendly, so that you can dynamically change your apple to green or red, mix colors or decide how many lines and spots the peel should have. In short… a perfect “apple peel material” that you can set in the hand of a non node expert user and they should be able to use it .

My entry renders as

apples

A render of two apples created with the same apple node group.

This is a brief discussion of how I created the materials. I created this with Blender 2.79b.  It should work for any version of Blender that has the node groups I used. It can be improved in later versions of Blender by using microdisplacement.

Preliminaries

What color is an apple?

The first rule of creating objects or materials for 3D rendering is to look at examples. The US Apple Association has a nice collection of large images of apple types and a Google search will turn up many images as well, although it will also turn up a lot of copies of Apple’s logo.

It appears to me that an apple peel may have

  • A basic color
  • Variations on that color
  • Vertical blemishes
  • small dots

There are other aspects as well, but providing these four things will produce a pretty good apple (material).

Modeling an apple.

I am taking Stephen Wood’s Complete 3D Artist course on Udemy. In one lesson, he creates an apple.  Using that technique, I created an apple for the contest. It’s simply a modified sphere, sculpted to have the form of an apple, with a stem extending from the top.

apple

apple

You can search YouTube and discover Apple How-To Tutorials

Lighting

Changing the lighting in a scene will change the way materials in scene will appear. Gleb Alexandrov has a nice series of lighting tutorials on YouTube.  You can also look for tutorials on photographic lighting, as the principles are the same.

That said, I decided to be lazy and use an existing lighting set up. I grabbed the Modified_b.m.p.s.ByRobinMarin.blend file and stripped it down to its basic lighting.

Building the material

The contest instructions suggest that the nodes to be structured, grouped and user friendly. I decided to make an apple node group that generated the apple color, but did not include the shader to be used. Here are two examples of using the node group to create a red and green (really yellow) apple material.

A limitation of using a node group like this is that there is no way to control the handles of a color ramp that is embedded in a node group, unless you want to change every material that uses that group. This greatly influences the design of the node group.

Basic skin color

The skin of an apple isn’t a single color, but rather runs a gamut of shades of the same color. An easy way to produce this effect is to use a Musgrave texture to control a mix factor.

Commonly, a color ramp is used to tune the pattern provided by the Musgrave texture. But color ramps won’t work within a node group, so a MixRGB node is used instead.  This provides an acceptable approximation of the basic color.

Dots

A Voronoi texture can be used to produce random dots. A Voronoi texture creates cells. Each cell has an intensity that varies from one at the center to 0 at the edges in a circular pattern. We can use the Voronoi to control the mix.

A simple Voronoi mix

A less than node creates circles from the Voronoi  This works well if you want precise circular dots, but the dots on the apple aren’t that precise.  A workaround is to use a color ramp rather than the less than node.

But we want to control the size of the dots as a parameter of the node group, so a color ramp won’t work. I have a node group that will do this.  It is described in Faking a color ramp in Blender 2.79.

Stripes

There are a few ways to go about adding random stripes. Since these stripes tend to run in a vertical direction, it makes sense to use a noise texture scaled in X and Y as the factor for a mix RGB node.

Putting it all together.

So far I’ve shown each aspect separately.  It’s easy to put them together with mixRGB nodes.

Bumps

Two factors contribute to the bump map.  The skin has an overall bumpiness.  This is easy enough to represent with a noise texture.The dots also contribute additional bumpiness. We need to balance these out, so we multiply the noise texture by a factor before adding it to the bump data from the dots.

The multiply balances the relative strength of the bumps from overall bumpiness and the bumps from the dots. The strength parameter of the bump map controls the overall strength of the bumps.

Making the node group

There are no color ramps in the material, but it does use a vector mapping node.  Vector mapping is another node that doesn’t fit well into node groups, so we perform our own equivalent.  In this case, we only need to scale the vectors, not translate or rotate them. Scaling a vector is accomplished by separating the X, Y, and Z values, multiplying each by its scale factor and recombining them to make a new vector
This is useful enough to make into its own node group

The finished material

Converting to a node group

I like to create a node group in stages.  First I determine a parameters I want to expose. Next I add an input node to hold the value of that parameter. Then I give the input node a label that represents what I think will be a good name for the parameter in the node group. I repeat this until I have all of the parameters.  Then I select the nodes that will make up the node group and make the node group.

There are twenty nine input sockets in the finished material. It would be possible to expose all of them, but the node group would become unintuitive and unwieldy. Here are the choices I made

  • Base colorIn an fBM Musgrave, offset and gain have no value. Because the basic shape using the default detail, dimension and lacunarity are sufficient, controlling only the scale seems sufficient.  Of course, the two colors used by the mix RGB node have to be parameters.
  • Dots the X0, Y0, and Y1 values of the linear equation are specified by the problem design.  Likewise the clamping parameters are specified.  This leaves only the dot size, which is the position of the White pos in the equivalent color ramp, and the scale, which sets the density.
  • StripesThere is no advantage to changing the Z scale, nor is there any real value in setting the X and Y scales to different values. The noise texture default detail and distortion are sufficient, so the only parameter for it is the scale.
  • Bumps The default detail and distortion serve well enough. The multiplier value was explained above.
  • Now we’ve set the input parameters, we choose the output parameters, in this case the final color mix and the height map.  If we leave out all of the input parameters, the bump map, shader, and material output nodes, we can create a node group

Cleaning up the node group

Creating the node group has a couple of problems.

Externally, the parameters don’t have good names or default values. This is resolved by the tedious task of editing each parameter interface slot, setting its name and giving it reasonable defaults. Eventually you end up with a node group with its own name, and with (hopefully) meaningful names for its parameters

Internally,routing can make a spaghetti mess of the node group layout

Everyone has their own way of organizing node groups so that they are readable.  I like to use frames to group functionality, to use reroutes to clarify routing and to use reroute labels to help tracing the routing.

The entire node group

Faking color ramps in Blender 2.79

How to fake a two handle black and white linear color ramp.

If a color ramp only has two handles, the left one is black and the right one is white, it acts like a gradient texture except that moving the handles changes the slope of the gradient. That is, it implements a two point form linear equation.  We can do that with math nodes.

Visualizing 2D equations

Suppose we want to draw the line representing where the X coordinate of a plane is equal to the Y coordinate.  The easiest way to do this would seem to be to use a mixRGB node. The top color would be used for the points where X is not the same as Y and the bottom color for the points where they are equal.

Unfortunately, Blender doesn’t have an equals math node. To make one, consider that X is equal to Y is the same as saying that X is not greater than Y and X is not less than Y. Blender also doesn’t have logic nodes either, so we have to fake the logic.  We get a node group

But this won’t show our line, because there is no thickness to it. Let’s make the line wider, by using a delta factor.  If Y is close to X use black, otherwise use white. That node group looks like this

From left to right

  • The Texture Coordinate node provides a vector giving the X, Y and Z values of the location of a point on the surface of our object.  In this case, Z will always be 0, since it is a flat plane.  X will vary from 0 on the left to 1 on the right.  Y will vary from 0 on the bottom to 1 on the top.
  • The Separate XYZ node gives us the individual values.
  • We add a constant to X to give us the upper bound, and subtract the same constant giving the lower bound.  Using the same constant for both will give us a strip that is centered on the actual line. The size of this constant gives the width of the line.
  • We compare Y to each of these.  The compare Math nodes return 0 if their expression is false and 1 if it is true.
  • We apply the minimum operator.  If Y lies outside either range, the minimum will be 1. If it is inside both ranges it will be 0.
  • Not shown: This reverses the result we want.  The top input of the mix node will be used if Y is outside the range, the bottom will be used if it is inside.  There are at least two ways to fix this. Subtract the result from 1 or use a color invert node between the minimum and the mix node.  For this discussion we’ll leave it as is: Black will be inside, white, outside.

A color ramp

If we add a color ramp to the X value, we can control where the line enters and leaves the image.

Since the black handle is at position .25 and the white handle at position .75, the ramp returns 0 outside that range, and a linear value within it.

The color ramp then is returning the result of a linear equation.  It provides us with two points (x=handle 1 pos, y= 0) and (x = handle 2 pos, y =1). The equation for the line can be found on the web, for instance, here. We can use that equation to produce the same results as the color ramp would. Here is the node group for this

But the result isn’t exactly the same as the color ramp

that’s because the color ramp clamps the results.  Anything to the left of the black handle is set to 0 and anything to the right of the white handle is set to 1. Two nodes will resolve that

Since these node groups are fairly useful, I’ve made node groups of them.