Pages

Sunday, May 21, 2017

Too Bright, Too Dark

The visible world around us is constantly changing. One second we may have the sun in our eyes, and another we're in a dark closet trying to find the light switch. Such fluctuations in brightness could have ended up being a serious problem for our vision if it weren't for a handy built-in feature: our eyes automatically adapt to the lighting conditions of the surrounding environment.

Most people are well aware that their pupils change size to handle lighting conditions. A larger pupil admits more light and makes the scene brighter, while a smaller pupil admits less light and makes the scene dimmer. This mechanism is fast and effective, and is controlled by the brain stem, which acts autonomously - you don't even have to think about it.

As useful as this type of adaptation may be, it has some limitations. For example, most artificial lighting is 20 times dimmer than the sun, while pupil dilation only brightens light by a factor of 4 (when compared with a fully constricted pupil). And then there are all those backlight situations - like when an unknown person is standing in front of a bright window, and you need to see whether it's a home intruder or a visiting friend. In short, pupil adjustment is insufficient. So what else do we have?

The answer: sensory adaptation. This term refers to the loss of sensitivity that comes after exposure to a stimulus, an ability that is actually shared by all of our senses. If you've ever looked for your glasses only to find them on your face, you've experienced the effects of sensory adaptation. It's useful because it eliminates old data so it doesn't obscure the new data (kind of like what Facebook does with old and new posts).

Our vision is also subject to sensory adaptation: try staring at the same point for 2 minutes, and everything will fade to the same shade of grey. This happens because the retina becomes desensitized to what it sees. Bright light causes the retina to become less sensitive, making the light appear dimmer. Dim light allows the retina to regain lost sensitivity, so the light seems brighter. In addition, different parts of the retina are affected independently, so while one object is darkened, an object right next to it could be brightened. Hence, the bright and dark areas of a scene are both made less extreme, so that the scene as a whole becomes easier to see.

There are two types of adaptation to light in vision, then. The first type affects the whole image, and is accomplished by pupil dilation/contraction. The second type can control different parts independently, and is accomplished by sensory adaptation.

***

What remains is to find a practical application. Obviously, photography is the place to go. A digital camera is very similar to an eye: both detect light, and both relay information to a central processor (whether a computer or a brain). One of the biggest differences between these two tools is the way they adapt to light.

Most cameras have an adjustable aperture. The aperture is the hole that light enters through. It usually contains a system of tiny fins which move to make the aperture larger or smaller, and are adjusted (often automatically) based on the brightness of the scene. This corresponds directly with the pupil in the human eye.

A camera can also adjust the exposure time, which is the amount of time that the shutter is open and light is permitted to enter into the camera. If the camera is digital, it can adjust the sensitivity of the sensor, which involves multiplying the data from the sensor by some numerical value. These mechanisms correspond partially with the second type of eye adaptation: they control the brightness (or, more properly, "exposure") of an image, but they cannot control parts separately. In other words, unlike the eye, a camera always adjusts the brightness of the whole photo equally.

This is actually a pretty big problem, because many photos end up looking completely different from reality. Next time you get the chance, try taking a photo of a person standing in front of a window. Visually, you will see both the person and the background, but the camera will either make the person a silhouette, or will wash out the background.

The solution is a technique called high-dynamic-range (HDR) imaging. In HDR imaging, multiple photos are taken with different exposures. Then, the best parts of each image are combined to form a single image that is more evenly exposed. Some people criticize HDR images for being artificial, but when done well, HDR images mimic human vision much better than normal photographs do.

As an illustration of this technique, I'll describe my process making an HDR image of a chapel at night. I started by taking these four images:



As you can see, the chapel is mostly washed out in the first image, but in the later images, the sky and the surrounding buildings look too dark. Using GIMP, I stacked the images, and used layer masks to make the images transparent based on brightness. The result was an image that showed detail on the chapel, without losing the surrounding buildings or the light on the clouds.


And that's it - a great image out of a number of okay photos. Kind of cool what you can do when you apply biology to technology, isn't it?


Wednesday, August 10, 2016

Reentry

Painting of space shuttle Columbia during reentry

A bright star streaks across the sky, leaving behind a glowing trail that soon fades back into the blackness of the night sky, leaving no perceptible trace. A minute later, another streak appears; this one has faint hues of pink and orange. Each streak lasts only a couple seconds, but its quiet beauty is not easily forgotten.

Maybe I could write a kid's book about it:
Fast star, slow star
Red star, blue star

The sight I'm describing is called a meteor (as I'm sure you already know). Meteors have been observed for as long as humans have existed, and have been a mystery for almost as long. It didn't take long to figure out  that they occurred high in the atmosphere - in fact, the name "meteor" was originally used for any atmospheric event - but it wasn't until the 19th century that somebody finally realized what they actually were: small bits of space debris burning up as they fell through the sky.

The question that naturally comes next: how does a meteor get so hot?

Saturday, July 2, 2016

Retractable Pen

The retractable pen is an interesting little device. You press a button, and the tip comes out. Press it again, and it does the opposite: the tip disappears back inside. How can the same action lead to different results?

In this post, I'm including a CGI animation I created using Blender. I actually modeled this pen in early 2012 (a little over 4 years ago); I recently fixed it up and re-rendered it.

A retractable pen has 5 main parts:
1. Frame
2. Thruster
3. Ink cartridge
4. Spring
5. Cam (a special mechanical piece; 1 or more is used)

The basic design is for the cam to rotate each time the pen clicker is pressed; the rotation allows for a pin (built into the frame) to slide into a different slot. Different slots have different lengths, and depending on the length of the slot, the ink cartridge will extend by a different amount.

There are many ways to work out the details, and the animation I created shows only one possibility. Of course, the design of the pen in the animation would not function well; the pin would snap off right away. I designed it this way to make it easier to see the mechanism; a stronger pin would obstruct the view.



New posts every month - subscribe for free!

Wednesday, June 1, 2016

Spring Skiing


Nothing beats a nice spring day on the slopes. The warm sun beams down, with its barely-filtered UV rays piercing through the thin air and frying all unprotected skin. The snow starts out icy, but before long it becomes soft and smooth, with slushy snow flying out at every turn. The weather can be really crazy - a couple years ago, Vail reopened for an extra weekend after closing when it was hit with a snowstorm that dumped 3 feet of snow.


Vail EpicMixOne of the best Spring skiing days I've ever experienced was nearly two months ago at Vail, a week before the closing date. Due to some lucky weather events, I experienced all three main types of snow conditions in a single day: ice, slush, and powder.


The day started out like any other: hard snow covered the trails, frozen solid from the cold night before. Turns were difficult to make on this surface, as the skis could not carve on the ice. Clouds covered the sky. It was cold, but not frigid.

Tuesday, May 24, 2016

Jelly Ball

One thing I enjoy when programming is to make weird interactive computer-generated objects. In this post, I'm showing you... a blob. To see the blob, simply click on the black box. The blob will immediately appear. Once you have the blob, you can drag it around with your mouse - just press down and move it around. When you let go, the blob will snap back with a little jiggle.


Click here!


There are a few things I'd like to point out about the blob:

First, when you stretch it, it actually gets narrower. When I designed this, I wanted it to shrink enough to look realistic, but not far enough that it looked weird.

Second, notice that it drags faster depending on how far you stretch it. The speed at which it drags is proportional to the square of the distance stretched. I found that this was much more realistic than making it directly proportional to the stretch. Also, if you only stretch it slightly, it doesn't drag at all (this simulates static friction).

Finally, there's gravity. The gravity isn't strong enough to drag the blob, but it is strong enough to stretch it slightly. When you first create the blob, it bounces slightly as a result of the gravity.


The graphics was probably one of the most interesting parts of writing this program. First I included my Firetools.js library for some simple graphics functions. Then I simply stacked a series of filled translucent circles. I placed the circles on a straight path from the base to the tip of the blob, and determined the size and color using some simple math.

One of the biggest challenges I faced in designing this blob was setting it up to move around the page. It took a long time to figure out how to disable the highlighting of text and the clicking of links below the blob. (For geeks who are interested in my solution, it involved disabling pointer events on the canvas, and using an event listener in the window to turn them back on whenever the mouse was over the blob.)

Overall, I'm really happy with my final result. I hope you enjoy it!


New posts every month - subscribe for free!


Friday, May 20, 2016

Boeing 747 Drawings

I am fascinated by man-made transportation devices. Besides the fact that they can be very advanced technologically, they almost always look really awesome. The ones that fly are the coolest to look at; I love their sleek appearance and clean, smooth colors. It makes them really fun to draw.

In this post, I'm including a two different drawings of a Boeing 747.

One interesting thing about the Boeing 747 is that there isn't only one type. The 747 comes in several variants, each with different dimensions and characteristics. The 747SP is the shortest of the variants, with a length of 185 feet; the longest is the 747-8, with a length of 250 feet. I decided to draw the 747-400, which is 231 feet long.

The first drawing is a sketch I made using a regular graphite pencil. To prepare for my watercolor sketch on special paper, I thought I should make a quick practice sketch first. Once I started sketching I decided to go the whole way and make it good, so my final result actually ended up being somewhat realistic.




Next I used watercolor pencils. This is the first detailed drawing I made using watercolor pencils. It was a neat experience. Watercolor pencils are basically like regular colored pencils, but the pencil lead is water-soluble so the drawings can be smoothed out with water and a paintbrush. The pencil tip can also be moistened, making it like a tiny paintbrush capable of rendering fine details.



New posts every month - subscribe for free!



Monday, May 2, 2016

Black Holes


On February 11, scientists at the Laser Interferometer Gravitational-Wave Observatory announced that they had detected gravitational waves from one of the most powerful events in the universe: the collision of two black holes. In light of this event, I thought I'd post a basic overview of black holes.

Black holes exist in that fuzzy realm on the border between theory and fact. A surprising amount of information regarding these mysterious objects has been determined through mathematical proof, and yet there are still dozens of questions to answer and apparent contradictions to explain. We don't completely understand how they work, but we know they exist.

Because of its strange nature, the idea of the black hole plays a large role in the average person's concept of the universe. Everybody knows about black holes. The problem is, most people don't understand what a black hole is. Some people imagine black whirlpools sucking everything in. Other people imagine powerful vacuum cleaners, from which nothing can escape. The truth is a little different.

Monday, March 14, 2016

How to Find an Algorithm

For some reason I felt like this was relevant
Happy Pi Day! The digits of the date - 3.14 - contain the first couple digits of Ï€. But that's not all. If you add the year to get 3.14.16, you have the first 5 rounded digits of Ï€. This is better than last year's version (3.14.15), which contained a truncated version of Ï€. Today's date contains the more accurate rounded version.

In this post, I'll describe the process of finding an algorithm to approximate the number π.

Monday, February 29, 2016

Efficient Acceleration

Here's a simple physics puzzle: suppose you're launching a model rocket. You want the rocket to go as high as possible. Is it better to design the rocket to:
A. Use all of its fuel very quickly, and then use its momentum to travel high
B. Use the fuel gradually over the whole duration of the flight

In other words, what is the fuel consumption rate that will maximize the height of the flight path? For this problem, we can assume that the thrust is proportional to the fuel consumption rate.

I'll try to post a solution to the problem in the future.

New posts every month - subscribe for free!

Friday, January 22, 2016

2015 in Photos

Cumulus over a sunset

First off, apologies for this long-overdue post. I've had a busy month, and although I would have liked to post this within a few days of the beginning of 2016, I wasn't able to get it done until now.

2015 was a great year, and I think the images in this post will reflect that. In the previous year's image collection (click here to view), the images were only photographs. The image editing was restricted to cropping; I didn't need anything more. In this collection, though, I have drawings, CGI, and microphotography. These new types of images required more processing to prepare them for viewing. Of course, I used GIMP. I can't afford to pay for software.

Instead of listing tons of images, I picked out the most important ones. I also tried not to add the images from previous blog posts; the majority of what follows is new stuff. I also attempt to analyze the images from both a scientific and artistic standpoint.

Friday, December 25, 2015

Astronomy Sketches


Planet original
Last month, I drew a couple astronomy-related pictures using a graphite pencil on a sheet of white paper. The problem with pencil sketching is that it's hard to draw white glowing objects... so I sketched a negative, and then uploaded the images to my computer and inverted them. Then I increased the contrast to improve the black background and enhance the white.


The image at the top of this post is a ringed planet, possibly Saturn. I included three moons and some lighting on the backside from the rings. The whole image was smaller than a dime.

Black hole original

The image below is an imagined view of a black hole. I included high-energy jets of ejected material and an accretion disk. Most black holes are not actively consuming material, and do not have jets. But those are boring to draw.


New posts every month - subscribe for free!


Friday, December 18, 2015

Gravity

Bubbles in space
Imagine the universe is filled with water. Instead of empty space, every inch of it contains pure water. No planets, no stars, only water. What happens? And what would happen if an air bubble formed?

The answer to this question requires a basic understanding of gravity.

Monday, November 9, 2015

Ski Lift

Keystone on opening day
Keystone Ski Resort just opened for the ski season on Friday. I went up to the resort that same day. There was only one run open (not including the beginner area at the top of the mountain), but it was awesome nevertheless!

One of the main downsides to skiing on opening day is the number of people. There must have been about 2500 people on the mountain at the same time as me (not including the people snacking in the lodge).

To keep the lines moving, the lift attendants made sure that the lift was completely full, with 4 people per chair. Even so, the wait to get on the lift took a long time.

At one point when I was standing in line, a thought came to mind: the line was constantly being filled with more and more people, but it never got longer because the chair lift was carrying the people away at the same rate. So what would happen if the lift attendants only put 3 people on each chair, instead of 4? This would disrupt the balance: the inflow of skiers would be greater than the outflow, so the lines would start getting longer. But after a few minutes, the inflow of skiers would decrease (because not as many people would be coming down the mountain), and the lines would stabilize.

The point at which the line stabilizes depends on the number of people on each chair going up.

When I got home, I decided to calculate exactly how many people would be standing in line, based on the number of people per chair. The problem is that there were 2 lifts running, so to simplify the problem, I only looked at a single chair lift: Montezuma Express. I also assumed that half of the people preferred Montezuma Express (rather than the other lift). This makes the total number of people 1250, instead of 2500.

To solve the problem, I started by looking up some details for Montezuma Express. I found the following information at http://www.skilifts.org/:

Type:High-speed quad
Vertical rise:1589 ft
Inclined length:6213 ft
Speed on line:1000 fpm
Number of chairs:168

Now the number of people in line is going to be the total of 1250 minus the number of people on the slopes, minus the number of people going up the lift.

Let x be the number of people per chair. Half of the chairs, 84 chairs, are going to have people on them (because the other half come down the mountain empty). That accounts for 84x people.

Now how many people are skiing down the mountain? Well, that depends on the rate that people are getting off the lift at the top. This, in turn, depends on how many chairs arrive per minute. The distance between the chairs is 6213 ft / 84 = 74 ft, and the speed of the chairs on the line is 1000 ft per minute, so the chair arrival rate will be (1000 fpm) / 74 ft = 13.5 chairs per minute. This means that the number of people getting off the lift at the top will be 13.5x per minute. Assuming it takes n minutes for the average skier to ski to the bottom, there should be 13.5nx skiers on the ski runs.

Using all these new values, there will be 1250 - 84x - 13.5nx people standing in line. How does this affect the minutes spent waiting in line? Just divide by the outflow rate: (1250 - 84x - 13.5nx)/(13.5x).

Ski resort chair lift
Taken Friday at Arapahoe Basin
That was pretty easy. Now let's try plugging in some values. Assuming that the average skier takes 10 minutes to ski down from the top, and that there are 4 people on every chair, the number of people standing in line will be 1250 - 84*4 - 135*4 = 374, and the time spent waiting in line will be 374 / (13.5*4) = 6.9 minutes.

If the attendant only put 3 people on each chair, then there will be 593 people in line, and the wait will be nearly 15 minutes. This is more than twice as long as when there were 4 people on every chair. I think it's pretty clear how important it is to fill every chair going up! (Incidentally, after a few runs, we got tired of the long lines and went to Arapahoe Basin. It wasn't much better...)

Now suppose there's a lodge at the top... and the number of people in the lodge depends on the amount of time spent waiting in line. Suppose that the number of people in the lodge will be 500 + 10t2, where t is the time spent waiting in line at the bottom. How does this affect the number of people waiting in line? I'll leave this for you to figure out!

New posts every month - subscribe for free!

Tuesday, October 13, 2015

CGI Sphere

Over my fall break (which lasted 1 day), I wrote a JavaScript program that would render a sphere. I thought it would be a fun way to practice math and programming skills simultaneously. As usual, I used my FireTools.js library to help with graphics as well as some other functions.

To render the sphere, I wanted to take every pixel on the screen, and calculate the color of the pixel. The color would vary depending on which part of the sphere the pixel was displaying. If the part of the sphere was facing the light source, it would need to be brighter than a part of the sphere facing away from the light source.

Saturday, October 10, 2015

Lunar Eclipse

Total lunar eclipse

Near the end of last month, the moon passed entirely through Earth's shadow, resulting in a full lunar eclipse. The moon didn't completely black out, due to sunlight scattering through Earth's atmosphere. Instead, the moon had a dim reddish-brown glow.

Of course, I took I lot of photos of this celestial phenomenon. I started taking photos during totality. I kept taking photos a couple times per minute, for a period of about 1.25 hours, until the moon was fully lit. My goal was to put the photos together, for an animation of the moon passing through the shadow of the Earth.

Sunday, August 30, 2015

Word Puzzle

I'm thinking of two common English words, W1 and W2. W1 is half as long as W2, but has twice the syllables. When combined, the two words form a phrase that can be used to refer to a nonspecific stage of a meal.

The letters in these two words can be rearranged to form two new common words: W3, and W4. W3 is half as long as W4, and it also has half the syllables. The two words, when combined, may be used when telling somebody to draw with a certain art medium.

What are all four words?


New posts every month - subscribe for free!

Monday, August 10, 2015

Things in the Sky

The Perseid meteor shower is coming up! After midnight on Tuesday, and again on Wednesday, an observer under a dark sky may see up to 100 meteors per hour - an average of nearly 2 per minute. If you live in a city, the light pollution will wash out most of the meteors, so the countryside or mountains will be a much better place to watch them.

Meteors start as small bits of material floating in space, usually dropped from comets that passed through the area. At this stage, they are called "meteoroids". When the earth passes through a cluster of these particles, they hit our atmosphere and burn up as meteors, and we have what's called a meteor shower. If you're looking up at the sky, and you see a streak of light zip a short distance and then disappear, this is a meteor.

One of the best things about this particular shower is that the moon won't come out all night, so the sky will be darker than usual - making it possible to see more meteors than in most showers.

If you go outside to a dark location, here are a few other things you may see:

Wednesday, August 5, 2015

Which Hurts More?

212° F
Let's play a little game. I'll list a bunch of possible actions. Each action will have 2 variations, (a) and (b). You choose either (a) or (b), depending on which would be safer (or less painful). Each of the questions will involve an oven hot enough to bake a cake (350° F), and a pot of boiling water (assume we're at sea level). So... would you rather:

1.
    (a) Stick your hand in the oven
    (b) Stick your hand in the boiling water
  ... for a period of 10 seconds


2.
    (a) Leave a fork in the oven
    (b) Leave a fork in boiling water
  ... for a period of 15 minutes. Then hold the fork tight with your bare hand.


3. Fill a jar to the top with cool tap water. Then:
   (a) Place the jar in the oven
   (b) Place the jar in the boiling water
  ... for a specific, but unknown, period of time. Then remove the jar and put your hand in it.


First see if you can figure these out yourself. They shouldn't be too hard. If you have trouble, heat up your oven and boil a pot of water, and see for yourself what hurts more. (NOTE: I take no responsibility for any resulting injury.)

Tuesday, July 14, 2015

Pluto No Longer on the Horizon

This morning, New Horizons became the first spacecraft to make a flyby observation of the Pluto system. During the mission, the spacecraft captured the most detailed photographs of Pluto's surface we've ever had, and possibly ever will have. It also found many new properties including size, mass, atmosphere, and surface composition.

In a period of a few hours, we discovered more about Pluto than we've found in the 85 years since Clyde Tombaugh captured its first photograph.

Monday, June 29, 2015

Chalk Illusions

I have some crazy news! I was radiated by some radiation, and became radioactive. Over time, my radioactiveness decreased, and as it decreased, my mass decreased as well. I am now a foot shorter than I used to be, and weigh 50 pounds less! At the top of this post, you can see a picture which proves it. In the photo, I'm sitting on a weird box that materialized in the middle of the road...