Tuesday, December 12, 2006

I'm a dork

posted by Joe Ardent @ 2:29 AM

First, dang. Dang, man, I been a hermit the past two months. Really withdrawn, but not really in a bad way. At least for me. For anyone who's wanted to get in touch with me, probably not so much. So, if you've written email to me, or called me, I'm really sorry for not writing or calling back.

So, like I said, I've been really withdrawn. Partly due to spending all day every day since early September by myself in an office in the forsaken wing of the building where I work (the hallway where my office is is known as "The Chicken Wing"). It's clearly not part of the original structure, and it's cold, and the bathroom is smelly and has no hot water or mirror. So I haven't had the daily routine of interacting with people, and not having that interaction tends to make me withdrawn. Then, come the weekend, all I've wanted to do is lay around and not have to do anything. Since Nikhila will be here in a few days, it's a good thing I'm starting to come out of my shell a bit. Not that I'll be able to keep up with her, but at least I won't be such a neck-albatross.

On the other hand, starting last week, my job changed, I got an officemate, and I've been working on some really interesting stuff. I'm working on a framework for doing particle effects that Chris Horvath originally wrote, and really getting into the details of how all the stuff used to make special effects works, in addition to some serious leveling-up as a programmer. Plus, because I'm a math and physics geek, it pleases me to no end to be able to send mail like this, AS PART OF MY JOB:


Here are two pictures. In the first one, the "velGain" attribute of the
instancer is set to 1.0 (that is, the velocity multiplier is 1.0), and in the
second, the velGain is 1.1. Notice the streaks in the second. The reason
they're there is that the entire emitter-particle-camera system is moving very,
very fast from the lower left to the upper right. The particles were cached
out with their velocity in world space, and so when the motionblock is
constructed in the instancer, the second position was been calculated thus:

P1 = P0 + (dt * velGain * velocity);

where dt is our deltaTime in seconds from Solid, and velocity is the
per-particle attribute in world-space. Because the emitter-particle-camera
system's velocity, which the particles inherited, is so high, the effect of the
velGain multiplication is dominated by it, and the naively-desired normal
velocity (with respect to the emitter) is completely overwhelmed. In effect,
the second image shows what would happen if velGain were 1.0, and dt were too
high (as was the case in Allen's original issue). We've still got enough rope
here to hang ourselves with, and this shows that for all the good work we've
just done, it could amount to nothing if the instancer writer does the wrong
thing (in this case, set velGain to anything but 1.0).


Super dorky, eh? Here are the two pictures:

The first is how it should look, and the second is how it looked to cause us to spend the last week changing the architecture of the system to behave "correctly". Clearly, we didn't fix it enough, eh? (OK, not really; the system in question is capable of universal computation (that's its biggest feature, in fact!), so it's basically impossible to predict all the ways it will be misused.)

But the email goes on to suggest a way to get people to do the right thing, and to do some fancy math to create a unit vector (or rather, one for each particle, or little blue dot) that points out from the center of the sphere and goes through the particle, then use that to get a new vector to act as a direction for a new velocity, then multiply "velGain" by that new velocity. There would be some linear algebra (hello, cross-product AND dot-product!), which for an irrational reason pleases me greatly. Probably because there's no way I'd have ever needed to use linear algebra in my former career as a sysadmin, and I was ready to shoot myself if I had to keep doing that.

And then around 5:00 today, Kris called me to say that there were killer whales swimming near the shore in the bay that my office is near to. So I rallied some of my coworkers, and we went out there, and followed the whales as they swam along the beach. It was awesome. At least four orcas, swimming along, doing that orca thing where every thirty seconds or so they come up for air as they swim. Everyone kept parking their cars, getting out to look at them, then getting back in and driving another quarter mile up so they could get out and watch the whales swim past, then getting into their car to repeat the process. I took some crappy pictures with my cellphone, but Francisco got some better ones with a borrowed camera. I'll wait to post my pictures for him to get me copies of the ones he took. Then you can see how crappy mine are.


At 12/12/2006 6:20 AM, Blogger dbt said...

"At least four orcas, swimming along, doing that orca thing where every thirty seconds or so they come up for air as they swim."

You mean, respiration? :)

Sounds super awesome.

At 12/12/2006 9:26 AM, Blogger Cary Ann Rosko said...

blah blah blah particles blah blah blah velocity blah blah blah blah blah blah vector blah blah blah cross-product blah blah blah blah WHALES

-- What Carys hear


At 12/12/2006 6:18 PM, Blogger Joe Ardent said...

dbt: Actually, the word is "porpoising" :)

cary: I know, I know... But I'll write more about the killer whales later!

At 12/13/2006 12:54 AM, Blogger Stef said...

I admit, try as I might, the majority of this post became similar to Cary's translation... but I wanted to say in addition to the whale story, I particularly liked the part where you used algebra. Giving hope to mathmatics teachers worldwide, so they can say, "Hey kids, see, you WILL use this someday-- as soon as you get a real job, and they sequester you in a cold clammy part of the building called the chicken wing!"
tee hee
I am really just glad when you guys write anything!


Post a Comment

<< Home