Sunday, November 16, 2008
Thank god?
Eerrr.... thank god? She's a real kryptonite?
Saturday, November 15, 2008
Sick Sick Sick!
If I don't finish CG today, I am not allowed to sleep. Ok. That's it!
Friday, November 14, 2008
The good girl
Her family.
Who listens to her parents... somewhat.
Does everything well.
Does everything they want her to, except... get married.
To a chinese boy.
Homogeneous. Just like her maths equations.
She will never defy them. And break their hearts.
So she chooses never to
But she will never tell them.
She just apologise and kept herself busy.
Here is where she will fail them.
All because,
she is hard to impress.
Strange dreams
Dreamt that I jumped into his car and he was driving around backwards.
Dreamt that bro was found guilty. Without bail. Confused.
Dreamt that my shoulder and ass hurts from dragging my bag around. Which could be true. Since it did hurt my shoulder very badly.
Dreamt about graphics pipeline. Dreamt about exams.
Dreamt about work. Dreamt about the dreaded meeting to announce my departure.
Wednesday, November 12, 2008
My first Christmas & New Year
Used to dread this time of the year. Spent most of the time in switch. Tortured, stressful, sleepless nights.
How about this year?
You are wasting my time look
I replied,"I have not finished talking yet. I will come to that part once I am done explaining this to you."
"Oh hehe. So I have to pay you? Ah with Malaqa money?"
*Look at him from the corner of my chinky eyes* "Can we continue?"
3D Game and Graphic Engine DB
http://www.devmaster.net/articles/graphics_alg/
Find it here. Check them out during sem break:
http://www.devmaster.net/engines/
Monday, November 10, 2008
Please, Just make up your mind!
Just make up your mind. Yes? No? Ok. Let's go!
And then there's the biggest longgok... lol. Love Jude's way of saying it.
School. Family. Work. All drama at the same time.
Jude told me it's alright to defer. As she puts it:
You don't want to fail and repeat school. And fail at work? Absolutely not. Cause we are the best!
I will buy her whatever she wants to eat after this. And she really can eat even though she is so small.
Embarassed closet maths nerd
http://projecteuler.net/index.php?section=about
I really do.
Sunday, November 9, 2008
All about R-tree
http://www.rtreeportal.org/
Saturday, November 8, 2008
My punishment
So I guess, I am really really making up for all of it now. Ugh!
Mean thought. I hope the rest of the class did badly too.
Why do I torture myself like that? I cannot explain.
Someone asked,"Why did you decided to do this?"
To which I replied, "To open my chakra."
Relational Algebra
Lecture Notes: Relational Algebra
What? Why?
- Similar to normal algebra (as in 2+3*x-y), except we use relations as values instead of numbers, and the operations and operators are different.
- Not used as a query language in actual DBMSs. (SQL instead.)
- The inner, lower-level operations of a relational DBMS are, or are similar to, relational algebra operations. We need to know about relational algebra to understand query execution and optimization in a relational DBMS.
- Some advanced SQL queries requires explicit relational algebra operations, most commonly outer join.
- Relations are seen as sets of tuples, which means that no duplicates are allowed. SQL behaves differently in some cases. Remember the SQL keyword distinct.
- SQL is declarative, which means that you tell the DBMS what you want, but not how it is to be calculated. A C++ or Java program is procedural, which means that you have to state, step by step, exactly how the result should be calculated. Relational algebra is (more) procedural than SQL. (Actually, relational algebra is mathematical expressions.)
Set operations
Relations in relational algebra are seen as sets of tuples, so we can use basic set operations.Review of concepts and operations from set theory
- set
- element
- no duplicate elements (but: multiset = bag)
- no order among the elements (but: ordered set)
- subset
- proper subset (with fewer elements)
- superset
- union
- intersection
- set difference
- cartesian product
Projection
Example: The table E (for EMPLOYEE)
| nr | name | salary |
|---|---|---|
| 1 | John | 100 |
| 5 | Sarah | 300 |
| 7 | Tom | 100 |
| SQL | Result | Relational algebra | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
select salary |
| PROJECTsalary(E) | ||||||||
select nr, salary |
| PROJECTnr, salary(E) |
Note that there are no duplicate rows in the result.
Selection
The same table E (for EMPLOYEE) as above.
| SQL | Result | Relational algebra | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
select * |
| SELECTsalary <>(E) | |||||||||
select * |
| SELECTsalary <>= 7(E) |
Note that the select operation in relational algebra has nothing to do with the SQL keyword select. Selection in relational algebra returns those tuples in a relation that fulfil a condition, while the SQL keyword select means "here comes an SQL statement".
Relational algebra expressions
| SQL | Result | Relational algebra | ||||||
|---|---|---|---|---|---|---|---|---|
select name, salary |
| PROJECTname, salary (SELECTsalary <>(E))
Temp <- SELECTsalary <>(E) |
Notation
The operations have their own symbols. The symbols are hard to write in HTML that works with all browsers, so I'm writing PROJECT etc here. The real symbols:
Example: The relational algebra expression which I would here write as
PROJECTNamn ( SELECTMedlemsnummer <> ( Medlem ) )
should actually be written
Cartesian product
The cartesian product of two tables combines each row in one table with each row in the other table.Example: The table E (for EMPLOYEE)
| enr | ename | dept |
|---|---|---|
| 1 | Bill | A |
| 2 | Sarah | C |
| 3 | John | A |
Example: The table D (for DEPARTMENT)
| dnr | dname |
|---|---|
| A | Marketing |
| B | Sales |
| C | Legal |
| SQL | Result | Relational algebra | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
select * |
| E X D |
- Seldom useful in practice.
- Usually an error.
- Can give a huge result.
Join (sometimes called "inner join")
The cartesian product example above combined each employee with each department. If we only keep those lines where the dept attribute for the employee is equal to the dnr (the department number) of the department, we get a nice list of the employees, and the department that each employee works for:
| SQL | Result | Relational algebra | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
select * |
| SELECTdept = dnr (E X D)
E JOINdept = dnr D |
- A very common and useful operation.
- Equivalent to a cartesian product followed by a select.
- Inside a relational DBMS, it is usually much more efficient to calculate a join directly, instead of calculating a cartesian product and then throwing away most of the lines.
- Note that the same SQL query can be translated to several different relational algebra expressions, which all give the same result.
- If we assume that these relational algebra expressions are executed, inside a relational DBMS which uses relational algebra operations as its lower-level internal operations, different relational algebra expressions can take very different time (and memory) to execute.
Natural join
A normal inner join, but using the join condition that columns with the same names should be equal. Duplicate columns are removed.Renaming tables and columns
Example: The table E (for EMPLOYEE)
| nr | name | dept |
|---|---|---|
| 1 | Bill | A |
| 2 | Sarah | C |
| 3 | John | A |
Example: The table D (for DEPARTMENT)
| nr | name |
|---|---|
| A | Marketing |
| B | Sales |
| C | Legal |
We want to join these tables, but:
- Several columns in the result will have the same name (nr and name).
- How do we express the join condition, when there are two columns called nr?
Solutions:
- Rename the attributes, using the rename operator.
- Keep the names, and prefix them with the table name, as is done in SQL. (This is somewhat unorthodox.)
| SQL | Result | Relational algebra | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
select * |
| (RENAME(enr, ename, dept)(E)) JOINdept = dnr (RENAME(dnr, dname)(D)) | ||||||||||||||||||||
select * |
| E JOINdept = D.nr D |
You can use another variant of the renaming operator to change the name of a table, for example to change the name of E to R. This is necessary when joining a table with itself (see below).
RENAMER(E)A third variant lets you rename both the table and the columns:
RENAMER(enr, ename, dept)(E)
Aggregate functions
Example: The table E (for EMPLOYEE)
| nr | name | salary | dept |
|---|---|---|---|
| 1 | John | 100 | A |
| 5 | Sarah | 300 | C |
| 7 | Tom | 100 | A |
| 12 | Anne | null | C |
| SQL | Result | Relational algebra | ||
|---|---|---|---|---|
select sum(salary) |
| Fsum(salary)(E) |
Note:
- Duplicates are not eliminated.
- Null values are ignored.
| SQL | Result | Relational algebra | ||
|---|---|---|---|---|
select count(salary) | Result:
| Fcount(salary)(E) | ||
select count(distinct salary) | Result:
| Fcount(salary)(PROJECTsalary(E)) |
You can calculate aggregates "grouped by" something:
| SQL | Result | Relational algebra | ||||||
|---|---|---|---|---|---|---|---|---|
select sum(salary) |
| deptFsum(salary)(E) |
Several aggregates simultaneously:
| SQL | Result | Relational algebra | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
select sum(salary), count(*) |
| deptFsum(salary), count(*)(E) |
Standard aggregate functions: sum, count, avg, min, max
Hierarchies
Example: The table E (for EMPLOYEE)
| nr | name | mgr |
|---|---|---|
| 1 | Gretchen | null |
| 2 | Bob | 1 |
| 5 | Anne | 2 |
| 6 | John | 2 |
| 3 | Hulda | 1 |
| 4 | Hjalmar | 1 |
| 7 | Usama | 4 |
Going up in the hierarchy one level: What's the name of John's boss?
| SQL | Result | Relational algebra | ||
|---|---|---|---|---|
select b.name |
| PROJECTbname ([SELECTpname = "John"(RENAMEP(pnr, pname, pmgr)(E))] JOINpmgr = bnr [RENAMEB(bnr, bname, bmgr)(E)])
PROJECTb.name ([SELECTname = "John"(RENAMEP(E))] JOINp.mgr = b.nr [RENAMEB(E)])
P <- RENAMEP(pnr, pname, pmgr)(E) |
Notes about renaming:
- We are joining E with itself, both in the SQL query and in the relational algebra expression: it's like joining two tables with the same name and the same attribute names.
- Therefore, some renaming is required.
- RENAMEP(E) JOIN... RENAMEB(E) is a start, but then we still have the same attribute names.
Going up in the hierarchy two levels: What's the name of John's boss' boss?
| SQL | Result | Relational algebra | ||
|---|---|---|---|---|
select ob.name |
| PROJECTob.name (([SELECTname = "John"(RENAMEP(E))] JOINp.mgr = b.nr [RENAMEB(E)]) JOINb.mgr = ob.nr [RENAMEOB(E)])
P <- RENAMEP(pnr, pname, pmgr)(E) |
Recursive closure
Both one and two levels up: What's the name of John's boss, and of John's boss' boss?
| SQL | Result | Relational algebra | |||
|---|---|---|---|---|---|
(select b.name ...) |
| (...) UNION (...) |
Recursively: What's the name of all John's bosses? (One, two, three, four or more levels.)
- Not possible in (conventional) relational algebra, but a special operation called transitive closure has been proposed.
- Not possible in (standard) SQL (SQL2), but in SQL3, and using SQL + a host language with loops or recursion.
Outer join
Example: The table E (for EMPLOYEE)
| enr | ename | dept |
|---|---|---|
| 1 | Bill | A |
| 2 | Sarah | C |
| 3 | John | A |
Example: The table D (for DEPARTMENT)
| dnr | dname |
|---|---|
| A | Marketing |
| B | Sales |
| C | Legal |
List each employee together with the department he or she works at:
| SQL | Result | Relational algebra | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
select *
select * |
| E JOINedept = dnr D |
No employee works at department B, Sales, so it is not present in the result. This is probably not a problem in this case. But what if we want to know the number of employees at each department?
| SQL | Result | Relational algebra | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
select dnr, dname, count(*)
select dnr, dname, count(*) |
| dnr, dnameFcount(*)(E JOINedept = dnr D) |
No employee works at department B, Sales, so it is not present in the result. It disappeared already in the join, so the aggregate function never sees it. But what if we want it in the result, with the right number of employees (zero)?
Use a right outer join, which keeps all the rows from the right table. If a row can't be connected to any of the rows from the left table according to the join condition, null values are used:
| SQL | Result | Relational algebra | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
select * |
| E RIGHT OUTER JOINedept = dnr D | |||||||||||||||||||||||||
select dnr, dname, count(*) |
| dnr, dnameFcount(*)(E RIGHT OUTER JOINedept = dnr D) | |||||||||||||||||||||||||
select dnr, dname, count(enr) |
| dnr, dnameFcount(enr)(E RIGHT OUTER JOINedept = dnr D) |
Join types:
- JOIN = "normal" join = inner join
- LEFT OUTER JOIN = left outer join
- RIGHT OUTER JOIN = right outer join
- FULL OUTER JOIN = full outer join
Outer union
Outer union can be used to calculate the union of two relations that are partially union compatible. Not very common.Example: The table R
| A | B |
|---|---|
| 1 | 2 |
| 3 | 4 |
Example: The table S
| B | C |
|---|---|
| 4 | 5 |
| 6 | 7 |
The result of an outer union between R and S:
| A | B | C |
|---|---|---|
| 1 | 2 | null |
| 3 | 4 | 5 |
| null | 6 | 7 |
Division
Who works on (at least) all the projects that Bob works on?Semijoin
A join where the result only contains the columns from one of the joined tables. Useful in distributed databases, so we don't have to send as much data over the network.Update
To update a named relation, just give the variable a new value. To add all the rows in relation N to the relation R:R <- R UNION N
Taken from:
Friday, November 7, 2008
Prof G said
Yahooo! Yay! I was going to do that anyways, but I got no one to confirm that my codes' right. Cooool. I can't wait! So excited.
Oh on another note, I might have more responsibilities on the job come January, so I am not sure if I should defer or continue with Jan semester. But that can wait. First thing first. Exams and geometry project!
Wednesday, November 5, 2008
Let's go somewhere far away.
I will go somewhere very far away. Build my own little house. Then I will kidnap you. And we will live in that little house. You will never have to care what happens to him.
A silly thought. But a silly thought that makes me happy.
Tuesday, November 4, 2008
Understand Phong and Spaces
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
VGOPHONG.TXT - Phong lighting and specular highlights. Theory,
practice and explaination of the phong lighting
and shading model.
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
by TimJ/Vertigo
"I am he, as you are he, as you are me, and we are all together"
email: tim@legend.co.uk
irc: #coders #vertcode
revision history:
16/02/97 v1.0 - Initial version
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
INTRODUCTION
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
First off, I hope this doc is of use to some people, and maybe other
people will find it interesting.
Recently, I've been thinking a lot about phong shading and lighting.
There was something that was bugging me. I couldn't quite put my finger
on it. It was something I knew to be true, but I had to explain it to
myself. It all started when I was chatting to Vector about true phong
shading. We'd both recently looked at Voltaire/OTM's doc on fast phong
shading (again).
We were (among other things) chatting about lighting functions in our
3D engine. It was about specular highlights and the way normal (fast)
phong lighting doesn't yield specular highlights on a flat plane
(all normals pointing one way). This got me thinking. I thought, well
of course it doesn't, because the light calculated at each point will be
the same (because all normals are the same). This annoyed me because I
knew it wasn't true -- but I couldn't remember why. It's all to do with
the light vector and the view vector (and keeping them constant).
Volatire's phong method also doesn't yield specular highlights in the
center of polygons. Oh, and his method emulates the equation given
exactly -- it's not a tradeoff. But then again, it's also just the
same as using gouraud. I'll explain later.
Then I remembered the actual theory behind the lighting equations. It
stuck me that people tend to get mixed up in code and forget about the
theory behind it.
What I'll do is go through the theory, how it's implemented.
Based on that I'll then address what this doc is actually about --
highlights in the center of polygons and on flat planes.
If you think this doc is a bit slow, forgive me, but you can never please
everybody :)
[Oh, important point.. this is generally about the phong equation. You
can do it per pixel or per vertex, either way it's the phong equation.
Just because you gouraud shade doesn't mean you can't have phong style
specular highlights.]
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
LIGHT RAY REFLECTION
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
I was going to explain the theory behind light ray relfection and the
spread of the ray across a surface depending on the angle of incidence.
But but then I realized I'd have to go into they physics behind spectral
reflectivity too, so I won't :)
If there's enough demand for it, email me and I'll put it in.
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
PHONG'S SPECULAR HIGHLIGHTS
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
We need to understand how the phong lighting equation is made up. Let's
define a few useful values:
^N
|
Lˇˇˇ | R V
\ˇˇ | / __/
\ˇ | / __/
\ | / __/
\ | /__/
\|//
-------------.--------------
P
^
point under consideration
It's important you know what these values actually are:
N = surface normal
L = unit vector between point and light
V = unit vector between point and view
R = light reflection unit vector (mirror of L about N)
First, the diffuse relfection is given by the Lamertian Relfection
equation:
diffuse = Kd * (N dot L)
Where Kd is the diffuse relfection constant. (N dot L) is the same as
the cosine of the angle between N and L, so as the angle decrease, the
resulting diffuse value is higher.
Phong gave spectral reflectivity as:
diffuse + Ks * (R dot V)^n
Which is:
Kd * (N dot L) + Ks * (R dot V)^n
Where Kd is the diffuse component and Ks is the specular compoenet. This
is the generally accepted phong lighting equation. Ks is generaly taken to
be a specularity constant (although Phong defined it as W(i).. see later).
As the angle between the view (V) and the reflected light (R) decreases,
you will get more specularity.
The clever thing about Phong's equation was that it gave a neat way to
calculate the specular intensity 'bump' around the light reflection
vector (R). The larger the exponential power (n) the smaller and more
intense the specular intensity bump. Hence specular highlights.
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
IMPLEMENTATION OF PHONG'S EQUATION
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Most people simplify this equation somewhat, for speed. We begin with :
Kd * (N dot L) + Ks * (R dot V)^n
The obvious thing we'd like to remove is (R dot V). Since we don't
want to calculate the light relfection vector (mirror of light incidence
around the surface normal) -- because it's expensive. Blinn introduced a
way to do this using an imaginary vector H. It's then reduced to (N dot H).
H is defined as halfway between L and V (after L and V are normalized).
H is therefore (L + V) / 2. You will see that the angle R dot V is double
N dot H -- but this doesn't matter as you can alter the specular
exponential value (n) to compenstate. This gives us the equation :
Kd * (N dot L) + Ks * (N dot ( L + V / 2))^n
Up until now we've ignored the ambient factor, this is because it's
damn obvious and has little consequence on the math.. we'll put it in
now
Ka + Kd * (N dot L) + Ks * (N dot ( L + V / 2))^n
Which is easily implemented. You only need three vectors: the surface
normal, the light vector and the view vector. It's obviously advised
to do this equation in object-space.
Another way to remove R dot V, is by replacing it with N dot L :
Ka + Kd * (N dot L) + Ks * (N dot L)^n
This assumes you will always get the maximum specularly reflected light,
no matter where the view is. Here's why :
If we assume V is always the same as R, then the angle between N and V is
the same as N and L --
^N
| A = angle between N and L
Lˇˇˇ | R (also V) B = angle between N and V
\ˇˇA | B /
\ˇ /|\ /
\/ | \/
\ | /
\|/
-------------.--------------
Angle A and B are the same (of course, since R is the mirror vector of L).
So, N dot V becomes the same as L dot N.
This makes life easier and faster. The results completely ignore the
position of the view; so it's like having a reflective surface that always
reflects the maximum amount of specular light towards the view.
(normally, as the angle between the view and the reflected light
increases, you get less specularly reflected light).
It's just a trade off.
Ka + Kd * (N dot L) + Ks * (N dot L)^n
or
Ka + Kd * cos(theta) + Ks * cos(theta)^n
where cos(theta) is N dot L. Most likely, the above equation is the
one most people use. Also, since more implementation assume V is constant
across the scene (normalized.. at infinity) then using N dot L can be
acceptable. But it does have some dire consequences.
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
REAL TIME PHONG SHADING
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
This is what was causing the confusion. Voltaires text on phong shading
(OTMPHONG.TXT) used the equation
color = specular + (cos x) * diffuse + (cos x)^n * specular
for calculating phong lighting. This is the same as the last equation we
just disussed. He then went on to explain the specular intensity 'bump'
through the (cos x)^n term of the equation.
(note: phong shading is done by recalculating the lighting equation at
each pixel -- this is done by interpolating the vertex normals across
the polygon and re-evaluating).
Since there is just one angle term in the equation (N dot L), he realized
he could dispense with normals and just interpolate the angle.
Remember :
Ka + Kd * cos(theta) + Ks * cos(theta)^n
You only need to interpolate theta, then you can do a lookup table for
the correct colour created like so:
for( theta=0 ; theta <>
{
table[i] = Ka + Kd * cos(theta) + Ks * pow( cos(theta) , specExp ) ;
}
The problem with all this is that the original equation was inaccurate,
so the results will be inaccurate. However, Voltaire does point this
out, and state that highlights can't be inside polygons.
But, as Zog pointed out to me, you can get exactly the same effect with
gouraud, by setting up the palette in a similar way. This method is
basically the same as gouraud, you're just interpolating an angle instead
of an intensity.. as Zog put it, "it's fucking gouraud revisited" :)
I just thought I'd clear this up, as people tend not to believe it's
real, and think it's some kind of trick (if you use the same equation
in a true shader, you'll get the same results).
It's also important for the next section (the equation at least).
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
PHONG'S SPECULAR HIGHLIGHTS (REVISITED)
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
As pointed out, phong shading requires the interpolating of vertex
normals across the polygon, and recalculation of the equation.
Right, here's where more confustion comes in. To simplify things,
people tend to treat V as a constant over the entire scene.
N
L | / V (view)
(light) \ | /
\ | /
\ | /
\|/
-------------.--------------
P
V is not constant though.. it is dependant on the point under
consideration (P). So making V constant, is like sticking the view at
infinity (this is done by normalizing the view vector).
This means that the falloff of the specular light at sharp angles
between the surface and view is not taken into account (it's linear).
So the highlight will be too big and intense at sharp angles (the
falloff will be linear in respect to the view position). Also, the
highlight won't move correctly with the view.
You can probably see that the same thing can be done for L..
ie. directional lighting. Putting L at infinity affects specular fall
off with respect to the light and the view. But I'm sure everyone knows
the implications of directional lighting (it's just like having a light
really really far away).
As explained earlier, dispensing with V altogether can give you a nice
speed up using N dot L instead of R dot V.
Let's look at the consequences of dispensing with V. This is like
assuming you have a perfect reflector.. like a mirror. The surface will
always reflect the maximum amount of specular light towards the view --
the highlight will seem to 'stick' to the light relfection vector and not
change shape or size, no matter where you put the view.
But, given this, you just have to interpolate N for the polygon
(remember, we need (N dot L) and (N dot H) where is H = L+V/2)
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
SPECULAR REFLECTION
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Now we get to the crux of the problem. All that time ago back at the
start, I mentioned a plane with all the normals pointing one way.
The thing to remember is this, the lighting is *not* just dependant on
the surface normal. It's a function of the light vector and the view
vector. The important value is V, as V affects how specular light is
reflected.
If V is properly calculated, for a flat surface, the angle between the
view and the normal (which is constant) will alter.
N
V ^
\ \ |
\ \ |
\ \ |
\ \ |
\ \ |
\ \ |
-------.-----------.---
p1 p2
The angle at p1 is obviously sharper than the angle at p2. Even though
N is the same at both points. It all becomes obvious now. Unless you
calculate V correctly, the reflected specular light over a flat surface
will be the even at any point on it.
At this point you might be thinking : "what if V is put at infinity and
L is calculated properly? -- won't that do the same job?"
In a word, no, because V is the important vector. We have to remember the
original equation where the specular light was a function of R and V.
N would be constant, V would be constant, so specular light would just be
a function of V -- ie, not very accurate at all.
So, we're left with the following equation:
Ka + Kd * (N dot L) + Ks * (N dot ( L + V / 2))^n
So, basically, in a nutshell, you've got to recalculate V for the new
point under consideration. If you do that, you'll get specular highlights
on flat planes.
If you have directional lights (L at infinity) then the highlight will be
incorrectly positioned and spread -- since the angle between any given
point and the light will be more or less the same (to an infintecial
degree). On a flat surface you'd be depending on the angle the view makes
with the surface. Although, this isn't too much to worry about --
I think directional lighting is a choice, not a compromise.
[ Oh yeah, in the first section I said Phong defined Ks as W(i). Well,
this meant that Ks was a function of the angle of incidence between
the light and the surface. So specularly reflected light was dependant
on the incoming angle as well as the outgoing angle. Phong never
actually defined W(i) though -- so it's usually ignored. It does give
you another parameter for your surface to play with though. ]
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
REAL TIME PHONG SHADING (REVISIED)
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Ok, so now we know that V and L are important factors of the equation.
Voltaire's phong shading method is completely correct for the equation
he used (but as mentioned, it's basically the same as gouraud).
What he did was place L at infinity and make the surface a perfect
reflector (that always reflected the maximum specular light) towards
the view (where ever it was). I explained all this earlier anyway :)
That meant there was only one angle to interpolate, but it also meant
that on flat surfaces it was impossible to get correct highlights.
(polygons are flat :)
However, Voltaire's method is more accurate than normal gouraud for the
same lighting equation (due to the non-linear lookup table).
However, you can do the same with gouraud.. it just another way of
implenenting it (and quite redundant).
His method won't extend to other equations though.
What's annoying is when people just say his method doesn't work and is
a load of crap, without explaining why.
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
CLOSING WORDS
"picture yourself in boat on river with tangerine trees and marmalade skies"
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Well, I guess I've managed to confuse almost eveyone. What I've tried
to do is explain the factors of the phong lighting equation -- what parts
do what, and why it works.
I've probably made loads of typo's and got different bit's mixed up --
but hell, I don't care :) With any luck, I might not get flamed.
If I have mixed something up, forgive me -- it get's hard to track what
you have/have not said etc.. and it's not easy without some good
diagrams :)
There are a couple of sections I've left out.. I started the one on
light ray reflection, but left it out. I also has a section on optimizing
the equation :
Ka + Kd * (N dot L) + Ks * (N dot ( L + V / 2))^n
But I didn't get it finished (it's based on the routines I use in my
3D engine). There are no square roots, tables, divides or pow()'s used.
Yet it still produces the same results (to a reasonable degree of
accuracy -- any errors are covered up by (a). the number of intensities we
can actually display and (b). the precision of the fpu).
If there's enough demand then I'll put it in.
At the end of all this, an interesting thing to note is that all these
equations have no physical basic what so ever -- they're just equations
that fit real work observations. Light is actually better represented as
radiation -- but let's not get into that now :)
Greets:
Oh god, I don't know.. um.. people I know.. hmmm
(no particular order)
Vector
Vastator
Phred
Gooroo
Midnight
aM
Eckart
codex
PGM (where ever he may be)
BigCheese
Pel
Wog (Zog, whatever)
Crom
God
All at Abstract Entertainment
[plus anyone I've missed]
Flames/comments go to: tim@legend.co.uk
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
"Living is easy with eyes closed. Misunderstanding all you see.
It's getting hard to be someone, but it all works out. It doesn't matter
much to me."
Monday, November 3, 2008
The beginning
I don't want to see uniforms again. It was funny before. Now the joke is stale."
No tears. My heart just bleeds. You hurt me bad. I cannot even begin to understand this pain.
Sunday, November 2, 2008
FANTASTIC Explaination and Picture on Eye, World & Object Space
http://www.cs.cmu.edu/~djames/15-462/Fall03/notes/CassEveritt-MathematicsOfPerPixelLighting.pdf
However, in OpenGL, there's only 2 spaces:
1. ModelView: Object
2. Projection: Eye (or camera)
OpenGL has no explicit world space.
From OpenGL.org:
Think of the projection matrix as describing the attributes of your camera, such as field of view, focal length, fish eye lens, etc. Think of the ModelView matrix as where you stand with the camera and the direction you point it.
For the specular lights, we will need the inverse matrix to compute the camera view. However OpenGL matrix is column major. So beware!
Here is one good read on Matrix, OpenGL style.
MacTech: Macintosh Technology has a simple reading for texture gen and texture mapping.
My lighting algorithm was right as far as mathematics is concerned but I did not care about the Eye and View Space that I got them all topsy turvy. From OpenGL Forum:
+--------------+ +--------------+
| Object Space | -> Modeling Transform -> | World Space |
+--------------+ +--------------+
+--------------+ +--------------+
| World Space | -> Viewing Transform -> | Eye Space |
+--------------+ +--------------+
+--------------+ +--------------+
| Object Space | -> Modelview Transform -> | Eye Space |
+--------------+ +--------------+
The modelview matrix gets you from object space to eye space (use the inverse to get back). It doesn't know about world
space.
The only way you can use modelview to get back to world space is if your object space and world space are the same (i.e. your modeling transform is the identity matrix -- i.e. a no-op). in other words, if the position vertex data for all objects in your scene are specified in a common coordinate system.
You're probably goin to find it simpler to pre-transform your light to eye space in your app and pass that into your shader, so you don't have to think about world space in your shader.
Saturday, November 1, 2008
Semester Break
For Self:
1. Wax!
2. Threading. I can see a layer of mustache!
3. Yoga
4. Facial
5. Finish those BS sessions in Orchard.
6. Check camera & equip. Store properly.
7. Clear old lecture notes from bag. Store properly.
For Room:
1. Clean study. Setup dual monitor for mac & Dell. Buffer & speakers.
2. Rearrange furniture. Throw that ugly brown thing out. New room decor! ^_^
3. Clear clothes closet. Throw or give away clothes. Send dresses for dry clean.
4. Buy shoe compartment (Ikea). Throw or give away shoes. Send shoes for mending.
5. Vanity table. Clear old makeup. Put everything properly in their storage boxes. Some new storage compartments from bkk and tky. Need more storage? Ikea or Daiso.
Haiz... Unpack from trips.
Bring unwanted storage boxes home to mum.
Check out:
1. Tesco for home stuff & clothes(?)
2. Raid Harris bookstore for graphic books.
3. Is the Ikea near mum's opened yet?
For sg home:
1. Buy and fix the toilet seat. Dark blue.
For Friends:
1. Copy all pics from my camera for Apie.
2. Pack and label the stuff I've got for Apie & Iqbal.
3. Work with Thomad on his "Project Runway"? -- Let's discuss. Can we finish sewing classes in Dec only? Confirm that.
Need Thomad to: mend my necklace. teach me how to use the tiny sewing machine.
4. Pictures for Celine and Li Ting.
Question:
Where's my Ikea membership card? Find it.
Lights & Rays by Phong
Oooh... Dr Phong. I will study your algo and make the darn lights lit!
Basic Light Model
surfaceColor = emissive + ambient + diffuse + specular
All about lights:
- diffuse = object_diffuse * light_diffuse / (distance_to_object * angle)
- ambient = object_ambient * light_ambient
- emissive = object_emissive
- specular = object_specular * light_specular : with size of reflection determined by object_specular_power and distance_to_object and the position of the reflection based on angle.
- final_color = (diffuse + ambient + emissive) * object_texture + specular : with the sum of diffuse, ambient and emissive capped at (1.0, 1.0, 1.0)
BASICS DETAILS OF LIGHTING:
http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter05.html
More Texture Mapping
http://www.informit.com/articles/article.aspx?p=770639&seqNum=4
Perspective Correct Texture Mapping. Back to basics of U V from X Y
http://easyweb.easynet.co.uk/~mrmeanie/tmap/tmap.htm
Some simple TRIGO maths:
http://www.ies.co.jp/math/java/trig/
! year
Woah. Feels like forever.
How was I like 1 year ago? I cannot remember.
But I know I was not depressed. I know I was all sunshine and rainbow. And very excited.
But... but the people here... They're constantly stern and looked constipated all the time.
Thomad said last week, "You have not smiled in a long time, have you? You are all frowns." I guess... I am not sure. I don't remember who I used to be. I just know who I am now.
I am tired and getting nowhere.
I guess that is what this place do to you.
Wednesday, October 29, 2008
How does it feel to have a normal life?
Why?
Oh I can't explain the whole thing. Just call her. She is not emotional at all. I think she is keeping everything inside. She will burst if she continues like that.
Ok. I will call her now.
I was thinking hard. How do I call her and make her tell me these things without letting her know I am aware of it?
Hello, Ma. Sorry about yesterday. My flight was delayed. So I came back really late.
You were away for days and not even one phone call!
I am sorry.
Oh nevermind. So many things happened in those few days. Your brother has been locked up. Since Saturday night. The police came and handcuffed him away. I am not going to care this time. You hear me? I don't care anymore. I didn't even go see him. Until this morning when dad's friend beg me to. Why should I? I am not praying for him either. Let him be. Let him feel it.
She sounds angry.
What is the story this time? Oh... that... Well you know what? I think he deserves it. It's karma. I believe in it. He should too. We don't get away all the time if we are not good people. That is what I think.
Ya. Let him stay there for some time. He needs to learn on his own. We can't keep rescuing him. You know that place is really new and clean? I went there, and they were very fast. I just gave them my name and the person I want to see, in half an hour, they escorted him out. If it was the old place... takes a full day and you don't even get to see his shadow. Just keep telling you to wait. Apparently visitors can bring food for them. I saw the rest of the families came with food. I did not. I asked but he said he is getting meals. So I guess it's ok. The hearing keeps getting delayed. One moment they said it's on the 7th, then the next it's on the 20th. They just looking for an empty slot for him.
Ok.
I didn't ask her how she felt because I can guess. She is angry and disappointed. She has given up on him.
Oh. I have an incoming call. Talk to you later, alright?
This is our lives. This is how drama it is. We've learned to become very detached, emotionless because we have to deal with it. But it's not fair, is it?
Why don't I have a normal life? Why can't I just have a normal life?
And why can't I cry? This is huge. This is bad. And I can't cry. I am not able to cry when things get seriously fucked up. I'm just calm and logical. And I do what I have to do. I become a robot. I am not even sad. Luigi asked me if I am sad. I said no. I don't expect anything less from him.
But why don't I feel anything? I don't feel sad. I just don't feel anything! Strange thoughts came to my head. Like I am glad he has so many tattoos because he is such a pretty boy without them. Pretty boys don't last in the cell. Pretty boys become their play things. Pretty boys get raped.
Why's everyone so shocked and more emotional than me? I just don't get it. Luckily I can still cry. At stupid, useless things.
If I don't, I am most probably a real robot and I don't think I like the thought of that at all.
I thought about how we were as kids. Where did it start to go wrong? Sometimes, just sometimes, I feel like walking in front of a car. I am not suicidal or anything. I just feel numb. But then the thought of my mum being sad stop me from doing that. So I just continue with this numbness and crying over small things.
Oh... and I torture myself with work and school.
Had a huge migraine this morning. Saw a doctor who prescribe the migraine pills but also gastric pills because the former will cause gastric.
Such is the irony of life.
Tuesday, October 28, 2008
Biologically Inspired Model
Anyways was telling Apie about this. The thought that came to both our minds were, "Oh we can collaborate!"
She is in brain research and I can do this from computer engineering point of view. Inspire me to want to graduate and finish school.
Saturday, October 25, 2008
Want to read these books
I don't ever want to be a game programmer. But I am having too much fun
and of course, definitely:
Flatland by Edwin Abbott. So funny, about 2D and 3D mathematics.
A Wrinkle in Time by Madeline L'Engle
Ender's Game by Orson Scott Card
------- still compiling the list.
Tuesday, October 21, 2008
Related to Lighting
http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial12.php
Basic readings for 18 lights & shadows
http://www.opengl.org/resources/faq/technical/lights.htm
http://www.dgp.toronto.edu/~patrick/csc418/notes/tutorial6.pdf
Related to Texture
http://resumbrae.com/ub/dms423_f07/14/
Could be useful in our texture tile:
http://www.opengl.org.ru/docs/pg/0902.html
Download & read this:
http://www.cs.tcd.ie/courses/baict/bass/4ict10/Hillary2003/pdf/Lecture6_27Jan.pdf
http://www.nullterminator.net/gltexture.html
Step by step to texture tiling:
http://www.meandmark.com/tilingpart1.html
Simple drawing to a texture:
http://steinsoft.net/index.php?site=Programming/Code%20Snippets/OpenGL/no9
Detailed Textures...but Java?
http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial5.php
Simple to understand texturing:
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=246959
Texture Mapping Tutorial Framework, Reread this!
http://gpwiki.org/index.php/OpenGL:Tutorials:Tutorial_Framework:Texture_Mapping
Misc:
Hidden view
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/chapter_5_section_3.html
Mac idiosyncrasies
glTexSubImage2D v. glTexImage2D
"On the Mac it was necessary to make the glPixelStore*() calls before invoking both glTexImage2D() and glTexSubImage2D() -- I now make those calls before every invocation."
Monday, October 20, 2008
Calculating Normals
http://www.spacesimulator.net/tut5_vectors_and_lighting.html
Game Programming Wiki: gpwiki
Good Matrix & Vector FAQ: http://www.j3d.org/matrix_faq/
Now, please! Will you guys quit disturbing me so I can graduate and work in a sweatshop like Blizzard?
Saturday, October 18, 2008
Let's Just Be Friends
You say: Let's just be friends.
I say: Aren't we already?
You say: I don't want to get married.
I say: Neither do I.
You say: This can't go on. I know you do.
I say: It's not important.
You sob: I am sure you can find someone more worthy of you.
I choke: I've found you.
You plead: You know I love you.
I mutter: I never stop telling you.
You wonder: How sad are you?
I answer: I don't know.
You whisper: Please don't cry.
I weep: I can't stop.
I muse: I will never find someone better than you.
You brood: I will never find someone madder than you.
We hug.
To you, my mouth braves, I am alright.
To me, my mind breaks down, I am abandoned.
To you, I smile cherrily.
To me, I smile woefully.
If you're even slightly capable
Damn... I've been working average 12 hours a day and weekends!
I really need to do my laundry. I've ran out of underwear.
-ND
"Huh? Ah! Hahaha!"
A dream within a dream
And, in parting from you now,
Thus much let me avow-
You are not wrong, who deem
That my days have been a dream;
Yet if hope has flown away
In a night, or in a day,
In a vision, or in none,
Is it therefore the less gone?
All that we see or seem
Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore,
And I hold within my hand
Grains of the golden sand-
How few! yet how they creep
Through my fingers to the deep,
While I weep- while I weep!
O God! can I not grasp
Them with a tighter clasp?
O God! can I not save
One from the pitiless wave?
Is all that we see or seem
But a dream within a dream?
Edgar Allan Poe
Friday, October 17, 2008
An ode to Space Invaders
Even though it was actually a bird hunting game, her description reminded me of space invaders. So I told her she should name it that. Totally strange but quite funny.
Space invaders is the only game I like on our Atari 2600. My bro is pretty good in all the games but not me. I will start scratching my face because my Mario just can't jump high enough to get the mushroom. But I like space invaders. It's the only one game I am actually good at.
Sounds like a long time ago? Yes, it is a long time ago...
The other day we were playing Wii and Xbox 360.
Reminds me of so many things... because I am not as l33t as him, this is all I can say when he told me he had a Commodore. I gave him my heart and 7 (or was it 8? or 11?) years of my youth.
Wearing my heart on the sleeve
But there's one person who could make me cry with the snap of his fingers. Today, he made me cry again. And I cried. And cried. And cried.
Do I seem weak because I cry?
It feels so good to cry. There's so many things in my life that I should cry about and I never did.
I can't stop crying because he has this power over me.
Let there be tears!
And I obey. I cry for everything that I should but never.
I cry because I am depressed at work.
I cry because I feel useless.
I cry because I am disappointing.
I cry because I am in pain.
I cry because I miss mum. And pa. And pa...
I cry because my heart is in pieces.
I cry because I am tired.
I cry because I cannot pretend anymore.
I cry because this is really how I feel.
I cry because I have no friends.
I cry because I am sorry for how it all turned out.
I cry because I realised all the above.
I cry because I don't cry much at all. In the end, I just want the tears to keep on flowing. I cry because I need to.
Wednesday, October 15, 2008
They want the sofas!
Hello?
And what? Giving us a leather couch and $300 dollars to get something?
I can disagree, you know. It's a breach of contract. I don't like leather couch. They make my ass sweat.
Excuse me. I don't think that is right. We have a 9 seater sofas and 2 coffee tables. How's that fair? Just because there's only two of us in the house doesn't mean we don't need all the sofas! For all they know, we are having gang-bang parties every other weekend and we need all these sofas.
Sunday, October 12, 2008
I hate reading!!!
Wait. I never want to be a researcher!
Yucks!
****************
Extract from Meebo Blog.
There's an entire system of measurement that's almost exclusive to typography (1 inch = 6 picas = 72 points; ems and ens depend on the size of the font), and entire vocabulary to describe fonts and layout (kern, glyph, serif, dingbat, recto, verso, ligature).
It's all a bit pretentious, it's true, but art students are used to that. One of the more pretentious constructs is the colophon - a page at the back of some nicely designed books that describes the typography and production processes used for that book. In closing, I offer a colophon for meebo:
Meebo's logotype is set in Monotype's Arial Rounded, a sans-serif font designed in 1993 by Robin Nicholas and Patricia Saunders. Text type in meebo.com is Tahoma, a humanist sans-serif font designed in 1994 for Microsoft Corporation. Logo colors are Pantone 151 and Pantone 647. Meebo.com was launched in 2005 and is produced using JavaScript, Python, and C. Production systems run Linux.
****************
Ho ho... I actually pay attention to this kinda crap.
Tuesday, October 7, 2008
My half of the biscuit!
He: What cookie?
Me: I ate half of a cookie and kept the other half for my journey to Mordor. Wrapped in a tissue. It's elven cookie. You only need to eat very little and it will give you enough energy.
He: I guess now you will be eaten by orcs.
Me: Where's the other half of the cookie? *search everywhere*
...
He: I threw it out.
Monday, October 6, 2008
Ray Tracing
Sunday, October 5, 2008
All about Matrix
REMEMBER!
AB != BA ==> matrix multiplication is not commutative.
Cols in A == Rows in B (right, down)
Inverse
For a matrix M to have an inverse, it's determinant |M| != 0.
Given M is a 2x2 matrix.
m1 m2
m3 m4 = M
3 2
6 4 = M
det[M] = |M| = (m1)(m4) - (m2)(m3) = (3)(4) - (2)(6) = 0 QED
!! Remember this arrowing only works till 3x3 matrix. Anything more will need to manually compute. Will come back to this.
Matrix inverse
M-1 = 1/ |M| x (adjoint M)
... Crap... So hard to draw matrix. Ok Nvm. Come back to this later.
Mathworld Wolfram does a better job explaining it. Here: http://mathworld.wolfram.com/MatrixInverse.html
Ok... I should not spend so much time on this. Gotta hand in computer vision assignment in 10 days. Come back to this later.
Yum Char: Discussions over dim sums
Talked. Mostly on computer graphics, computer vision, AI and machine learning. Even in the computer engineering field, there's so many different classifications. We had a lot of ideas for a lot of things. We just need to sleep less to get things done.
Also, Quark and I come from the same school of thought. At least I am not alone. One of the first thing we have to realise as grad candidates is the fact that we are... grad candidates. So we have to think like researcher and less about application. However, I do not believe in wasting my time on things that is not useful in life. Quark agrees with me. We're more of the bottom-up than top-down people. Cool. Well, he finished his Masters way back and he still thinks like this.
Anyways, tried the annotation joke about Web2.0 on him. He totally gets it! Lol. I tried it on my colleague a few days ago. Fell flat.
So good talking to someone who understands what I am doing now!
I tried with some of my colleagues but heck, they don't even have a strong grasp of telco knowledge. Wait. that is not true. The only idiots I've met are all from this company. Oh well enough of that.
Anyways one of the idea we had was how to convey mathematical theorems and algorithms in human language. The tv series NUMB3RS did that moderately well. (I have the hots for Prof Eppes but that is another story altogether).
Here is a site: http://www.weallusematheveryday.com/tools/waumed/home.htm, deriving the whole idea from NUMB3RS to teach maths. I think it's alright. But definitely worth a visit.
Season:
2: Episode 14 - Harvest -- Hidden Markov Model.
Markov Chain Links - predicting probability of certain states in the future from what we know of the present. (Ex, was the weather yesterday: sunny, cloudy or raining. therefore what's the probability that it will rain today?)
Hidden Markov Model - In the event when we are not able to observe the actual state but only the outcome that is connected to the state by a certain probability distribution. (extend from above example, we do not know if it rained yesterday but the sales of umbrellas for yesterday was high).
Wednesday, October 1, 2008
Yuki Isoya's Seeds of Happiness
My addiction and studying music. Her youtube mv's all been removed.
But I found the song again in imeem. DON'T LEAVE ME AGAIN!
Her other music list.
http://www.imeem.com/artists/yuki/?arpa=t
