Nov 3, 2009

Photoshop Blends in sRGB Space, Not in Linear

First for those people who are not familiar with Gamma, sRGB and Linear Spaces, here is a good presentation explaining all of thses: Picture Perfect: Gamma through the Rendering Pipeline

Recently I had to do some texture compositing in game using shaders. The artists workflow involves stacking up all those textures to be composited in Photoshop using Photoshop blending mode to preview, and then our engine composites them real-time using same blending mode.

However, with the recent addition of gamma-correction to our engine, everything started to look weird, so I had to investigate it. To my surprise, Photoshop is doing all the blendings in sRGB space instead of mathematically correct linear space. Since artists' workflow overweights mathematical correctness, I had to make sure our shaders work same as Photoshop. And I thought there must be someone who would go through the same try-and-mistake fun time, so I'm making a note here.

Photoshop does blendings in sRGB space. No, not in linear space

Sep 7, 2009

Inconsiderate People

I have never liked inconsiderate people who always want to be center of universe in everyone's life.  Please realize that that very important things in your mind have no meanings to other people, 9 out of 10 times.

So grow up and start to be considerate to other people.

Aug 15, 2009

If you are still chasing the dream after 5 years or so

If you find yourself chasing your dream, failing to achieve it, after 5 years or so since you seriously started to try, here are a short list of things you need to think about in order:

  1. Am I lazy?:  Are you really seriously trying hard?  Or is it just your well forged mean/excuse to avoid the reality?  If you were/are the one who likes to blame the surroundings for why you couldn't chase your dream to begin with, you are likely one of those lazy people.
  2. Am I stupid?: If you don't invest right efforts into right things that lead to the goal, you are likely ended up wasting time, thus failing to achieve your dream.  I found sometimes people do something which is actually time waster just to have the secure feeling of they are at least doing something, which I interpret as "doing something" = "wasting time".
  3. Am I unlucky?: There are times when you do absolutely everything diligently and smartly, but you still fail because of something you have no control over.  And the unfavorable condition might magically last for more than 5 years...... eh..... probably not.  If you, while reading it, are now agreeing with this idea by saying "Oh yeah, I have been unlucky", with 99.9% of the chance, you are a big liar, too scared to admit you are doing something wrong.  Additionally, you are probably lazy and stupid, combination of #1 and #2.  I only saw one person who were truly too unlucky to achieve his goal, and you are not the one: he's dead.

The order of the above checklist is actually very important.  Most people are lazy, some people are stupid and very few people are unlucky.


Kidding Ourselves

It's either one of two.  We are either doing something for our future, or doing something to believe we are doing something for future.  Wait, there is a third case too: simply not doing anything whatsoever.

The last two are equally bad.  Some people might argue at least doing something is better, but how can you argue that brainwashing is good.  The implication behind brainwashing is enormous: we might waste years after years chasing a phantom.  And one day we might wake up and realize we are kidding ourselves.

Today I picked up a new book in which the author complains why she had to learn all the lessons by herself, and why there was no teacher around her who could teach her this black magic.  Isn't it my case too?  I had to do, or chose to do, everything by myself, and somehow I'm sharing the lessons I learned with other people, hoping they wouldn't waste the whole years......

Aug 3, 2009

Only Skills Should Talk

I'm one of those people who truly believe in skills.  In other words, I do not like talkers, backstabber, or anyone who tries to climb up the food chain by playing politics.  Those people disgust me pretty well, and if I see a place where those people are allowed, I tend to question about the place, too.

I might be the one who's living in a la-la land, and there have been multiple people who tried to tell me that's just how it works in reality.  But they are wrong unless they were saying that's how "usually" things get done.  I know one thing from my experience: those who try to find their reasonings from the majority rule are simply making excuses.  You can very easily try to justify yourself by saying "oh everyone does that, and I'm just one of those. So, I'm fine."  The truth is that you are not fine if you really have to justify yourself by hiding yourself in the crowd.  If you are doing something right, you wouldn't need to find any justification for yourself at all.

Extraordinary things are not in the realm of majority rule: it's rather minority.  If you wanna stay ordinary, then go ahead.  But I'd rather be anything but ordinary.

Jun 8, 2009

Vancouver is Most Livable City... Really?

Some organization in U.K named Vancouver as the most livable city in world.  According to the article, it was based on these five categories:

  • stability
  • healthcare
  • culture and environment
  • education
  • infrastructure.
um... really?  Why do I feel like we are lacking on healthcare and education?  And did you consider housing price?

Jun 6, 2009

New Monkey Island is Coming

Yay... finally.. it's called Tales of Monkey Island...





Also.... Secret of Monkey Island Special Edition(read it as remake, or reskin) is coming too... with full voice over!

Pleased with the Lastest Google Chrome

I've been using Google Chrome as my primary web browser because of its minimalism.  However, there was one thing that was somewhat pissing me off: it was always using primary monitor's screen dimension as full screen size, even if the window is on my second monitor, which has smaller resolution than my primary one.

You know Google Chrome always updates itself behind the scene, but I always notice the new version from my firewall alert.  Since today's update, Chrome's correctly getting screen size from whatever monitor it is on.

Very pleased... :)

May 30, 2009

Space Marine is Announced

It always feel so good to see my game is being announced because finally I can say what I'm working on.  I'm working on Warhammer 40K: Space Marine.  And this is the first video we released.  (The video which was circulating on YouTube last year has nothing to do with our game although it bears same name...)

Anyways, enjoy although I don't think you will enjoy more than I do while making this game :)

May 29, 2009

Math Behind Photoshop Blending

If you are a graphics programmer in the game industry, you will always have your beloved artists say something like this: "Hey, I want this Photoshop blaa-blaa-blending in our game!"

Then you will go to this link as I did for the overlay blend mode: http://www.nathanm.com/photoshop-blending-math/


Update: Found another article on ziggyware here: http://www.ziggyware.com/readarticle.php?article_id=228

Update: the only link that's still alive: http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/

May 28, 2009

3D Pixel Perfect Object Picking with Hash

I ran into this article, which describes how to do object picking using a render target and a simple shader.  Yes, this is basically how we support pickings in game editors nowadays thanks to programmable shaders. =)

If you are using a 32-bit integer hash number to keep track of scene objects' name or something equivalent, you can make this system even better by directly storing that 32 bit number onto the render target.

so the code for setting the colour would be something like this:

int a = (hash >> 24) & 0xff;
int r = (hash >> 16) & 0xff;
int g = (hash >> 8) & 0xff;
int b = hash & 0xff;


Vector4 Colour;
Colour.X = r / 255f;
Colour.Y = g / 255f;
Colour.Z = b / 255f;
Colour.W = a / 255f;

Later, when you try to get a hash value on a certain pixel, you would just interpret the whole 32 bit value as integer like this:

int hash = Texture.getPixelAsInt(x, y);

Isn't this much better? :)

Mar 28, 2009

Something Has Changed

Being unable to be motivated to do anything this lazy Saturday, I ended up watching E! True Hollywood Story on TV. There were two episodes(?) back to back, one about someone I don't even know, and not worth remembering anyways, and the other one was about J.Lo.

In one of her interviews, she says suddenly she couldn't just keep up with everything she had been doing and it was like a huge wall standing in front of her. I think she was early 30s that time. And I remember I read almost exactly same thing from iWoz. When Steve Woz checked himself in at a hotel room, trying to make the 2nd generation of his universal remote controller at his early 30s, he couldn't do anything. All the crazy engineering ideas he had had until that moment just disappeared like a puff. He said he stayed there for a while, trying to do the work, but he couldn't do it at all. According to him, that's when he found something has changed. Then he thought something like this: "you know what? there are a lot of young engineers who can innovate things, so why don't I let them do it." and gave up. And as far as I know, he did not really make anything new since then.

Did I say I'm very unmotivated to do anything at this moment? Yes, I feel like something has changed recently. I think it's been about a month when my mother had her 2nd cancer surgery. I still can't pinpoint what's wrong. I might have become bored... or I might be just too tired, thus needing some break... But I'm also at my early 30s, so my juice might just have ran out... like that...

Mar 2, 2009

Inspiring People Creating Innovations

I'm currently reading a book called The Art of Innovation, and it mentions the author's company has been covered by ABC once sometime ago. I managed to find the Youtube videos, which I found inspiring and worth sharing... so enjoy, it has three parts in order.







Feb 22, 2009

Frog Jesus

I found this very very short film on YouTube.  Thought very brilliant.  And later I found this one won some award in 2007, and also is Canadian..

Feb 20, 2009

Booze, Programming, Metal

This is one of my highest moment of a week.  Getting buzzed a bit, programming while listening to metal(or just any) music.  Booze, Programming, Metal, or BPM

Feb 8, 2009

Time to Resign

Time to resign from my part-time jobs.  Sucks... kinda... since I know I've been working hard to make these happen, but it's necessary, so I don't think I will regret.

Lost Journalism - CNN

I've always thought CNN is a reliable news company until I saw the article, Papa John's founder warns against eating too much pizza today on www.cnn.com.  Yes it's a nice title, and nice contents.  But, where did the founder warn against eating too much pizza?  Com'on.... Seriously are you writing a news article or a marketing promo slogan?  He did NOT warn.  He said Pizza has nothing to do with obesity: it's more about how much you eat regardless what kind of food you eat.  And he even mentioned Pizza is very nutritious, thus healthy.  Yeah, I'm really glad to see CNN finally joined Fox News, woohoo...

Feb 7, 2009

Performance Comparison of Lighting Models

I briefly mentioned about free DX10 book available on GDWiki.  I am still reading this book whenever I have free time, but I can't really read it fast, because without being properly edited, some sections of the book are really hard to read.

But I found really useful information in this book: performance comparison of different lighting models.  Also it comes with actual shader code examples.  Especially it was interesting to see Cook-Torrance, which does both diffuse and specular lighting, is faster than the combination of Blinn-Phong specular and Oren-Nayar diffuse models.

Take a look at this page for more details.

Jan 24, 2009

Free Tax Return Software

I have been using QuickTax so far, which cost around $20 per return.  And I recently heard about this free tax return software called StudioTax from RedFalgDeals.com, but was not sure how good it is even if it has been around for years.

And I found my lab hamster today: my dad had to use 2007 version to file his super late tax return, and guess what?  I think I even like this one over QuickTax because this software shows you actual tax forms that CRA mails to you.  Wow.  This program looks a bit less professional than QuickTax, but more user-friendly and seem to have more forms that I will need.  You can report even investment incomes and your contract work incomes.

I'm definitely gonna use this one for my 2008 tax return. With this software, you can either print out and the mail, or you can even do NETFILE with it. (just wait a bit, NETFILE certified version will be up pretty soon) Super awesome.

Finally, BIG KUDOS to BHOK IT Consulting who made it available free for us.

Steve Jobs is Just an Icon

As soon as Steve Jobs took a leave for 6 months due to the his health problem, Apple stock was hit heavily. A lot of news were pretty much saying "without Steve Jobs, Apple is fucked" As you can guess, the Apple stock declined for some days. So I bought some Apple stocks.

Why? Because I know Steve Jobs is just an icon. So many people think he was the one who make iPod happen. But that is not true. As Steve Wozniak, another founder of Apple and who designed the first Apple computer, said in his autobiography,iWoz, iPod was already being developed even before Steve Jobs rejoined the company. Steve Jobs is there because he has such incredible presentation skills which make all the Apple products look better.

About one or two weeks after Jobs took his leave, Apple disclosed the quarterly earning, which is pretty darn healthy. And now a lot of news are contradicting themselves by saying Apple is not just an one-man company, and all the Apple engineers are really making it happen. Jeez, thanks. How much money did you, news creators(they are not reporters at all.. are they?), make by buying Apple stocks after first news and selling them back after second?

Don't get me wrong. I like Steve Jobs. He's a great dude, but people tend to think him bigger than what he is. He is just an icon, and maybe that's why one of his unofficial biographies is callediCon.

Jan 22, 2009

Rogue Leaders: The Story of LucasArts

So apparently a book called,Rogue Leaders: The Story of LucasArts, was published a couple of months ago.  You might like it if you were a big fan of Monkey Islands or Maniac Mansion like me. To be honest, I do not really care about their Star Wars games....

Jan 17, 2009

The Soul of a New Machine

Engineers are aesthetes - Tracy Kidder
So are game developers... well... at least some of them are.... well... almost... - Me

I've finally finished a book called,The Soul Of A New Machine.  It took me about 4 years because this book is about 1 million pages.... okay I am kidding.  I started to read this book while I was at BCIT, and I got really busy, so couldn't continue.  And I totally forgot about this book until recent when I finally picked it up again and started to read.

This book is about a group of Data General engineers who devoted their life to make a new computer back in late 70s.  Who wouldn't call it a devotion when they worked like over 80 hours a week without weekends and holidays for about 1.5 year, and for sure no overtime pay.

Why did they do that?  Are they stupid?

That's exactly the same question I often ask to myself.  Why do I do that?  What's really driving me like this?  I know it's not money for sure.  I don't mind making tons of money, but that's not what drives me.  Even DG engineers were not rewarded after the machine's huge success.  The best answer I can think of for this "syndrome" is challenge.  There is a rare breed of people who is always looking for new challenges.  After conquering an almost-impossible-to-solve challenge, they move to a-little-more-impossible-to-solve challenge. Why?  Because everyone needs excitement to be happy in their life, and conquering challenges is the only way to excite this rare breed.  Harder challenges bring more excitements, that is.  And without it, their life is hollow, making them feel empty.  Fortunately, and unfortunately, I believe I belong to this species.  I've been throwing myself hard problems, and trilled whenever they were overcome, but I still want more without knowing why I am doing this.  It's just a big cycle that happens again and again for years.  The only difference is that I'm now trying to solve harder problems than a couple of years ago: all the other things, including the anxiety, are still same.

There is only one problem with these people: they don't know what to do after retirement.  I think I will have this problem, too.

It would be very interesting if someone writes a book about game developers (not a dumb fiction like J-Pod, though) because our life seems to be as harsh as those engineers quite often.  But do I complain?  Nope.  I enjoy hell alot of it.