Thursday, October 10, 2013

Information about WebGL for the Graphics Professional


There are many aspects of WebGL 1.0 that are somewhat documented and somewhat undocumented. These lacuna are very annoying. Well-meaning web pages that repeat tutorials for absolute beginners over and over again clutter the search engine space and make finding solutions diffiicult.

This post does not have information for beginners or dilettantes.   These notes are for the serious graphics person who is trying to get work done and wants to be more productive. Some of what follows are hard facts or details, some are loose impressions or generalizations.  

-- WebGL is deeply intertwined into Javascript, DOM and the browser, so you must know exactly what you are using because there are differences.

-- Chrome's javascript does not allow "const" in strict mode
-- Chrome's browser throws security violations when attempting to load a texture map
-- Firefox's javascript allows const and does not throw security violations (on linux)
-- Failure to test on your selected OS & browser delivery targets will bite you in the ass
-- You must be very aware of this as you desperately try to get information from the internet

-- Do not assume anything from other OpenGL's will be there.

-- WebGL is not OpenGL ES 2.0
-- WebGL 1.0.2 is derived from OpenGL ES 2.0, but they are not identical
-- WebGL is closeer to OpenGL ES than any of the other OpenGLs though
-- There are almost no carryovers of concepts and ideas and intent from the earlier OpenGLs
-- This is a VERY low level graphics interface, you will reinvent the wheel over and over
-- The WebGL shader language is the same as the shader language of OpenGL ES 1.0 GLSL.

-- Documentation is broken

-- The Khronos site does have a WebGL 1.0.2 specification.
-- The specification is highly concise (at best) or just incomplete (at worst)
-- The shader language is not described beyond the statement that it is the same as GLSL ES 1.0
-- The documentation for GLSL ES 1.0 Shader Language documentation is excellent (see link)
-- There is a pretty good concise WebGL synopsis in PDF form (see link)
-- There is no active forum, the one on Khronos was killed years ago
-- There are a few helpful tutorials on the Khronos site, but not too many, some are wrong
-- The examples on Khronos use techniques that have not worked for years (loading textures)
-- There are relevant articles on the Mozilla developer site, but they are incomplete and the
comments are closed

-- WebGL is fragile and unhelpful

-- Things have to be done exactly their way or it will not work
-- Once something does not work, other errors cascade from it, some of them inexplicable
-- Relentlessly check for webgl errors, do not assume things worked
-- Errors appear either as return codes from WebGL, or in browser error windows, or not at all
-- Most of the WebGL error messsages just say "error"
-- Remember that checking for errors will slow you down, so they must be removed for
production code
-- Sometimes when a problem is unsolvable, I move on to other problems, then come back,
rewrite from scratch using the exact same techniques and everything works.

-- Specific Issues

-- drawArrays "count" is not well defined. It probably wants the number of vertices,
not the number of drawn elements (e.g. triangles) or number of floats, etc.
-- drawElements restricts the number of elements to what will fit in a short. This is not
enough to be useful for many if not most applications
-- The documentation for how to load a texture is wrong and will cause security violations
on modern browsers, it is not clear how much the CORS solution helps
-- texture maps must be exact powers of two in size
-- "const" is not cross-browser, do not use
-- functions are only defined in the shader portion being compiled. A function defined in
a vertex shader will not be available in a fragment shader
-- functions must be defined before use (prototypes may work)

-- Recommendations

-- Use the strict mode of javascript
-- Write or pick a matrix manipulation package for javascript. I use gl-matrix.js
-- Expect to write your own display list manager, object manager, texture manager, etc
-- Expect to spend a lot of time reverse engineering the documentation
-- Be very cautious about what you read on the internet. It is often out of date or applies to
something else that sounds similar but isn't
-- Of course the above warning applies to this post as well.  
-- Test on your target platforms as you develop.  Don't be surprised at the end.

-- Links

-- Article on cross domain textures disabled

-- The WebGL 1.0.2 spec is what passes for documentation

-- The OpenGL ES 1.0 Shader Language Document

-- The WebGL 1.0 Quick Reference Card

Wednesday, October 9, 2013

Experimental Uses of Analog Reflectance Mapping in the Pre-Digital Cinema


As we move into the new world of digital cinema is it time to embrace modern aesthetics and criteria of excellence and move away from the tired old notions of story, plot, character and dialog?  These latter elements served their purpose in their day but now hold us back, some would say.  Who cares about a story when you can have giant robots?   What is the point of having sympathy for a character when you can have 1200 effects shots instead?   The answer is there is no point.

If "new art requires new artists" then it also requires new criteria, new standards, which we can use to judge and appreciate this new work  Our modern cinema has clearly transcended these old ideas and moved ahead.  I believe it is time we moved analysis and criticism forward as well.




What are the new criteria that more properly embraces and embodies our new art form?   This is not yet known for certain.  We are feeling our way in a dark room filled with sharp edges.

I propose that one such new aesthetic will be an appreciation of the power and nuance of a well-placed "reflection map".   Consider how pointless it would be to try and appreciate a movie like Gravity (2013) without deconstructing its reflection maps that underlie its mere surface reality. 

For those of you who are not familiar with the terminology of the new cinema, let us review the basis and origins of the "reflectance map".   

A reflection map is subtlety incarnate. Just out of sight it informs the scene subliminally. It is the distorted lens through which we do not see this world, but another world, a world around the corner or above our heads, a world of light that fills the space between the objects.

The origins of the reflection map predates digital cinema, it predates all cinema. Its beginnings are in the history of theatrical lighting and set design of different cultures, both of narrative theatre as well as the religious and other cultural events of these earlier periods. It is in the history of theatrical lighting, the projector, the lime-light, the mirror, the torch, the well-placed pane of glass, the unscrolling panorama, and in the world of theatrical magic that we should seek the origins of the reflection map.  (1)

The reflection map is not new to the cinema, it is has been in the background, in the art form of the cinematographer since the beginning. There have also been some early examples, ahead of their time, that elevated the reflection map to a more prominent place in the structure of the film. There are four films that I describe here that demonstrate mastery of the reflection map, all of them classics of the traditional cinema. I think you will agree that all four films are recognizable at once merely by describing their use of reflection mapping, as analog as it may be.

That is right, in all four examples below, the maps (reflection, projection, etc) are all analog, which obviously could not be as good as digital, that goes without saying, but has value nevertheless.  

Film 1:

The film begins with a minute of solid black with white titles in a classic type. The audio fades up from silent to the background sound of people in a public space and, slowly after a minute and maybe twenty title cards, what appears at first glance to be a stylized impressionist painting appears. A very subdued color palette with unrecognizable shapes of what may be a cafe or group of people. The painting begins to move (it is actually in slow motion), it appears to be animated or abstract in some way. As color is faded into the picture, an orchestra becomes to warm up in the background audio and the painting is revealed to be a distorted mirror of a club in Berlin between the wars. The reflection map itself becomes an element of the scene as it is a backdrop to the stage which is slowly pulled up to the ceiling where it acts as a reflector of the stage beneath it.





Film 2:

A black and white film about a young man who is color blind. However, he became color blind as a young adult, in his early childhood he could perceive color. When he sees something that he saw as a child or which reminds him of his childhood, that element will be in color. This is particularly noticeable in a scene involving a dark room with a back-lit aquarium and the reflections it casts in the room. (2)

Film 3:

A 1960's film about space travel. We often do not see what the character sees directly, but only indirectly in the visor of his space suit, or the reflections on the wall or window. Even when we think we are seeing what he sees directly, we are not, as the imagery is created with an analog technique called slit scan, a technique that uses imagery in a motion control process to create new animated abstract imagery on film.

Film 4:

A black and white film about love and death, with death and death's mechanism personified in the character of a woman (4) and her male assistant. The boundary between the worlds of the dead and the living are mirrors. In an attempt to bring someone back from death, the assistant to death guides the protagonist into and through the world of the dead on his mission. The imagery is composited, either optical or rear projection, of photography at night moving through ruined cities.   The plates are then used as both backgrounds and projections on the characters.  

The four films are of course Cabaret (1972) by Fosse , Rumble Fish (1983) by Copolla, 2001: A Space Odyssey  (1968) by Kubrick and Orpheus (1950) by Cocteau.





These are all analog films of course, and all but one of them, 2001, can only tease us with the promise of reflection mapping.  It will take the advent of digital techniques for the tsunami of reflection mapping to truly find its voice.


2001: A Space Odyssey

Rumble Fish

Orpheus

Cabaret

_________________________________________


1. For those who think that reflectance mapping was invented in 1982, sadly I must disagree.  At most it was demonstrated in digital form in that year.  Reflectance mapping has been with us since long before.   Anyone writing a renderer in that period, as I was, was well aware of its promise and possibilities.

2. Rumble Fish also used projected time-lapse photography which is another example of the use of reflections for narrative purpose.

3. Story has become the victim of the new economy.   By economizing on a writer, the total film budget may be lowered by many thousands of dollars.  This allows them to spend more on what is important, to bring value to the film, such as more visual effects.

4. Yes, death is portrayed as a woman in this film.  I do not know what the gender issues are, but they must exist.



Sunday, October 6, 2013

Unspeakable Evil, Esoteric Knowledge and WebGL


What madness possessed me that day I will never be able to explain. Having accomplished what needed to be done, why did I press on?  I do not know myself what unconscious self-destructive character flaw caused me to innocently go forward and attempt to learn the forbidden knowledge that lurks just below the surface of WebGL.

Those who watch, those who control, those who oppress our pathetic lives through means both grand and small,  yes even through those apparently innocent graphics API committees that design our APIs. 

Or put another way, I decided to move forward and add texture mapping and multiple objects to my little WebGL object viewer which is really just an excuse for learning WebGL.  

1. I attempted to use the feature, attribute arrays, to download the UV coordinates for use by the shader. But even though I have used this feature successfully for the vertices, colors and normals I could not make it work for UVs.

2. Texture mapping would not work. After a while I figure out that my texture map is not an exact power of two, and that seems to be fatal. First, I do not think that is clear in the documentation. Second, why is the only error code that WebGL seems to know about is "error"? Why can there not be more informative error messages?

3. I use a trick to get the UV coordinates to the shader, and that works, but I can not use that trick in the final software.

Yeah !  A cube with a texture map !

4. In the process of writing slightly more sophisticated shaders, I discover that (a) functions are tricky and that (b) it is not clear which GLSL (shader language) WebGL implements unless you read very carefully (the answer is that it implements GLSL ES 1.0 only) and (c) there is no obvious documentation.  There is documentation it turns out, but you have to go searching around for the documentation for OpenGL ES 2.0's 1.0 shader language. Confused?  You should be, there are many, many OpenGL shader languages defined out there and they are all different yet similar. 

5. In the process of doing this, using textures and so forth, Firefox on Windows gets a hard failure because I am not using vertex attribute 0.   Really, why does it care?

6. Once I start using texture maps, Google Chrome, which had been very compatible before, now fails hard with the following security error.

Security violation?  What security violation?  I am loading a texture map, ok?

Here are the conclusions I drew from this not very fun 72 hours: 

1. WebGL is fragile. You may think you have learned how to do something in WebGL, but its possible that you did not and that you got lucky. You may not be able to use that feature in the future, or you might, but you do not know.

2. WebGL is designed to a very low level. Even the API for the 2D canvas is at a much higher level (and much more usable) than the 3D API.   The only solution seems to be to write your own management system to do basic stuff that could or should have been done for you.  

3. The WebGL error system is nearly useless. It does not give enough information to diagnose problems and errors.

4. The WebGL documentation is problematic. There is no reference manual, there is no shader language documentation (it turns out there is, but you have to be a detective to figure out which one it is and where it is), there is way too much reliance on group sourced internet tutorials that are very low level and often incorrect or unhelpful.

5. It is not clear how much a problem browser compatibility is. Initially there did not seem to be any problem but as of yesterday I am dead in the water and I can not figure out what it is complaining about. Therefore be warned, browser compatibility is a real issue.

6. This might all just be a problem of software (im)-maturity.  Maybe it will all get better with time.  Maybe someone will write a Javascript package to smooth over the loose ends and everyone will use that API instead of the WebGL one.

7. One does what one always does in this situation.  You write your own software to hide the ugliness of the underlying system and after a while the problems go away.   The irony here is that OpenGL was originally created to make it easier for people to start doing 3D.   It has evolved into something that seems to take pride in making it as difficult as possible for a beginner to do 3D.  Weird.

There are a lot of positive things to say about WebGL (including the ability to run a 3D application from a browser which means that the end-user does not have to install a program). But if I were advising a client on whether or not to commit to doing an application that was important to the company using WebGL, I would tell them "Maybe, but proceed with caution". This is a very low-level API, it is not yet robust or documented. One will need to do tests and carefully evaluate whether what you need to do can in fact be done in this environment and at what cost.  Look before you leap.



Wednesday, October 2, 2013

Economic Terrorism and Tea Parties Past and Present


Choosing a label for something, whether a car, a novel or a political movement, is a tricky thing.   It requires inspiration to do well and sometimes it requires imagination and the ability to see the title from other points of view in order to judge how good or appropriate that title may be.   A Chevy Nova might become a humorously-labeled "No Go" in Hispanic countries.   A Tea Party might be a famous and colorful incident in a successful war of independence, or it might be an act of economic terrorism which hurts innocent people and leads to a war with vast disruption of many people's lives.

Lets look at the famous Boston Tea Party using modern terminology and a less overtly American-after-the-fact point of view.  There may be some irony in our right-wing fanatics choosing to call themselves the Tea Party, after all.

Here are a few basic statements about the Boston Tea Party which I think are quite defensible once you remove the blinders that says they were "patriots fighting against oppressors".   

1. The Boston Tea Party was a violent act of economic terrorism to attain extremist political goals.

Whoever did it, and we do not actually know who they were, deliberately broke onto three ships in the harbor and destroyed other people's property.   Where were they guards?   All ships are guarded in port.  Were they bribed ?  How many were injured?  How many might have been injured?




2. We do not know who these people were.

The Tea Party was executed by a group of anonymous fanatics who took the law into their own hands.   We know an awful lot about that period of America.  We know who spoke at a major meeting at Fanuil Hall when the terrorist act was committed, but we do not know who were in those outfits executing the criminal acts outside.  You may hear or read about the "Sons of Liberty" but that means very little in this case. Everyone called themselves the "Sons of Liberty" those days. In modern parlance, we would call it an "umbrella terrorist organization".  Who were they? What are their names? Who financed it? We do not know. 

There is speculation about who might have been involved.  I can tell you some very amusing theories which actually does implicate a radical (and famous) Freemasonry lodge. (2) Maybe John Adams knew, and maybe he didn't.  But so far as I know, all evidence is circumstantial.

3. The Boston Tea Party was a Failed "False Flag" Operation

These days you hear a lot of people throwing around intelligence community jargon as if they knew the first thing about it.  One of those terms is "false flag" which is where a country or organization mounts an operation but tries to make it look like someone else did it.  That is what the people, whoever they were, who did the Boston Tea Party tried to do.  They tried to make it look like an indian nation, the Mohawks, did the deed.  Of course no one believed them for a second.

So what we have here is a botched false flag operation executed by amateurs.

4. The terrorists clearly committed criminal acts.

One man's terrorist is another's freedom fighter. Massachusetts had laws. They broke them. Yes, that might have been a reaction to some taxes which were "unfair", so what?   I think lots of taxes are unfair but I do not go around blowing up the California Franchise Tax Board (even if it is a tempting thought).  They committed these crimes to provoke a reaction from the central government and they got what they wanted. Property was destroyed.  People were hurt, if not that night, then in the days and nights to come. 

5. The Result was Anarchy and War.

The situation spun out of control and we had a full-scale war and revolution on our hands. Estimates are that 15 to 20 percent of the population of the colonies were loyalists (1) and left (or were forced to leave) for what became Canada.  Of course this is the war that the terrorists wanted to provoke with their acts.

So what I want to propose to you here is that the modern Tea Party may have unintentionally chosen a very appropriate name for their organization, naming it as they did after cowardly, extremist political radicals and incompetents who violated the law and caused a war.

Good choice, guys.


Wikipedia page on Loyalists
http://en.wikipedia.org/wiki/Loyalist_(American_Revolution)

___________________________________________________

1. I have heard different numbers for the percentage of the population of the 13 colonies who were loyalists, and for how many left or were forced to leave.   The 15 to 20 percent is on the low side, I think.

2. In NYC, the most important Freemason temple was refurbished and on the opening night gave a talk to the public inviting them to have a look and to hear about Freemasons in their own words.  This would have been mid-late 1990s.   The talk was very interesting and among things discussed the American Revolution because there is so much myth out there that the Revolution was sponsored and let by Freemasons.  Our speaker was quite dismissive for the most part.  Yes there were Freemasons in the Revolution, but there were many Freemasons on the British and Loyalist sides as well.  Yes, there are incidents where a Freemason was able to help a brother in distress, but there are also events where a Brother signalled distress and did not receive help.   But he said there was one intriguing story where it may have been that the Freemasons did have a genuine role in instigating the revolution, and the story is this.

Freemasonry is mostly a social and charitable organization, a so-called fraternal organization.  They meet once a week, each lodge in its own place and normally do such exciting things as plan a charitable event for a hospital, or work on initiating members, or discussing their obscure lore.  Each lodge has its own personality, and attracts its own types of members.   In the pre-revolutionary days there was a famous radical lodge outside Boston.   I forget where exactly he said it was, but apparently it is quite famous and they met in a pub, I think, and that pub is still there.   The lodges all kept books recording the minutes of their meetings and they have the log books for this lodge.   On the night of the Boston Tea Party, only 3 members of the lodge showed up.  They immediately called the meeting to order and dismissed it.   Nothing else.   The speculation is that the rest of the lodge (and maybe also those three members who showed up to formally hold the mini meeting), who were all radical citizens apparently in favor of opposing the British and in favor of separation from Britain, the speculation is that they were the people in costume and on the boats that night.  Apparently it would have been about the right number of people.   The evidence is not close to definitive, but at least it is an explanation of who they might have been, and if so, how they were organized and how they did such things as organize their costumes etc.

I consider this just an amusing story, submitted for your consideration.


Upcoming Seminar on the History of Cryptology, Oct 17 - 19, 2013


Every once in a while (maybe every year, for all I know), the NSA (1) has been sponsoring a symposium on the history of Cryptology. This symposium is mostly for scholars but I am going to presume that people who are interested in this will make the effort to find out whether or not they can attend.

Special Note:

But for all you silly people who got your panties in a bunch because of Snowden, you are suggested to attend.  What a wonderful opportunity to learn something about the field and the people in reality instead of the very weird beliefs that so many of my peers seem to have.

The program is on the www.cryptome.org site at the following URL, but I have at great personal expense converted the PDF to jpeg for your convenience.









This promises to be a very exciting conference. Here are some talks and speakers that I noticed off the top of my head:

1. David Kahn (2) chairing a panel on new work on Alan Turing and his work on cryptology.

2. Work in progress by Whitfield Diffie on the ECM Mark I

3. Crytology in ancient Greece and China

4. Preparation for WW 2 and WW 2 Cryptology Operations including the attack on Japanese naval cypher JN25.

5. East European COMINT in WW 2

I am not sure I can attend but I might be able to show up for a half a day. I wish I could attend the whole thing, it looks great.

______________________________________________


1. Nichren Shoshu of America www.nst.org

2. David Kahn is a well known author on cryptology, considered to have written some of the best books on cryptology and the people who do it in the open literature.





Monday, September 30, 2013

Coming up Shortly on Global Wahrman


The following topics are all being written in parallel (I dont recommend that strategy) and will hopefully show up on Global Wahrman in the next two weeks.

A. The keynote speech at SIGGRAPH and why I did not attend.

B. Living in Los Angeles in the 1980s and attending many courses at UCLA Extension and the American Film Institute.

C. Should I run a write in campaign for the Executive Committee of SIGGRAPH?

D. Essays on debugging lighting procedures for webgl

E Essays on J Walt Adamczyk and his live dome performance work as well as his exhortation to animators at SIGGRAPH

F. A post on artist Manfred Mohr who was honored this year at SIGGRAPH.

G. Death of a Synthetic Character

H. Working in the Slave Pits of the Rich





Sunday, September 29, 2013

Archaeology of the Cold War: The U2 and the History of Overhead Photography

draft

The following post is for those of my readers who are interested in the history of intelligence in this country, particularly during the cold war.   

For those of you participating in my occassional "good citizenship class on the Intelligence Community" and how it works, here are some things I think worthy of note:

1. Projects like this are approved by the President.  2. Congressional approval does not seem to be required back in the "good old days", beyond budget approval.  That is different now, but the details of that will not be apparent in this case, it was before such things. 3. People die.  4. Top scientists of the country devote their time, sometimes without compensation to help make it happen.  5. Some projects are reasonably priced and get done on or ahead of schedule.  6. The different agencies really are different and compete for money and really do want to do things differently.  7.  Projects like this are inherently interdepartmental and ultimately require the agencies to work together.  8. (most importantly) The project helped to deescalate tensions during the cold war on at least three occasions (the bomber gap, the missile gap, the china/taiwan issue).

When the CIA releases a report about a project or projects you can be quite sure that whatever project they are talking about is considered ancient history. In this case we have the release of a report written in 1991 about the origins, operations and results of the CIA ventures in overhead photography via the U2 and A-12 / SR-71 reconnaisance airplanes.

The report itself can be found here:

For those of you who are not aware of how difficult the U2 is to fly (particularly to land) please take a look at the following 4 minute Youtube video. It is, among other things, very funny.

Here are some items that I found interesting and were (for the most part) new to me.

-- Later uses of the U2 included work for NASA and other agencies to map terrain in the continental US for a variety of land management purposes. This I think was before the LANDSAT satellites.

-- I knew the U2 was not pressurized and had a suit for the pilot that was basically a space suit to keep him pressurized.   What I had not realized is that this is one of the first times that this had been done, the U2 was happening in the mid 1950s and that was before the manned space program, so far as I know.

-- Initial testing of the U2 resulted in a greatly increased number of UFO sightings and lead to Project Bluebook, the famous US Air Force study of unidentified flying objects. At the time the U2 was flying higher than common belief thought we could fly, and was catching sunlight during sunset and appeared to be glowing dot of fire at very high altitude to lower transcontinental airplanes.

-- The U2 is really cheap. Less than $1M a pop in its initial configuration (not including extras like a camera, a crew, etc).

-- The U2 was normally flown out of overseas locations because of limited range. It was not refuelled in the air, apparently. This made its very small operational footprint a big advantage over later airplanes (e.g. it used standard aviation fuel, did not need that many people to maintain it, etc).

-- The U2 was really dangerous to fly. Particularly in the later days when we were collaborating with the Nationalist Chinese to photograph mainland China they were losing planes and pilots right and left.

-- The CIA did not want to run these airplanes or their operations, they wanted to focus on their core expertise which was more in the areas of human intelligence. But Eisenhower wanted a civilian agency to run this so that the overflights would be less provocative. In other words, when a plane was shot down over the Soviet Union, they wanted a civilian to climb out not a Colonel in the US Air Force.

-- The Air Force wanted nothing to do with an airplane that could not be used as a military jet. The U2, fundamentally a powered glider, did not have the ability to take the kind of G forces that a military jet has to be able to withstand, so the Air Force rejected it.

-- The SR-71 project started soon after the U2 project because everyone knew that the U2 would not be immune to air defenses very shortly.

-- For a variety of reasons the A-12 / SR-71 was not used ultimately for strategic reconnaisance. It did have a limited role in tactical reconnaisance but was retired after only a few years.

-- The competition / issues between the CIA and the Air Force versions of the A-12 / SR-71 plane was much more complicated and weird than I had realized.

Regarding photography, we learn, among other things:

-- Kodak invented a new thin film for the U2. I presume this has to do with both the incredible weight limitations and also the need to fit a certain amount of film into a limited space.

-- Lots of cameras and lenses were designed for the U2. Several of them would not fit in the limited space available and had to be redesigned.

-- Apparently some of these cameras are still flying in U2s to this day.



Friday, September 27, 2013

The Uses of Procrastination: The Origins of Pork Barrel and Lobbying


As we stare into the darkness of the inevitable failure of our lives, what could be better than to waste a little time looking up things on the Internet? The Internet is a Bold New Paradigm (tm) and provides endless opportunity to learn a little about nearly everything, as long as what you want to learn is not complete, well-presented or, in many cases, accurate. These are details that have nothing whatsoever to do with its value as a time waster however.

Today I want to enlighten you with two important words in our uniquely American political language. The origins of one of them I have known for a long time, the other I just learned on the Internet recently. So as to give you fair warning, I am going to name those two words now and ask you to think about what they might have originally meant, or what their origin might have been.

The words are "pork barrel" and "lobbyist".

In modern parlance, the term pork barrel politics refers to a congressman arranging for his district to receive some federal project that pumps money into the local economy. This would usually take the form of construction projects, such as highways, bridges, etc. It might take the form of an Army or Navy base, or it might be in the form of a military procurement that spends some of its money in that district. By this definition, the building of the 1st six frigates for the US Navy during the Geo. Washington administration was a pork barrel project, because it began the navy tradition of spreading the work out across as many states as possible to increase congressional support for the project. In the case of the six frigates, each one was built in a different seaport, each in a different state. That is six states out of thirteen, not a bad spread. An informed discussion of this term would have the first use of the term in the congressional record, but I do not have that kind of information here. This is the Internet, after all.

The pork barrel harkens back to a time in history when salt was a major means of preservation of food. In agricultural America, various farms and homesteads would have a central place that might serve as the location of a church, a post office, and a general store. At the general store one might find a variety of goods, bulk foods, hardware, etc. One of features of your general country store would have been the "pork barrel", which was a barrel of salted pork. One would go to the county seat on the weekend, perhaps, and pick up the mail, see some friends, and pick up supplies at the store to bring home to the farm. One would select some salted pork from the barrel and pay by weight, presumably. Thus the analogy of bringing something home to one's constituents from the pork barrel that was Washington. Surely we are all allowed to bring something home from the pork barrel for our families ? That is only fair.



Apparently with the origin of the term "lobbyist" we have an example of a self-reinforcing Internet myth.  Fun but not true.   The lobby in question refers to a famous old hotel in DC which is two blocks away from the White House, the Willard Hotel. It was at one time the only hotel you could stay at in DC and still easily get to the major attractions or see all the possible people you needed to see to do business in Washington. When Grant was president, being one of our more social presidents, he liked to go out for a drink and a smoke, and he usually went to the lobby and bar of the Willard hotel.


The restored lobby of the Willard Hotel presumably without the spitoons that would have been there in Grant's day

This meant that you could hang out in the lobby of the hotel and have a good chance of just running into the president many evenings of the week, and have a few informal words with him on some topic. This became known in town as "lobbying", the people who did it were called "lobbyists", the verb was "to lobby".

Its a fun story, but I am told, just not true.  The origin of the term "to lobby" comes from England and parliament and refers to the lobbies where the members of parliament would assemble before going into the chambers to debate and vote.    The process of researching this word reminds me that the Internet is NOT a substitute for solid reference material, probably in print, next to your computer terminal.

The implication is that the term "lobbyist" is not uniquely American in the least, it is a shared term of art with our brothers in crime, Great Britain.

We hope you have been enlightened and entertained by this vital information and that we have contributed to the wastage of what little time you have left in a suitably amusing manner.

The Willard Intercontinental Washington
http://en.wikipedia.org/wiki/Willard_InterContinental_Washington


Thursday, September 26, 2013

WebGL and the Learning Curve Saga Part III


My WebGL saga continues. If we are talking tortoise vs hare here, then I am certainly the tortoise member of this fable.

Slowly but surely we beat the thing into submission. Its not really bad, just badly documented, IMHO, like so much of the GL family. With WebGl we are definitely in a world circa 1982 or so. But MUCH faster than we ever would have achieved in 1982 no matter how rich you were. So we have vast power on all our desktops, but for some reason "we" have "chosen" to program it in a rather low level way. Well, hell, I like low level now and then. I like debugging this stuff that could have been documented but why bother, they can figure it out on their own.

So here is the kind of things I have been working on instead of figuring out how to end war or torture the rich or writing great fiction.

1. The Element Array Debacle

So, for example, if I had been paying attention, I would have noticed that the "element array" feature of WebGL (1) was defined to be a "short" or a 16 bit number. Warning alarms should have gone off in my head but its been a long time since I have programmed 16 bit machines.   Because its a short, the largest number of elements that one can therefore address is 64K vertices. In other words, it is useless for objects that are of modern complexity. Remember there are no higher order surfaces rendered directly by WebGL so we get the appearance of complexity by having a lot of triangles, I mean a lot of triangles, and maybe play with the shading. Maybe this limitation was noted in the documentation but I don't think so.

The result was that I had to rewrite the core of the object viewer to not use element arrays but just use the vertices, and the vertex attributes, etc. It took about 2 - 3 days and resulted in a much cleaner if slightly more verbose piece of code that could actually be maintained if it had to be.

2. The How Many of WHAT Exactly? Problem

The documentation says that you need to specify the number of things you are transferring. Well now, that could mean the number of triangles, or it could mean the number of vertices it takes to specify the triangles, or it could mean the number of bytes that it takes to hold the data, or ...

And the answer is: its the number of vertices you use to define the object. So the count you send is (3 * number of triangles) or (2 * number of lines). Maybe it was obvious to you, but it sure was not obvious to me from the documentation.

3. The Ongoing Normal Mystery

Look at the following picture. See anything odd? Well, its made out of flat triangles, and you should see flat surfaces. Ok, so its interpolating the normals, whats so odd about this? Its just that all the normals for a face (all triangles really) are all pointing the same direction. Unless WebGl is rebuilding the topology of the object by doing a giant vertex sort, there is no way it could be interpolating the normals.



So what is going on? No one knows, but I suspect that it is a bug in my shader that somehow does not compute the diffuse component correctly. The specular would normally and correctly be "smooth shaded", e.g. not show flat surfaces for the most part. So this maybe is just flat shaded, with transparency, and a specular. If that is not the problem then we are definitely in the twilight zone here.

"This war will be over one day".

You get extra credit for knowing what movie that is from and who said it.

____________________________________

1. Where one specifies a line or triangle by keeping a list of vertex numbers rather than repeating the vertex itself over and over again.



Sunday, September 22, 2013

Evidence of Vast Improvement in Los Angeles Mass Transit


I have recently been shown evidence that we are on the verge of a vast change in the way we do mass transit in this country. Well maybe that is a little bold and overreaching.   The evidence relates to Los Angeles specifically, not very well known for being progressive in this area.

In order to understand this evidence we first have to discuss certain techniques used to predict the future and also certain aspects of the history of the topic as it relates to the evidence. But don't worry we will get there.

It is a theme of this blog that predicting the future is sometimes easy and sometimes very hard if not completely impossible, but that it is always entertaining. One complicating factor in predicting the future of course is predicting when it will happen. Predicting what will happen is not enough. When is just as important as what.

One technique used is a concept known as the "indicator". The indicator, stolen from the fields of National Security and Economics, is nothing more than a carefully chosen event or trend that is used as a signal that something of greater scope is happening. The price of corn, the temperature of sea water, and whether a nation's troops are mobilized are all examples of indicators.

Recently I have come across solid evidence that we may be on the verge of a genuine revolution in how we do mass transit in urban areas. I suspect that this might be autonomous vehicles, which I discuss briefly below, but it might be something else. The evidence is not too specific although it is clear that something is coming.



Autonomous Taxicab, the JohnnyCab, from the original Total Recall.  If its good enough for Arnold, it should be good enough for us.


I am a firm believer that autonomous vehicles are in our future and that this is a good thing. I think that they have the potential of changing many things about how we deal with transit in an urban and non-urban environment and that many of these changes will be somewhat unexpected. Maybe we will not own cars, maybe we will just call one up from a pool when we need one. People may never have to worry about parking again and a host of other possible changes.

But being certain when this change will happen is less clear. There have been a lot of promising technologies in the past that have never been deployed in real life: people movers, monorails, levitating trains, not to mention personal airplanes and jet packs. And there are many obstacles in the way of deploying autonomous vehicles beyond the merely technical ones. I will mention just two which are daunting: the greed of the insurance industry and the stupidity of local city governments. Just navigating those two barriers will require more skill and probably more money than solving the technological issues.

Consider the following evidence of imminent change.

Slowly, and without a lot of fanfare, Los Angeles is in the process of building two mass transit systems that will reach the west side of Los Angeles. One is light rail, the Exposition Line, and it is well along and already reaches Robertson near Culver City. The other is a subway down Wilshire and it is in the early stages of construction. The estimated completion of all this work is a date well beyond 20 years from now. But there will be incremental deliverables and parts of the system will be in production sooner than other parts.



The Expo Line actually runs to Culver City.  Its like a Miracle from God that they built this thing.  


To understand why this matters you have to realize that mass transit in Los Angeles is different from other places. In other places, mass transit may be controversial, it may be a compromise, it may be expensive, it may be bankrupt, but it proceeds. But in Los Angeles, you literally have world class crime, political malfeasance, and fraud not to mention racism and major lawsuits. Volumes have been written about the stupidity, short-sightedness and corruption (e.g. bribery).  But most of all, this is an area where the politicians and the civic community failed together to find a solution to a problem that was clearly going to get worse.  In other words, they "kicked the can down the road" and hoped that others would solve it.

The problem is that in this area, as in others as well but this is an excellent test case, solving the problems require capital investment, tremendous political will, short-term grief, and a lot of time to execute.   It is an excellent example where naive, one might say, stupid, reliance on "free market solutions" is obviously a failure.   The benefits of mass transit take many forms, but several of them require the system to be planned and executed and in place for a period of time so that things can be built around it and make it all the more useful.   In other words, the transit system may have to be there for 20 years before all the benefits accrue to the investment (through the placement of hotels, universities, theatres, etc).

To ask politicians and citizens in LA to face a problem 20 years in the future and a benefit also 20 years or so in the future is so far beyond their limited intelligence and wisdom as to be beyond funny into farce.   Los Angeles was built for a reason, and that reason resounds in every decision that the civic body makes.  Los Angeles is built on a desire to steal money and fuck people right now, not on stealing money and fucking people in some future day.   This is obvious in the cheap architecture, the lack of zoning to control cheap real estate development, the dumping of wastes into the water system, the failure to control pollution generated by container ships at the Port of LA that causes a substantial percentage of the air pollution in the LA basin (is it 30% ? 40% ? No one knows).

The point is this:  it isn't possible or plausible that LA would just get around to fixing this problem, or at least some of this problem, by building a transit system, eventually.  I don't buy it.  If something like this is happening, it is an indicator, as previously described, of a larger process that is taking place behind the scenes, even if the people executing this idea are not aware of it.  I think that the will of the people and the force of shame and the collapse of the transit system in Los Angeles over the last 15 years or so has finally caused the City of LA and related areas to finally move in an area that should have been addressed 50 years ago and therefore there is no possibility of this being a wise move.  By the time it is done, something will have happened to expose why this was at best a very late decision for LA to make.

Therefore I am very optimistic that we will see a sea-change in urban transit technology in the near future, as these things are measured.  Its about time.

In a later post I will discuss why I am holding back my real feelings here about Los Angeles and their failure to deal with fundamental issues.

I grew up here.  I know where some of the bodies are buried.