Centroid, centroid everywhere, but not an edge to find

Had coffee. Rebooted. Today’s problem was all about detecting edges of ploy’s. Not going into the reason why, but needed to detect these in multi-sampling mode. So here’s the fun way to do it. Use the screen position passed into the pixel shader, this is the exact position, so in MSAA mode it can be on a partial pixel. Okay, so how do you get the edge? Well you need a value thats always inside the poly. So you pass in the position again, but this time you pass it in with the ‘centroid’ modifier. This means it will always be in the centre of a pixel. What do you do then? Well it’s quite simple, you subtract one from the other, if the difference isn’t zero then you have an edge pixel. Can it be optimised more? Well yes, but you have to be a bit clever. You need to pass in the position, but set it to no-interpolation, then do the interpolation manually, but once with normal and once with centroid.

Walked Sasha, Dillon wasn’t interested again. After much thunder and rain I managed a fairly dry run this evening, another eight odd miles. Started the rough cut on the new video, about half way through. This one will take a while.

Flying tomorrow.

Why does time go so slowly? Because you are calling the real time clock

So woke up at 6:20, which was fine, got Dillon to daycare. I got a text a little bit later to say there was blood in his poo. Considering what he eats I’m surprised there wasn’t a television in his poo. Now work was quite interesting. We have timers, lots of timers, and boy do they show up high in profiles, so I decided to take a look at them. For every timer we are basically calling a linux style real time clock (RTC). This does indeed store very accurate time, from the linux epoc. But every call goes via the kernel and then reads the clock, which is a hardware chip outside the cpu, so there’s loads of bus activity and loads of hanging about. So instead I changed it to the CPU tick clock. Now this is a handy hardware register that store the current cycle number. It’s a 64 bit unsigned int. Also there is a handy call that returns the clocks per second or hertz as it were. So simple you just divide the ticks by the clock rate and the gives you the time in seconds. But what if you want the time in micro seconds? Well then you have to multiply the current tick by one million and then do the divide. Ah, but then you run into a bit of a problem. If you start shifting the ticks up you then begin to run out of room in you unsigned int. So what you need to do is sacrifice a little bit of accuracy. You only multiply the tick by a thousand, but divide the clock rate also by a thousand. This still gives you a pretty accurate microsecond clock, but it then won’t wrap round for almost four years.

Took Jamie to the bank. Picked up Dillon. Went to the gym and did Pump. Finally got all the latest video footage imported and synced up. So now I just have to edit the whole lot.

So Robin Williams could face life either

While not being able to sleep again, Jamie broke the news to me that Robin Williams had just died. He had committed suicide. He once said, “I checked my self into rehab in wine country, so I could keep my options open”. There was a man who had everything, but suffered his own personal demons. He’s found a way out for himself, but left a lot of other people suffering. I finally got to sleep about 4AM.

So woke up still in a mood. Still, I did have a load of work to get on with, so got on with it. It kept me going for a solid eight hours, with a minor sandwich interruption. Stopped at about 7PM. Went out in the rain and ran about eight miles. My legs now hurt. Again. Couldn’t get James on Saturday, so booked on Friday instead, about time I had a stupidly long lunch break. Had a shower, ate salad. Think I may enter a half marathon somewhere, I seem to be running one daily anyway.

There was a girl in Combat tonight who had the face of Conor Maynard

Just didn’t have the will power to live this morning as things haven’t really improved much since. Fixed a load of stuff to do with instances and ‘standard definition’, although I thought that went out the window a long time ago. Walked Sasha. Came back and started working on something rather strange to do with vertex buffers. Couldn’t get it to work. Went to the gym, gave Combat a good effort. There was a woman at the back who had the exact face of Conor Maynard, it was very off-putting. Came back and the dogs have ripped up their duvet which I only put there yesterday. They have both been duly shouted at. Went back to work. Finally got my vertex thing working. Now just can’t be arsed.

So I started the morning being in a film with Helen Mirron, then ended it being a member of Kiss

Dame Helen and Sir Ian were a few rows in front of me. A lady to my right said, “God that’s dame Helen Mirron”. I said rather casually, “Yes, I’ve just been in a film with her, would you like to meet her?”. We got up from our seats on the roller coaster and went to the entrance. But they exited of course through the exit. We were at a Charlie and the chocolate factory themed roller coaster. I said if we catch up with them again I would introduce her. We then got locked outside. Thankfully I then woke up.

Studied a couple more chapters in air law, after Jamie finally got me breakfast. We then had sex, which is the first time since we were in London. I put in a large amount of banging and Jamie did quite a good vocal performance. I then got up and cleared up all the fallen apples and dog poo. After a light lunch I then went out for a run, did about nine miles, in the wind and rain. Came back, had a shower. Then set up three cameras and lots of lighting. We then made a new video. It involved face painting. I did a tiger on Jamie and I ended up with what was supposed to be a Disney version of a Meerkat, it looked more like I was a member of Kiss. Still it was good fun. I now have over two and a half hours of video footage to try and edit.

Had a bath. I’m now going to have a chicken pie.

The balloon fiesta, without any balloons

So after waking up and doing coffee, I managed another chapter in my air law book. Not too bad. Read the paper, finally got up and took Sasha out. Had a light lunch, then we headed off and parked at Cotham. Walked right into town, across it, out the other side and then into Ashton Court. Took about an hour and a half. There we sat around for half an hour and watched nothing happening, apart from some bloke flying around on a sort of parasailing thing. It then rained. It continued to rain for the next two hours as we slowly made our way back to the car. We didn’t see one balloon. We did however see a Spitfire and a Hurricane, which I managed to grab some video of. Talking of videos, new one up today, it’s all helicopter stuff. Jamie is now going to cook for me, I may need a bottle of wine first.

So Jamie’s done my new YouTube outro, he must want sex

So woke up this morning and wondered why Jamie was still there. He announced it was his day off. Still he got to unpack the shopping. Work was fulfilling, in that it kept me busy all day and most of the evening. I was converting instanced primitives from having their world matrix as part of a vertex buffer to having it all in a constant buffer. Was quite fun I guess. All works anyway.

Went to Pump. Then did an arm session with Laverne afterwards. Chest is coming back up to a good weight now. Came back and did more work. Then edited a new helicopter video. This is a bit of a long one but demonstrates quite a few manoeuvres.

Jamie has been working on my new outro. It isn’t bad. Okay, it’s a lot better than my effort. So new video has it on. That’s still currently processing for ‘rolling shutter’ stabilisation issues. Oh the joys of being a top-flight video producer.

So I dreamt about someone fortifying my old house

Woke up rather early, but strangely Jamie had already left for work so can’t have been that early. I had a very strange dream, where I was viewing my old house. Now this is very odd as I never have observation type dreams, I’m always in them. Usually having sex with Keith Lemon and the Spice Girls. Anyway, there was a man there who was putting out fortifications around the kerb edge to stop people parking on it. It’s good to see that it’s not only me who would do this, okay it is, and my own mind. I got up and had coffee.

Work was quite annoying. Split the vertex buffers into position and everything else. Did absolutely nothing speed wise. Then I removed anisotropic filtering from environment maps, again, didn’t do anything exciting.

I walked Sasha. Then this evening I decided to go for a bike ride, first time in ages, quite a pleasant evening. Didn’t really aim to go anywhere, ended up going to the old house to check out any fortifications being added. There were none. Although the Leylandii needs a good trimming. The kerbs in a hell of a state and the bricks on the path have crumbled to pieces. They’ve also replaced the alarm by the look of it. The whole road is a tip, the only person who lives there still I think is lady chaverly. I have no regrets about leaving there. I also cycled to Frenchay, thought I’d pop by Mark’s place. No sign of the old Supra, it probably rusted away some time ago now. There was someone in the front room, I didn’t investigate further.

Came back and did the shopping list, had a shower. Torture porn night.

When I said ‘Don’t be nosey’, I was referring to my dog

So got up far too early, took Sasha to daycare and had to wait for ten minutes before anyone turned up. Went back to bed. Today was basically all about testing and SDK update, which went to plan. Also looked at a bit of an odd one, combining the outputs of a light pre pass. That resulted in not much, it appears that multiple render targets have very little impact. I’m now looking at shadow rendering which appears to be a bit vertex bound. Cleaners arrived, did a half arsed job upstairs and vanished again.

Anyway, while data was building I took Dillon out for a walk. We had the usual row about him not having his nose harness on, but after I tugged him out from under the bed he was fine. We went out up to the nature reserve, he went in the water, was quite happy. On the back straight there was this woman, her kid and some small poodle type thing. As we got close, Dillon started pulling. So I said to him, ‘Oi nosey, come on’. Then suddenly this woman shot round and stared at me. I almost had to duck. God woman, turn that thing into wind or you’ll generate a vortex ring and your head will plummet through your neck. Fuck me, it needed a collision warning light on it. I’m sure she thought I was referring to her. No I was referring to my dog, I walked on, she kept on staring at me like a deranged weather-cock atop a weeble. I didn’t look back, I knew she was still rotating towards me as her nose caused a bit of an eclipse. We made it back intact, with no mid-air collisions.

Picked up Sasha. Did more work. Went to Pump. Drank protein shake. Did more work. Now sat down, thinking about work.

So I now know the quadrantal rule

Today I looked at rain a lot. Both physically and in code, it wasn’t very interesting. Didn’t really make any great gains. Finished off doing an sdk update. It rained. Made a nice change really. Went out and bought some crickets. Then found the last sort of local Geocache, which has been outstanding for a while. The rest of the local ones are puzzle caches. Came back and took an air-law test. Got 75% pass, which wasn’t bad as I haven’t even read half the book yet. Loads of questions on the ‘quadrantal rule’, which I didn’t have a clue about so looked it up. It’s all to do with magnetic track. So if your true track is 80 degrees with a 5 degree west variation then the magnetic track is 85 degrees (west is best, so add it), so it will be an odd flight level in the thousands. Second quad would be odd plus five hundred feet, third even and forth would be even plus five hundred again. This is how planes avoid hitting each other in uncontrolled air space. Another early night I think.