Saturday, November 8, 2008

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)

nrnamesalary
1John100
5Sarah300
7Tom100

SQLResultRelational algebra
select salary
from E


salary
100
300
PROJECTsalary(E)
select nr, salary
from E
nrsalary
1100
5300
7100
PROJECTnr, salary(E)

Note that there are no duplicate rows in the result.

Selection

The same table E (for EMPLOYEE) as above.

SQLResultRelational algebra
select *
from E
where salary <>
nrnamesalary
1John100
7Tom100
SELECTsalary <>(E)
select *
from E
where salary <>= 7
nrnamesalary
7Tom100
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

SQLResultRelational algebra
select name, salary
from E
where salary <>
namesalary
John100
Tom100
PROJECTname, salary (SELECTsalary <>(E))

or, step by step, using an intermediate result

Temp <- SELECTsalary <>(E)
Result <- PROJECTname, salary(Temp)

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:

Operation My HTML Symbol
Projection PROJECT Greek letter pi
Selection SELECT Greek letter sigma
Renaming RENAME Greek letter rho
Union UNION Union symbol
Intersection INTERSECTION Intersection symbol
Assignment <- Assignment symbol

Operation My HTML Symbol
Cartesian product X Symbol for Cartesian product
Join JOIN Join symbol
Left outer join LEFT OUTER JOIN Symbol for left outer join
Right outer join RIGHT OUTER JOIN Symbol for right outer join
Full outer join FULL OUTER JOIN Symbol for full outer join
Semijoin SEMIJOIN Semijoin symbol

Example: The relational algebra expression which I would here write as

PROJECTNamn ( SELECTMedlemsnummer <> ( Medlem ) )

should actually be written

Ett relationsalgebrauttryck

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)

enrenamedept
1BillA
2SarahC
3JohnA

Example: The table D (for DEPARTMENT)

dnrdname
AMarketing
BSales
CLegal

SQLResultRelational algebra
select *
from E, D
enrenamedeptdnrdname
1BillAAMarketing
1BillABSales
1BillACLegal
2SarahCAMarketing
2SarahCBSales
2SarahCCLegal
3JohnAAMarketing
3JohnABSales
3JohnACLegal
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:

SQLResultRelational algebra
select *
from E, D
where dept = dnr
enrenamedeptdnrdname
1BillAAMarketing
2SarahCCLegal
3JohnAAMarketing
SELECTdept = dnr (E X D)

or, using the equivalent join operation

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)

nrnamedept
1BillA
2SarahC
3JohnA

Example: The table D (for DEPARTMENT)

nrname
AMarketing
BSales
CLegal

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.)
SQLResultRelational algebra
select *
from E as E(enr, ename, dept),
D as D(dnr, dname)
where dept = dnr
enrenamedeptdnrdname
1BillAAMarketing
2SarahCCLegal
3JohnAAMarketing
(RENAME(enr, ename, dept)(E)) JOINdept = dnr (RENAME(dnr, dname)(D))
select *
from E, D
where dept = D.nr
nrnamedeptnrname
1BillAAMarketing
2SarahCCLegal
3JohnAAMarketing
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)

nrnamesalarydept
1John100A
5Sarah300C
7Tom100A
12AnnenullC

SQLResultRelational algebra
select sum(salary)
from E
sum
500
Fsum(salary)(E)

Note:

  • Duplicates are not eliminated.
  • Null values are ignored.
SQLResultRelational algebra
select count(salary)
from E
Result:
count
3
Fcount(salary)(E)
select count(distinct salary)
from E
Result:
count
2
Fcount(salary)(PROJECTsalary(E))

You can calculate aggregates "grouped by" something:

SQLResultRelational algebra
select sum(salary)
from E
group by dept
deptsum
A200
C300
deptFsum(salary)(E)

Several aggregates simultaneously:

SQLResultRelational algebra
select sum(salary), count(*)
from E
group by dept
deptsumcount
A2002
C3001
deptFsum(salary), count(*)(E)

Standard aggregate functions: sum, count, avg, min, max

Hierarchies

Example: The table E (for EMPLOYEE)

nrnamemgr
1Gretchennull
2Bob1
5Anne2
6John2
3Hulda1
4Hjalmar1
7Usama4

Going up in the hierarchy one level: What's the name of John's boss?

SQLResultRelational algebra
select b.name
from E p, E b
where p.mgr = b.nr
and p.name = "John"
name
Bob
PROJECTbname ([SELECTpname = "John"(RENAMEP(pnr, pname, pmgr)(E))] JOINpmgr = bnr [RENAMEB(bnr, bname, bmgr)(E)])

or, in a less wide-spread notation

PROJECTb.name ([SELECTname = "John"(RENAMEP(E))] JOINp.mgr = b.nr [RENAMEB(E)])

or, step by step

P <- RENAMEP(pnr, pname, pmgr)(E)
B <- RENAMEB(bnr, bname, bmgr)(E)
J <- SELECTname = "John"(P)
C <- J JOINpmgr = bnr B
R <- PROJECTbname(C)

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?

SQLResultRelational algebra
select ob.name
from E p, E b, E ob
where b.mgr = ob.nr
where p.mgr = b.nr
and p.name = "John"
name
Gretchen
PROJECTob.name (([SELECTname = "John"(RENAMEP(E))] JOINp.mgr = b.nr [RENAMEB(E)]) JOINb.mgr = ob.nr [RENAMEOB(E)])

or, step by step

P <- RENAMEP(pnr, pname, pmgr)(E)
B <- RENAMEB(bnr, bname, bmgr)(E)
OB <- RENAMEOB(obnr, obname, obmgr)(E)
J <- SELECTname = "John"(P)
C1 <- J JOINpmgr = bnr B
C2 <- C1 JOINbmgr = bbnr OB
R <- PROJECTobname(C2)

Recursive closure

Both one and two levels up: What's the name of John's boss, and of John's boss' boss?

SQLResultRelational algebra
(select b.name ...)
union
(select ob.name ...)
name
Bob
Gretchen
(...) 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)

enrenamedept
1BillA
2SarahC
3JohnA

Example: The table D (for DEPARTMENT)

dnrdname
AMarketing
BSales
CLegal

List each employee together with the department he or she works at:

SQLResultRelational algebra
select *
from E, D
where edept = dnr

or, using an explicit join
select *
from (E join D on edept = dnr)
enrenamedeptdnrdname
1BillAAMarketing
2SarahCCLegal
3JohnAAMarketing
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?

SQLResultRelational algebra
select dnr, dname, count(*)
from E, D
where edept = dnr
group by dnr, dname

or, using an explicit join
select dnr, dname, count(*)
from (E join D on edept = dnr)
group by dnr, dname
dnrdnamecount
AMarketing2
CLegal1
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:

SQLResultRelational algebra
select *
from (E right outer join D on edept = dnr)
enrenamedeptdnrdname
1BillAAMarketing
2SarahCCLegal
3JohnAAMarketing
nullnullnullBSales
E RIGHT OUTER JOINedept = dnr D
select dnr, dname, count(*)
from (E right outer join D on edept = dnr)
group by dnr, dname
dnrdnamecount
AMarketing2
BSales1
CLegal1
dnr, dnameFcount(*)(E RIGHT OUTER JOINedept = dnr D)
select dnr, dname, count(enr)
from (E right outer join D on edept = dnr)
group by dnr, dname
dnrdnamecount
AMarketing2
BSales0
CLegal1
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

AB
12
34

Example: The table S

BC
45
67

The result of an outer union between R and S:

ABC
12null
345
null67

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:

http://www.databasteknik.se/webbkursen/relalg-lecture/index.html

Friday, November 7, 2008

Prof G said

"If you guys want to work on your light codes after the exams, I will be available during semester holiday. We can go through your codes."

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 told mum.

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

And you will not get them mixed up. Unfortunately my light algorithm is still wrong and my lights aren't coming out right. Submission is in half an hour and I've officially given up. But I want to get it and read up with this:




ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

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 am a useless street rat again. I'm out of my wits. I am tired of thinking. I am worried. I am worried I can't stand back up again. The fall of me starts now. We won't have much chance to talk after tonight. Just pray for me?

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

So ironic. Here we are, preaching "a picture worth a thousand words" and no one can explain it better than the drawings on this!

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.

New travel mouse



New Logitech Cord Wrap mouse. The old paw print one died a horrible death of disconnected "tail".

Kewl! My first mobile blog!

Saturday, November 1, 2008

Semester Break

What I have to do...

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

At first, I was quite angry at this Phong fella and all this lighting and shading algorithm. But then I started reading about him in wikipedia...

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)
From: neurobs.com

BASICS DETAILS OF LIGHTING:
http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter05.html

More Texture Mapping

Very good read and easy to understand. Beyond the basics:

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

Fulfilled 12 months in this company.
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?

Call your mum. Your bro is in the precinct jail. Since Saturday night.

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

There's a really hot research topic on this saliency model in Computer Vision. But I am not doing or reading up on it. Maybe during school holidays.
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

http://www.geekculture.com/ultimatebb/Forum12/HTML/000343.html

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

Sad day: Setup Visual Studio 2005

http://www.microsoft.com/express/2005/platformsdk/default.aspx

Download PSDK from here:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm

Related to Lighting

All about lights
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 Bump Mapping

Simple bump:
http://www.paulsprojects.net/tutorials/simplebump/simplebump.html

Related to Texture

Extremely simple GL for texturing:
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

Ok I have no idea how to do that except that I have to find the perpendicular point from each triangular plane.

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

Feb 7th, 2006

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

You're going to get all the workload. Seems like that's how it works here.
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

Take this kiss upon the brow!
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

Zin was asking me for a name for her mobile game application.

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

I don't cry easily.
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.

I need a hug

I just need a hug....




Thanks, Luigi.

Wednesday, October 15, 2008

They want the sofas!

What? The owner's taking the sofas back? And the coffee tables too?
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!!!

I am not cutout to ever be a researcher.
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!

Me: Have you seen a half of my cookie?
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

As I was reading on K-nearest neighbour, for Comp Vision; kd-tree came up as a simple solution to spatial index / access method for nearest-neighbour search. Very interesting!

Sunday, October 5, 2008

All about Matrix

Matrix multiplication

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

Had lunch with Quark. Haven't seen him in a long time. He's only free this week.(Oh ya, Quark, if you are reading this, the site I was telling you about is www.modepass.com).

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

From her latest album.

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!



歡樂的種子(鄰家女孩電影主題曲) - Yuki



Her other music list.
http://www.imeem.com/artists/yuki/?arpa=t

Sunday, September 28, 2008

School: To do

Summarise MIM till now.

Read all the 3 research papers even if you don't understand at first.



Understand all the maths from CG. Do a write up.


STOP:

Stop watching youtube so much.
Stop sleeping so much.
Stop playing with your hair.
Stop being lazy.

Thursday, September 25, 2008

Representing 3D on 2D

One of the thing I felt most important to CG is the fact that we are trying to represent 3-dimesional objects on 2 dimensions, our computer screen.

Therefore, besides the X and Y axis, the Z axis is utilised for perspective control (orthogonal and modelview, will come back to this in a moment); ex: Z_near, Z_far.

Initially on my GL assignment I made the mistake of drawing my ground plane on X & Y axis, causing all my models to seem like they're stuck on their side to the wall. Wrong! Should draw the ground plane on the X and Z axis!

When drawing & loading model vertices, always remember... counterclockwise to look at the front side. Right hand rule.

CG works by: modelling --> animating --> rendering.

Texture mapping= rendering the surface without requiring additional polygons to represent minute details.

Coordinate system

This I gotta find out more: model space, world space, eye space, normalised projection space, normalised device space, image space.

2D TRANSFORMATION

translation
rotation
scaling
homogeneous coordinates
composite transformation


Rigid Motion (Euclidean Transformation) preserves the distance and angle : Identity, Translation, Rotation. ∴ Shape and orientation does not change!


Linear Transformation: Identity, Rotation, Scaling, Shearing, Reflection.

Affine Transformation: add translation to linear transformations ∴ giving us affine transformation.


3D TRANSFORMATION

homogeneous coordinate
translation, scaling
rotation
composite transformation
change the orthonormal basis

3D Affine Transformation Matrix... absolutely beautiful. Draw it tomorrow.


3D Viewing and Projection


World to Eye Coordinate Transformation
Eye Coordinate System
(related to orthonormal basis)

Grr... Projection Transformation.

2 types of projection: perspective & parallel. The key factor here is COP (Center Of Projection). If projection plane is finite == perspective. Infinite projection plane == parallel.


*****Will come back and finish this. Now I need to sleep. And have mathematical nightmares.
















Oooh... I need to come back to these:
http://www.faqs.org/faqs/graphics/algorithms-faq/
http://kesen.huang.googlepages.com/

Tuesday, September 23, 2008

Maths: Binormial Co-efficient

Binormial co-efficient

(ni) = n! / i!(n-i)!

Binormial theorem

(x + y)n = ∑ni=0 (ni) xi yn-i

in relation to FFD:

conventional polynomial basis: 1 t t2 t3
Bernstein polynomial basis: (1-t)3 3(1-t)2t 3(1-t)t2 t3


1-D example (real line)


given an arbitrary point, v, on a line of P0, P1, P2, P3.

P0=0
P1=1
P2=2
P3=3

v is given as x. t is given as the length of v to P0 divided by P3 to P0.

in general mathematical terms:

v = ∑ 3i=0 P i W i (t)



W = weight = scalar = constant

in this context:

t= ||v P0|| / ||P3 P0|| = x/3

∴ using dot product:

v = 1 • W1(t) + 2 • W2(t) + 3 • W3(t)

(P0 is ignored because P0=0; where the multiplication will results in 0)

= (31)t1 (1-t2) + 2 • (32)t2(1-t) + 3 • (33)t3

= 3t (1-t2) + 6 t2(1-t) + 3 t3

=3t [ (1-t)2 + 2t(1-t) + t2 ]

=3t [ (1-t) + t ] 2 = 3t = x

Monday, September 22, 2008

I've spent 2 hours searching for this post!!!

http://archive.atomicmpc.com.au/forums.asp?s=2&c=10&t=2770&p=0


and this:

http://archive.atomicmpc.com.au/forums.asp?s=2&c=10&t=3197

Read read read!

Free Form Deformation

Read and study:

1. FFD:
Sederberg's paper (1986)
http://www.gamasutra.com/view/feature/3372/realtime_softobject_animation_.php
http://web.cs.wpi.edu/~matt/courses/cs563/talks/freeform/free_form.html
http://www.cs.unc.edu/~hoff/projects/comp239/finalproj/ffd/ffd.html

2. Redbook: chapter 13

3. Polynormial, binormial??? <-- What is this??? FIND OUT!
http://en.wikipedia.org/wiki/Binomial_theorem

NOTE:

Redbook: TOC


OpenGL Matrix
-- http://www.morrowland.com/apron/tutorials/gl/gl_matrix.php

-- http://lists.apple.com/archives/mac-opengl/2000/Dec/msg00036.html

-- http://gpwiki.org/index.php/OpenGL:Tutorials:Theory

-- http://qa.techinterviews.com/q/20060803025430AAvfBIl

-- http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html


That darned euclidean spaces:

http://www.euclideanspace.com/threed/rendering/opengl/index.htm

GL transformation:

http://www.opengl.org/resources/faq/technical/transformations.htm

Linear algebra:

http://groups.csail.mit.edu/graphics/classes/6.837/F04/lectures/linear_algebra.ppt

Some random GL stuff:

http://bcook.cs.georgiasouthern.edu/eclass/cs/lesson8.htm




All these and then some:
vectors, matrices, and then dot product, cross product,
a little trig (sin(), cosine(), tangent()), Polar Coords and Cartesian
Coords. I'm sure I've left something out. It's not too bad. For me,
its been just sheer determination. Oh, and understanding how
OpenGL lays out its matrices.

dot product = scalar product
cross product = vector product



(1) A dot product is an example of an inner product, and is
sometimes called the "standard inner product". If U and V
are n-by-1 vectors, then the dot product is Transpose(U)*V.
If M is a positive definite matrix, then Transpose(U)*M*V is
also an inner product. In index summation notation, if the
components of U are named u_i and the components of V
are named v_j, the dot product is u_i v_i. The repeated
index means sum over it, so
u_i v_i = u_1 v_1 + u_2 v_2 + ... + u_n v_n.
If M has entries M_{ij}, then an inner product is
u_i M^{ij} v_j. The repeated i and repeated j mean sum over
both. If M is the identity matrix, you get the dot product.
For other M, you do not. This concept shows up in conjugate
gradient methods when searching for minimum values of
functions.

(2) A cross product is one example of an outer product, but
the term outer product is quite general in the world of tensors.
The permutation tensor is e_{ijk}, which is 1 if (i,j,k) is an
even permutation of (1,2,3), -1 is an odd permutation of
(1,2,3), and is 0 otherwise (when an index occurs twice). For
example, e_{123} = 1, e_{132} = -1, and e_{112} = 0. The
cross product of U and V is vector W, where n = 3 and
w_i = e_{ijk} u_j v_k
The j is repeated, so you sum over it. The k is repeated, so
you sum over it. The index i is "free" to vary, so the end result
is a singly indexed quantity (a vector).

In 2D, a vector perpendicular to U is vector W,
w_i = e_{ij} u_j
where e_{12} = 1, e_{21} = -1, e_{11} = e_{22} = 0. The
index j is repeated, so you sum over it. The "dot perp" of
U and V is a scalar
d = e_{ij} u_i v_j
Sums occur over i and j.

In 4D, a vector perpendicular to U, V, and R is vector W with
w_i = e_{ijkm} u_j v_k r_m
The rules for e_{ijkm} being 1, -1, or 0 are similar to other
dimensions. Sums occur over j, k, m. Index i is free to vary.

Another outer product of two n-by-1 vectors U and V is
U*Transpose(V), which is an n-by-n matrix. The outer
product using indices is u_i v_j. No index is repeated, so
there are no sums (n choices for i, n choices for j, total
number of choices is n*n). This concept shows up
in projection matrices. If N is a unit-length normal vector
for a plane through the origin, the projection matrix onto the
plane is P = I - N*Transpose(N).

Surround yourself with people who are like this:

Ordering take away

Mum: That family came after us. Have they gotten their dinner yet? *crane her neck to look over* Hmm... apparently not. They are still praying.


New sms tone


*Kraaaang*
He: I think your phone just challenged you to a duel.

Sunday, September 21, 2008

Pssstt... I got A

For my first GL assignment. Which... in retrospect is kinda easy and only a 10% out of the whole CG module.

But I feel great! Except that the codes don't compile on linux, different glut framework apparently.

I asked mum again, "What if I don't make it? What if I get kick out of grad school?"

She looked over at me calmly and said, "Then you should be grateful for whatever you've learned so far. And put them to good use. You already have a first degree. This is just something you're doing out of interest."

But I want to graduate. I want to do this. Even if I don't ever work in the field of CG & VR. I find this very interesting, very challenging. I like knowing that I have something else besides that nasty work place that I am in.

Monday, September 15, 2008

If I pass this sem:

I will....

1. Buy a new camera! Maybe give this one to Iqbal.
2. Get a new tattoo.
3. Clean the study room.
4. Buy Photoshop Academic for Mac.
5. Clean Mac... Re-arrange all the documents from studies.

Ok... Sounds great!!!

And if you nail the job...
DEFINITELY getting the Photoshop for Mac! And the tattoo. And the kettle...

Oh and yoga!

Sunday, September 14, 2008

Setting up a html codebox

Check out all the html markup specs here: http://www.w3.org/MarkUp/html-spec/html-spec_8.html

Friday, September 12, 2008

Wednesday, September 10, 2008

Ma! I've got it!

The common cantonese phrase.

And guess what? I GOT IT! I've managed to make my GL works! Yay!

Today has been a really upsetting day.

1. I was careless enough to delete about... 50 solutions? Crap. Oh well, whatever.

2. He lied to me. I was only testing him, and he lied to me. Great...


BUT my GL code works!
And my perl script is coming along nicely.
Oh and my C++ should be done pretty soon.
So who cares?

PERL Related

sysopen(FILEHANDLE, $name, $flags, $perms) or die "Can't open $name : $!";

find the sysopen param here: http://www.unix.com.ua/orelly/perl/cookbook/ch07_02.htm

CPAN Modules - usage

IO::Socket::INET

Perl resources:

http://www.perlmonks.com/

Read them when you have the time

Tech-ish, maybe. Not sure:

Debug like a ninja

Monday, September 8, 2008

MacOS || XCode || MacFramework.OpenGL || MacFramework.GLUT


http://search.lists.apple.com/


OpenGL Gotchas

Funny nerdy quotes

I'm a programmer. My attitude starts with arrogance, holds steady at condescension, and ends with hostility. Get used to it.

"Self-education is, I firmly believe, the only kind of education there is." - Isacc Asimov

"He was the sort of person who stood on mountaintops during thunderstorms in wet copper armour shouting 'All the Gods are bastards.'" - Terry Pratchett

If you understand what you're doing, you're not learning anything.

Gawking at stupidity.

Reality is what, when you stop believing in it, doesn't go away. Failure is not an option. It is a privilege reserved for those who try.

One thing I've noticed lately is that many engineers in different fields (EE, ME) don't try to simplify and automate things as much as software people do. I'm not sure why that is, or even if it's true in general. After all, the sample size I'm basing this on isn't very big (a couple dozen engineers I've worked with).

It may be cliche, but it seems that people who get good at writing software are motivated by laziness. If everyone was as constructively lazy as a good programmer is, the whole world would be more efficient.

--From here

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Rick Osborne


I try to compress orders at restaurants by giving all necessary information in one packet. This frequently does not work, because the order taker's task buffer is limited to one piece of data at a time.

Fast Food Girl: Can I take you're order?

Me: number 6, BBQ, diet cola, debit.

FFG: What dipping sauce would you like?

Me: BBQ, diet cola, debit.

FFG: What would you like to drink?

Me: Diet Cola, debit.

FFG: Is Pepsi OK?

Me: [ponders Abstract Base Classes and the FFG's lack of Polymorphic Behavior] Sure. I'll pay with my debit card.

FFG: And how will you be paying?

Me: [sighs] debit.

--From here



Personal:
I think I will die of exhaustion like this. I cannnot not sleep for so long!

Sunday, September 7, 2008

Is my life on tv?

I just want to tell you, he died. You know? His friend, taiko? Well he died. Vomitted blood. Died at home.

Oh. I just saw him that weekend. You are not joking right? *I feel stupid saying that because I know mum doesn't joke about things like that but I had to be sure*

I had to deal with his things. He's an orphan. I hired people to deal with everything. He is only my son's friend. Oh... I am so tired. Can I disown my son? I really think I want to do that.

Mmm... That boy... is quite naive. Good boy. For all he is, whatever he was doing, he is really just a naive boy.

The life he was leading... His existence was on loan anyway. I wish I don't have this son. Is it my karma? I hope I get to sleep tonight. I've not slept much.

Mmm... Is the funeral over? How's my brother taking it?

Yes. 7 days ago. I've dealt with it. I arranged everything. Your brother? He's back in malaqa. He just runs away whenever anything happens and leave us to clean up after him. I took care of the boy's house and funeral. And his things.
You come home some time soon, ok? To see me. Life is brittle.

I have a short school vacation soon, I will go home then.

Alright, Tell you more when I see you. I don't trust our conversation over the phone.



I wanted to say something but nothing I can say is of that magnitude. I started a sentence but then I said,"Oh well, it is just work. Not like what you're going through anyway."

My brother once said, "Don't love old people too much, because they die too soon. And then you will be heart-broken." I think, I will like to change that. Don't love anyone too much because they just die.
Reminds me of "A Scanner Darkly"; which I couldn't finish because it is too close to home.

Saturday, September 6, 2008

Computer Graphics: Matrices... and then some

http://www.geocities.com/SiliconValley/2151/matrices.html

Thoughts on AI...
"I = i * o * p * N
where i is input, o is output, p is the ability to plan, and N is multiple ways of doing these things.

In the realm of AI, this means,
input is multiple sensors.
output is the ability to interact with your environment.
p is the ability to see the relationship between the input and the output
N is the ability to see relationships within the relationships."


Oh oH Zeus CMD

C++ Maths definition.

Tuesday, September 2, 2008

C++, GL, GLUT problems & solutions

how to use: glGetError()

AARGH!!! I can't believe I am so stupid! I kept having the window crashing on me. Now I know... I forgot:

glutPostRedisplay();

at the end of keybored function. And I've spent endless nights thinking about where I went wrong!

va_list

I am right now having some problem with va_list. So as I was searching on the compilation error, I chanced upon this thread:

Oh for ........s sake, pay attention!!!!
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044651050&id=1043284351

I used foo() because your crummy broken code didn't even have a function prototype in scope to even quote back at you. Just a bunch or random crappy lines of poorly indented code.

Sheesh!!!!!!!
no wait, that's not it
SHEESH!!!!!!!!!!!!!

A bit of advice, do not under any circumstances buy a gun. You're simply not equipped to cope with it's point and click interface. Trying stuff and then asking "what does this do" just isn't going to work.


And I thought I have bad temper. Haha.

Endianness in computer programming... I remember this... Ok! RECAP!


glutMouseFunc - wheel

Ok. Just as I thought. Mouse scroll with GLUT under MacOsX does not work. See here.
So I've decided to fore go the use of wheel and improvise with mouse x,y... Maybe I can use 2 buttons click for scale function.


GLUT README
.

GL_LINES for ground grid: There's no precedence for vertex if you're using GL_LINES. The vector drawn will still look the same either way.

Monday, September 1, 2008

Specific OpenGL sites for...

mouse function:-

rotate: glRotate
translate: glTranslate
zoom:

samples eer... aaah...

Saturday, August 30, 2008

Bite bite bite

In case some people are wondering, Chio-Bu site is taking a long sabbatical. Very, very long.

I don't appear stress. I don't even think I am stressed.

But somehow, I've bitten my nails down to nothing and the skin around them's bleeding. My lips are bleeding too even though I am sure I am not consciously biting them. Ouch!

Oh... I just threw up. I couldn't hold my food down.

Thursday, August 28, 2008

New notebook bag for all the junk.

As a lazy vain person, I will like the perfect pretty bag that can fit all my junk.

So I searched around after seeing Andy's huge ass red Crumpler (by the way, is very good looking and functional but just so common). Andy blames the need for the gigantic bag to our company notebook. I agree!

This site cracks me up "Laptop cases are no longer simply about getting your laptop from one place to another; you can do that with a plastic grocery bag." I agree!

This site has interesting list! Oh Oh and that Pantagonia is so beautiful!

Anyways, I've decided that Timbuk2 is prettier but I will need to go to Apple store to check out STM, Booq, Chrome and the likes.

But I am so in love with the functionalities from Axio's Beatbox bag. Perfect for my plan of 2 notebooks. But I imagine I will topple over backwards (if it comes with any sling at all, which it doesn't).

I want a messenger anyways because my old notebook bagpack scratched my armpits till they sore.

Now how do I find the time to go shop for my perfect notebook bag?

Note: This slimplug is absolutely brilliant! Too bad mac can't have it.

EDIT: Phew! I went ahead and bought the Crumpler Harry Hoard in red. Why? It will fit all my junk and most probably protect my macbook. And then if I don't have other crap, I can fit 2 notebooks in. Cool! But I've gotta do something about the colour. Add fabric on it or something. It looks too... hygienic.
Woohooo! Spent more than an hour "asianificating" the bag. Now I am in love with it!
I was at Fall Factor in Alexandria Village. I must say Chrome messenger's so functional and clever. The seat belt thingie is really something. But I sorta think that I look like a turtle with the bag on my back. So eer... nopey.

Tuesday, August 26, 2008

When I just can't seems to understand polygon drawing

I've been scratching my face (yes, when other people're confused, they scratch their head. I know, but I scratch my face), trying to figure out a way to draw my model at least in mesh or polygon. But I'm still stuck.

I wonder if I am supposed to use the gl primitives or glu. Grr... It's been bothering me and I can't even eat due to this obsession.

Oh wait. Somebody is talking about polygon tessellation. Polygon what? Constellation? Castration? Eh?

Wikipedia:
A tessellation or tiling of the plane is a collection of plane figures that fills the plane with no overlaps and no gaps.

In the subject of computer graphics, tessellation techniques are often used to manage datasets of polygons and divide them into suitable structures for rendering. Normally, at least for real-time rendering, the data is tessellated into triangles, which is sometimes referred to as triangulation. In computer-aided design, arbitrary 3D shapes are often too complicated to analyze directly. So they are divided (tessellated) into a mesh of small, easy-to-analyze pieces -- usually either irregular tetrahedrons, or irregular hexahedrons. The mesh is used for finite element analysis. Some geodesic domes are designed by tessellating the sphere with triangles that are as close to equilateral triangles as possible.

Ok.... I sort of think I understand?


These days, I use my lunch hour for reading. In no time, I will be skinny again! Whee.


Hai... On another note, my faculty is going to use me as the face of Computer Engineering. Har? What? Like school mascot? Ya. My face will be on national newspaper! Crap. I hope it's at page 176. Yep the second edition that didn't get to print. Now everybody will know I am in grad school.

Friday, August 22, 2008

What I think of grad school in the first 3 weeks

My first thoughts were:
I must be mad! Why did I choose this?

What am I majoring in? Virtual Reality. Huh? Yes. Quite mad, I know. But I was extremely bored at work and I've nothing much to occupy my mind with.
I didn't want to major in embedded systems or bioinformatics... which were the other two choices. So I chose this. Not much from Computer Engineering faculty really.

I still think I am mad and I hope as hell I don't drop out or worse; get kick out because I don't meet the GPA.

But I am starting to enjoy it a little.
The workload is absolutely inhuman. Oh I hope I make it. I must!

NOTE:
Wheeeeeeeeeeeee! My 3D model loads!!! Well, not really. The vertices' plotted but but they look like an explosion now. Let's see....

Wednesday, August 20, 2008

Interesting Unix related reference

http://unix.t-a-y-l-o-r.com/index.html

On 3D mesh and polygon:

http://research.microsoft.com/displayarticle.aspx?id=690

Tuesday, August 19, 2008

OpenGL with some breakthrough!

I've been staring at the beginner's opengl codes. Starting to make more sense to me now.

Yay! Will write the breakdown notes later.

This is great quick reference:

http://wiki.vislab.usyd.edu.au/moin.cgi/Multimedia_Computing_and_Processing/Tutorials/OpenGL_Basics


http://www.ace.uwaterloo.ca/~liho/homepage/opengl.html

Monday, August 18, 2008

Samsung Z800 modem with Macbook- Leopard

It works like a charm!

No driver installation.

System Preferences --> Network:

Samsung CDMA Technologies.

The settings:


Click on Advance to set the:
Vendor: Samsung
APN: internet

**these settings only work for Singtel BOM users.

Sunday, August 17, 2008

When you're an idiot at XCode and GLUT

OneSadCookie: Xcode/GLUT Tutorial

GL Overview:
http://www.freepascal.org/docs-html/packages/opengl/gl/index.html

Some theory & maths:
http://www.meandmark.com/articles.html

OTHER UNIS:
http://www.csse.monash.edu.au/~jonmc/CSE3313/Resources/SampleCode/index.html

BEGINNERS:
http://www.nextdawn.nl/

http://www.videotutorialsrock.com/

http://www.codesampler.com/oglsrc.htm

http://www.lighthouse3d.com/opengl/tutorials.shtml

SAMPLE:

http://www.opengl.org/code/

WIKI:
http://wiki.gamedev.net/index.php/Main_Page


GLUI for Mac OS X:
http://lukecyca.com/2007/02/14/glui-23-framework-for-mac-os-x/

Saturday, August 16, 2008

As I stare at the gl codes

You're taunting me, aren't you?

The habit is... if you stare at something long enough, it will make sense to you. I believe I've stared at this piece of code long enough. And yet I still don't understand it.

Good luck!

Friday, August 15, 2008