Cloudy planet breakdown, part 5

A cloudy planet where the clouds don’t move is boring. After all, one of the fun things about clouds is that they move and shift around and change shape over time.

The next step doesn’t look very different from the previous one, except that now it is starting to move:


So far the movement is very simple. The cloudy planet is just spinning.

But after all, as we know from real life, a spinning planet leads to coriolis forces, and those forces result in far more interesting cloud movements.

If you look at the code, you can see that all I’ve done is use sine and cosine functions to make the x (left-to-right) direction and the z (back-to-front) direction spin around each other. You can see all of this running live, together with the code that generated it, by CLICKING HERE.

Cloudy planet breakdown, part 4

Today we deal with the problem of the cloud cover not being wispy. The trick we do that is to combine textures together.

Rather than just use a turbulence texture, we use that turbulence texture to highly distort a stripe pattern (like the way things look wavy when seen through a mirror that isn’t flat). The result doesn’t look like stripes, because those stripes are so highly distorted, but the result ends up having the wispier look we were aiming for:


In the code, the stripes are created by a sin function. I put the new code right after the old code, so that you can compare them to see the difference. You can see the live version, with the code that generates it, by CLICKING HERE.

Cloudy planet breakdown, part 3

Fortunately, we can do better than simple noise texture. Back when I came up with noise, I also used it to build some other interesting functions. One of them was the turbulence function, which creates a kind of fractal texture.

Here you can see I’ve replaced noise with turbulence:


Now the texture looks a lot more like cloud cover. But it doesn’t yet have that delicate wind-blown wispy quality, and it doesn’t yet animate. You can see it live, together with the code that generates it, by CLICKING HERE.

Cloudy planet breakdown, part 2

The first thing we can do is throw on a simple noise texture to use as our cloud cover. As you can see, that by itself is pretty boring.


It doesn’t really look anything like cloud cover. For one thing, it’s lacking that wonderful wispy quality that clouds have. For another, it’s not animated.

In order to do that, we are going to be a lot more subtle in our use of procedural textures. Meanwhile, you can see this example live, together with the editable code that generates it, by CLICKING HERE.

Cloudy planet breakdown, part 1

I thought it would be interesting, for those who are interested in these sorts of things, to do a step by step breakdown of how I made that animated cloud texture for the cloudy planet I showed the other day. I plan to do that over the next several days.

Taking things step by step, first we start with a planet that has no cloud cover at all. All the lights are there, and it’s got the right watery surface color — just no texture.


This is where we will begin. To see this running live together with the code that generates it, CLICK HERE.

Stanley Donen

A lot of wonderful people have passed away recently, and each death has made the world a poorer place. But Stanley Donen, who passed away this week at the age of 94, has a special place in my heart.

Donen directed On the Town, Royal Wedding, Singin’ in the Rain, Seven Brides for Seven Brothers, Funny Face, The Pajama Game , Damn Yankees, Charade, Two for the Road, Bedazzled and The Little Prince, among his many films.

From the time I was a small child, a Stanley Donen film was, to me, the epitome of Hollywood magic. Not the new kind of magic we see today, created with digital special effects, but an older kind — the kind they don’t produce any more — made of pure fairy dust and moonbeams.

As a reward for all the joy he gave to this world, I hope that Mr. Donen is now reunited with Gene and Fred. I can picture them together, dancing with grace and style across a ceiling up in Heaven, or splashing happily through a celestial rain puddle, all in glorious Technicolor.

Just for fun

While I was preparing for that class where I created the orange, I spent a little time just noodling around with shader code. I didn’t have any particular goal in mind other than to have fun and see what would come out.

What came out is something that looks like this, except animated (it’s a lot cooler when you see it animated):


The code that creates this fits in just a page of text. You can see both the code and the animation it creates if you click HERE.

If you’re looking at the shader code, the most interesting section is that four line stretch surrounded by blank lines. That’s where all of the swirling cloud texture is created.

If you like programming, feel free to try editing the code and see what happens. If your changes make the whole thing stop running, you can always just refresh the page and try again.

Building the orange

Today in my computer graphics class I decided to just open up a text editor and implement a simple ray tracer in GLSL. The idea was to take the students through the process of writing a ray tracer from the ground up in GPU shader code.

To my surprise, by the time we were done I had implemented an animated orange:


I had not planned on building an orange. Yet somehow, as I followed my creative muse over the course of the lecture, that is what I ended up doing.

After the class was over, I went back and broke up the code I had writtem into successive steps. This way the students could review the journey from a blank screen to a virtual orange.

In case you are also interested in following along on that journey, here is my “building the orange” breakdown.

A case study in societal evolution, part 3

We can use this case as a kind of litmus test of the relationship between an oppressed subculture and the surrounding dominant culture which (often unknowingly) oppresses and marginalizes that subculture.

In particular, we can examine how the dominant culture regards a work of art in which the subculture is having a conversation with itself. Very often such internal conversations will speak to the nature of the oppression.

When critics in the dominant culture recognize and honor such a work of art — when they understand the nature of the conversation they are witnessing — that is a sign of positive societal evolution.

For example, the dominant American culture was ready, by 1964, to accept Fiddler on the Roof as a valid expression of the Jewish experience of cultural repression. This was a work created by Jews which spoke unapologetically to a Jewish audience about its own experiences of cultural repression. In 1964 it was enthusiastically embraced by the larger culture.

In that case, the dominant culture was ready to receive the message. At an earlier stage of American history, a similar work would have been dismissed or simply ignored by the culture at large. In fact, the Jewish theater was largely ignored by the dominant American culture in the early part of the 20th century.

There are generally four historical stages that a society goes through with regard to any particular oppressed subculture. In various eras this pattern has been repeated for the Irish, Italians, Chinese, Gay, Catholic, Black, Hispanic, Jewish and many other subcultures.

In the first stage, such internal conversations are simply ignored by the dominant subculture — as though they never happened. In the second stage, they are dismissed as needlessly combative and pointless.

In the third stage they are embraced as a bold wake-up call. In the fourth and final stage they become unnecessary, as society evolves to the point where the oppression itself fades away.

With regard to gay identity, we are currently in the third stage. It will be very nice when society evolves more, and we arrive at the final stage.

A case study in societal evolution, part 2

When But I’m a Cheerleader came out in 1999 critics seemed to miss the point. From today’s perspective, it is obvious that the story was being told by gay filmmakers for a gay audience.

The portrayal of homophobic “conversion therapists” as cartoonish monsters parallels the portrayal of the white people in the recent film Get Out. When we watch Get Out we understand perfectly well that it’s a film by a black filmmaker focusing on black fears about white people.

Yet in 1999 the idea that gay people could be having that particular conversation within their own community was off the critical radar — it simply sailed right by most reviewers.

For example, David Edelstein in Slate said that the film was one sided, lacked dramatic tension, and was “lazy counterpropaganda”. Cynthia Fuchs in NitrateOnline said “no one who is phobic might recognize himself in the film” and “the audience who might benefit most from watching it either won’t see the film or won’t see the point.”

The fact today that these reviews seem slightly absurd is actually a good thing. It shows that our culture has moved forward in the last twenty years.

More tomorrow.