August 2005 - Posts

Stupid, Stupid health insurance...

One of the biggest downside's of quitting MS was losing the great health coverage. Now I'm with the great unwashed self employed masses paying out of my own pocket for rather less coverage.

I could have taken the CORBA coverage but $470 a month seems a lot even though it is very good coverage. Turns out that it's quite a good scam though - I effectively got 2 free months coverage. You see when you quit they send you a form saying you have 60 days to make up your mind if you want CORBA which means at any time till September 12th I can say "Yes, please cover me from the day I left Microsoft". So what I did was something I'm very good at - I did nothing. If I happen to get ill and need coverage I would just exercise my right to CORBA, back pay the 2 months premiums and be covered. If nothing happens I take out my own coverage at the start of September and lose nothing.

Well actually, nothing is free! Because I am not continuing coverage from an existing plan I have to fill out a 31 page health questionnaire, and I'm not covered for certain pre existing conditions (I have none unless being utterly charming is an illness!). Still 31 pages of questions seems worth the $940 I've saved in the last couple of months.

Health Questionnaire Summary

Pages 1-4 are instructions, disclaimers and other confusing stuff.
Page 5 has 5 questions
Page 6 has some great conditions - Superior Vena Cava Syndrome (is this better than regular Vena Cava Syndrome), Christmas disease (what a terrible name for an illness), Cytomegalovirus (sounds like something our of a comic book), Fallot's Tetralogy (sounds like a mathematical proof). If you answer YES to any of the 34 on that page then you go stright to page 31. Those of us who are healthy have to slog through the rest of it.
Page 7 - Cancer. No! Woohoo on to page 9.
Page 9 - Circulatory/Heart. No! On to 12. But wait, some more 'fun' conditions here.... Bundle Branch Block!, Patent Ductus Arteriosus (I think that's a kind of dinosaur), Wolff-Parkinson-White Syndrome (I guess we should be lucky there were only 3 doctors who discovered that one)
Page 12 - Digestive conditions. No! On to 14.
Page 14 - Endocrine conditions. No! (told you I was healthy - its all the beer, it pickles your innards). On to 16.
Page 16 - (half way!) Muscle & Skeletal conditions. Well being a geek I don't actually have many muscles so nothing to worry about here either. On to 19.
Page 19 - Non Psychiatric Nervous System. No! You know I'm going to ace this test. On to 21.
Page 21 - Psychiatric Nervous System. No! Interestingly enough this section covers alcohol and drug addiction and eating disorders - how many honest answers do you think you will get here.
Page 23 - Reproductive system. They don't list 'hung like a horse' as a condition so I guess that's normal. Testicular Torsion sounds pretty painful though! Another No!
Page 25 - Respiratory - No! 
Page 26 - Urinary - well I usually don't have to go to the bathroom until the 3rd pint so I'm not suffering from the incurable Hamster Bladder. So that's a No!
Page 27 - Other stuff... No! That's it I'm all clear. But I did learn that Strabismus means cross-eyed.
Page 31 - Signature and date.

I ended up going with a high deductible, I reckon there's a good chance I will save a lot of money while I'm still young and healthy and I have enough cash to cover deductibles for a few years without missing the mortgage payments.

Next on the agenda disability insurance!!!! 

British Humour

It seems that some folk think I was serious #6 ("I have heard that hanging out in newsgroups and forums increases your chance of meeting attractive women") in Tuesdays post.

So just to clarify - I'm British and sometime the sarcasm comes out so thick and fast I forget to put smileys, italics or something to indicate this.

I usually tell most people to assume I'm being sarcastic until I tell them otherwise.


24 hours of fun

Browsing my refferrer logs I found link to Rev's thought dump, no managed directX content, but I kept reading anyway and game across this gem. I'm not sure I'm in the young enough generation to pull a 48 hour coding session and the ZChick may not think its a great idea either but just the satisfaction of producing a complete game is something a lot of us need to feel. It appear's Rev doesn't want people to email him/her so I left a comment on the blog.

So if there's anyone else in the Pacific Northwest who thinks something like this may be fun drop me a line and we'll see what happens.

Secret #1

Last night (well early this morning) I posted one of the secret projects I'd been talking about on The ZBuffer. Its the updated code fromTom Miller's Managed DirectX kickstart book. I'd been asking Tom about updates for quite some time - its the cause of many questions on USENET and has already shown up a few times on the MSDN forums. In addition I get a few emails a month asking me about them. I think Tom always intended to get round to it but keeping Managed DirectX going means he is pretty busy. Eventually he relented and let me do it.

Which leads me to a question I was asked on usenet yesterday "Why do you help people?" and in this case "Why update Tom's code for free - isn't your time valuable?". Well there are lots of reasons why this kind of sweat equity isn't really 'for free'.

  1. I'm still a nobody - whilst I may be doing a reasonable job getting my name out there for managed directX, I'm no Scoble, Sells, Box or Blyth. Every time you answer a forum thread, or contribute to the community you get a little bit more recognition and credibility.
  2. I want to be seen as an expert. I'm getting better but I still have a lot of gaps in my knowledge. By digging into other peoples code you learn new things. By answering questions outside your knowledge base you force yourself to look in new areas. For example there was a question on clip planes in the newsgroups. Read through the thread and you may think 'hey ZMan's a smart guy'. Maybe you would be surprised to know I'd never written any clip planes code before that day. Firstly I read the help and found some references. When that wasn't enough the guy asking the question mailed me some code which I looked through and fixed.
  3. Maybe one day I want to write a book. Publishing companies will look at lots of things to decide if you get the contract. "Fixed up code for 2 Managed DirectX books", "run the #1 community site for managed DirectX", "regular column on MSDN for managed DirectX" and "contributor to major forums and newsgroups" all ads up.
  4. Free advertising - always include a link to the website in the post!
  5. I'm a nice guy and I like helping folks.
  6. I have heard that hanging out in newsgroups and forums increases your chance of meeting attractive women!
Lots of secrets

Finally I'm starting to feel like I'm back into the swing of things. It just took a little longer that I hoped.

This week, I got my TrayGames demo game back up and running with their slightly updated SDK. Its where I left it 2 months ago (i.e. some big bug) but should be easy to fix and get going next week. The basic gameplay engine is up and running but the output is just text in a winform, with a couple of buttons to press. I've abstracted the game away from the UI because I wanted to concentrate on learning the multiplayer experience. So I need to find some graphics and add to them - *then* I'll tell you about it.

Also finished off a project that I think a lot of beginners will be very happy about - its not signed and sealed yet so another secret. But watch TheZBuffer on Monday/Tuesday.

Finally, I got some good news this week. After I delivered my latest column to MSDN and have almost finalized the delivery and payment schedule with them. Whilst I'm not going to get rich from doing this its my first official income since I quit so that's some cause for celebration. Its also nice for me because it all happened as a direct result of running TheZBuffer. Like any business opportunity there is always a certain amount of luck in opportunities presenting themselves but you have to take advantage and take some risks. The luck in this case was working at Microsoft and being on the right internal chat alias about .Net gaming. Though I had publicized TheZBuffer externally, I wanted to try and keep some separation between my work and my hobby. I didn't want any manager accusing me of spending time on the wrong things. But of course eventually somebody else posted a link to one of my pages with some nice words and I chimed in and claimed the credit. As a result Brian Keller and Dan Fernandez got in touch with me because they were putting together prototypes for Coding4Fun and they were looking for people to help out, in this case specifically with the game development section. They already had the Video Game Development series under way, as well as Derek Pierson's series and they were looking for opinions and feedback on this content. I met with them for about half an hour (being careful to do it after my normal hours had finished). As I suspected, they had little budget and as an internal employee you get a hearty handshake and you can write it as an extra contribution on your review form. Remember, at this time I had no idea that I would end up quitting my job so I looked upon it as some recognition. After we met, I couldn't help thinking that a group with little budget might be glad of some free content and I could do with the publicity so I emailed them back asking if they had room for other articles - and they just about bit my hand off. Of course the big risk here was that it was more of my spare time - I was already spending quite a few hours per week on TheZBuffer - but reputation is important. Since there were 2 tutorial articles, I decided upon the Ask The Zman format. I've never been published before and remember I am really still a hobbyist at this stuff so it was a little nerve wracking. I got the ZChick and a friend who edits professionally to cast an eye over my geek script before the big day. Of course just after the second one I made my big decision and had to email the MSDN guys to say I was leaving. I fully intended to keep up the articles no matter what - now I had more time and more of a reputation to build. But it seems Coding4Fun got a bit more budget in the new fiscal year and they agreed to pay for my words of wisdom :-) Of course having 2 articles under my belt helped no end here.

Moral of the story - take advantage of whatever opportunities you get, and take some risks now and again.

Time to step it up

No not my 'work' (though that would be nice!) - but the garden/yard now has some new steps.

As you know I have been tasked by The ZChick to get the yard back in shape after our builders left it looking like a building site last year. Now the wall is up I have rebuilt the steps that go up to the deck. Its not a tall deck but we (and the ZHounds!) have been jumping up and down for over 12 months. The ZHounds are part Corgi so they only have little legs!

New Steps

Doubles, Floats and DirectX
I answered a question on the MSDN forums yesterday which is probably related to the rounding errors I was seeing in Africa last week.

Someone was asking about why the floating point artimetic was giving him a different answer after a Direct3D device was created. The answer is that DirectX, by default, switches the processors floating point unit into single precision mode. .Net of course has no clue that this has happened so every time you do any double based arithmetic and the JITer creates floating point assembly language, the results that come back are in single precision. Something to watch out for if you really need high precision.

You can of course tell DirectX *not* to switch but there is a perf hit.

To fix this you can tell DirectX not to put the FPU in single precision mode. See CreateFlags in the SDK - specifically preserveFPU.
If you are using the sample framework you can indicate your desire by adding this line

settings.BehaviorFlags |= CreateFlags.FpuPreserve;

to the ModifyDeviceSettings() callback.


Another get rich quick scheme fails

Since I am currently unemployed with no regular income, yesterday the ZChick and I decided to head off to Emerald Downs and see if we could win ourselves an early retirement. I'm typing this from home after putting off more yard work ("becuase its too hot and I'm too English to be out in heat"), you can guess the outcome. I had 2 3rds, an 8th (out of 9) and a 2nd. I'm please to say that on a $5 bet to place, the 2nd made me a grand total of $3.80 profit. The ZChick didn't win anything.

In the name of getting fit we did 'run the mile' before the event. Yes, once a year they let people on the track and you can run the lap on foot. The money raised all goes to a good charity and they threw in free entry to the races, a free T-Shirt and lunch so it was quite the bargain in the end. Seeing one mile laid out in a single lap looks huge. The winner did 5:15 which is pretty good on a soft surface apparantly. The ZMan managed a more humble 8:13 which is pretty damn good I think. I'll kee the ZChick's time a secret becuase like age and weight I think these are things a woman likes to keep to herself. Suffice to say she ran a *lot* faster than she claims she can go on our treadmill. Of course to put it all in perspective, the horses do the same lap in a little over 1:30 !!!


Posted 21 August 2005 02:24 PM by zman
Filed under:
The Great Wall of ZMan

Yesterday was finish the wall day. So with some help from a friend's son (who owed me a favour) I am finally done with one of the honey-do items. Unfortunately infinity-1 is still infinity so I gather I will still be busy for an eternity.

The Wall 


Holy Africa Batman

Take a quick look at this screen shot. Hmm, there's some holes in Africa that I don't remember being there. 

Now this was a pretty interesting bug to work out so I figured some of you would find the process useful. Firstly, when the texture was wrapped around a sphere of radius 1.0 there are no holes! A radius of 1.3 gives you the pattern you see above. I checked the formulas and since the rest of the texture is nicely mapped I couldn't work out what was happening. I tried the Ref resterizer and it fixed itself. Usually this is the sign of a bad driver but since this program isn't really complex I found it hard to believe. I ran it on another box (different chip and driver) and it had the same effect. Then I noticed that flipping to full screen fixed it too. Both of these operations cause a device reset and apparently after the device is reset my bug doesn't happen. The odd thing is that the mesh creation and texture coordinates is the same code - there's nothing that varies based on initial run, or device reset. So last night around 1am I went to bed with a bug on my mind. This is *never* a good thing to do if you want to sleep.

I was 99% sure there was nothing wrong with the texture coordinates because the holes share vertices with the triangles around them. This should mean that even if the vertex in the middle was wrong you would see some sort of lerp across the texture. But checking texture coordinates is easy. I modified my spikes to change color based on the u,v coordinates. If it had worked it would have looked something like this. However it failed very quickly because it turned out you can't generate a colour when u=NaN. So it seems I was wrong it *is* a problem with the texture coordinates, and it *is* my code. The reason for the lack of texture lerping is because the center vertex is NaN. The graphics card cannot lerp to/from NaN so it does nothing leaving a nice hole centered around that point.

But some things still didn't make sense:

  1. The formula looks right for all of the other points on the sphere how can it be wrong for just a few
  2. Why wasn't I getting an exception when the NaN was being generated
  3. What does resetting the device have to do with this.

Armed with the knowledge that it was vertex #49 and #73 that had NaN, I worked through the math:

u = (float)(Math.Acos((double)Vector3.Dot(equator, vertexRay) / Math.Sin(phi)) / (2.0 * Math.PI))

See anything wrong? No neither could I. But the Debugger told me that the parameter I was passing into Math.Acos() was *very* slightly greater than 1 (and less than -1).

So I added some more math to clamp the function and all is now well.

u = (float)(Math.Acos(Math.Max(Math.Min((double)Vector3.Dot(equator, vertexRay) / Math.Sin(phi), 1.0), -1.0)) / (2.0 * Math.PI))

My assumption is that its all to do with rounding. All of the DX functions work with floats, all of the Math functions work with doubles and of course when you run a DirectX program it puts the FPU in single precisions anyway (unless you tell it not to).

Of course this doesn't help me with #2 and #3 from the list above - I have some ideas on those but I need more time to prove/disprove them. However the code now works as expected and I can send it on to MSDN for publication. If you know why - please let me know.


ZMans Piles - does anyone care?

Well after a monster effort yesterday I've broken the back of the office mess. The boxes are gone, the crates of prehistoric hardware are sorted ready to sell or throw out and all that is left is the 'piles'. I moved all the piles off my desk and onto the floor next to the archive piles that have existed on the floor for at least a year. I even put some of my ideas and tasks into Outlook where they belong rather than on post-it notes.

In more news that you don't care about the bricks for my wall showed up so now I have to go firm up the foundation.

There will be technical stuff coming up - stay tuned.


Too Hot...

(for the hot tub)

Well my little old office at home may have a bigger window than the one at work, and a may have a nicer computer and a nicer desk but what I don't have is air conditioning. With 2 computers running in here and all of their associated DC converters it gets mighty warm. Of course in Seattle hardly anyone bothers with AC so you suffer on days like this. Coming from England doesn't help because the last time it was this hot in England was while the planet was being formed. Anyway I have a fan and it fits in the window so here is my DIY AC


And now I can upload pictures - here's the rather messy office from last week.
Messy Office
The 3 cardboard boxes are full of 'toys' that adorned my desk and window sill at Microsoft. I had quite a collection of basically rubbish for folk to look at or play with. Well The ZChick says there's no room for it here (she is just jealous of my toys like most of the kids) so I had to send 90% of it away to go to the goodwill store. As of today I'm almost through sorting out the 4 red crates which contain (amongst other things) manuals for anything I purchased in the last 10 years, cables that I can't even recognise the ends of, old graphic cards and other computer rubbish. A lot of that will be given away and some hopefully I can sell.

Sadly behind the red crates is a couple of years worth of what we like to call ZMan's piles! Different people organise their stuff in different ways. The ZChick has just as much rubbish as me but its hidden - she favours stuffing things into boxes and cupboards never to see the light of day. I prefer to know how much rubbish I have to deal with so I pile it up and leave it in the open. You can see the conflict! Of course I can't disagree with the argument that *my* rubbish makes the house look messy. Actually its best not to disagree with the ZChick on a Monday anyway. So that's why I am continuing to tidy up today.

Spikey Teapots

Chuck is on the right track. The spikes from the teapot are rays from the center of the mesh through each vertex and touching a slightly enlarged bounding sphere. The idea is to show how a spherically mapped texture can be wrapped around the object.

Unfortunately, I ended up a bit bogged down with the math on Friday and though the texture looks OK I happen to know its not quite right. So that needs to be fixed before it goes off to MSDN.

No they are not normals....

The rays in the last picture are not normals. This is what teapot normals look like.

For a hint look at what the last couple of Coding4Fun articles are about - this is the 3rd part of the series.


Todays Status Meeting

I'm so glad I have you all here at the meeting today - John (I'm sure there is at least one reader called John) you were supposed to bring the Donuts but we will forgive you this time.

So yesterdays tasks....

  1. Blogs - Done. A 4.0 effort if I ever did see one.
  2. MSDN article - well not quite done but I have a nice screenshot to show you. Bonus points if you can guess where I'm going with this tutorial. Had to dig into the D3DX Line class to draw the spikes which was new for me. Quite an interesting bit of the API since it doesn't honor the world/view/projection matrices - you have to pass them in separately.
  3. Quicken - well I can't find the CD, but I was having so much fun coding I forgot anyway.
  4. Bonus work
    1. I sent a couple of document issues up to Microsoft. This is really easy - there is a feedback link on the bottom of every page in the MDX SDK docs. I encourage you to do the same.
    2. I got the photos section working in community server so I can upload images. I still can't find an easy way to insert them into the blog though. Do I *really* have to edit the HTML!?&%$$#!

Today? Well The ZChick has family in town so I'm off for a drive soon so it will depend what time we get back, but the MSDN thing is highest priority. The garden/yard will have to wait because summer is officially over in the pacific northwest, it rained last night and my trench is not a moat.


More Posts Next page »



This Blog