Bought it !
I'll watch it next week after I've done my current work, and write a review here.
Can't wait...
Saturday, April 26, 2008
Thursday, April 24, 2008
Conjugate gradient method
Conjugate gradient method is used in two ways.
1) Solving an optimization problem: obtaining the condition to minimize some function.
2) Solving a system of linear equations.
2) is an application of 1). First define a function which gets minimum when the equations is satisfied, then using 1), get the condition = the answer of the equations..
An excellent document about conjugate gradient method.
"An Introduction to the Conjugate Gradient Method Without the Agonizing Pain"
www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf
Anybody who starts learning conjuagate gradient method should start here.
This document should be registered as a world heritage.
Monday, April 21, 2008
Houdini HDK class hierarchy
This is a birds eye view of Houdini HDK class hierarchy I made it when I was having fun with Houdini apprentice last year. GD* classes are not shown here. Just for those who are learning HDK.
(Click the image for a larger size)
XSI scene graph
Note: They don't seem to be on the XSI blog anymore. It's a shame they were excellent.
This is a very good article about XSI scene graph.
http://www.xsi-blog.com/archives/57
Though it looks quite different, basically it's not so much different from Maya's dependency graph, it has connection, lazy evaluation with dirty. But an operator can modify data itself without caching, it should mean it has more freedom of designing caching mechanism when creating a custom operator, though it is more difficult to create one. And having an operator stack in a data object is good, you can see the construction history of a node at one place with the data itself. Letting us free from nasty reference data wrangling is also good.
I'm just wondering why FxTree (what is this? I'm not an XSI user) is a pure operator graph. There's a history about the birth of FxTree http://www.xsi-blog.com/archives/77#more-77 . Because it is usually not a good idea to mix two concepts, I just wonder if it is just a historical reason or it gets some benefits from being a pure operator graph.
Saturday, April 19, 2008
Measuring color difference
This blog entry is incomplete. Equations to get XYZ is wrong.
The other day I was asked how we could get the "difference" of two colors.
RGB value in a CG software is not proportional to what the monitor outputs due to gamma. So we will first correct it. We assume the monitor setting is sRGB. According to sRGB official document (IEC 61966-2-1) we will convert sRGB to XYZ,
We can convert an sRGB value to a linear-RGB value by
Wrong. Should use sRGB->linear-RGB equation.
Then convert it to XYZ.
Wrong. Should use linearRGB->XYZ equation.
if one ore more of R_liner, G_liner, B_linear value is less than 0.0031308, use
Wrong. Should use linearRGB->XYZ equation when linear value is small.
instead only for that color(s).
doesn't represent the perceptual color difference. L*a*b* color space was invented for that purpose. (Like XYZ, a set of three values L*, a* and b* represent one color)
indicates the perceptual color difference. So we will convert XYZ to L*a*b*.To take color adaptation into account, L*a*b* requires "white point", i.e. ambient light color = your light on the ceiling. To adjust the XYZ color
where- A: (Xn, Yn, Zn) = (109.851, 100, 35.582)
- B : (Xn, Yn, Zn) = (99.095, 100, 98.072)
- C : (Xn, Yn, Zn) = (98.072, 100, 118.225)
- D65: (Xn, Yn, Zn) = (98.072, 100, 108.892)
These are values I found on the net. I still cannot find the accurate way to calculate the value.
Then depending on the value of X', Y', or Z', again if one of more value of them is larger than 0.008856, use
or if it is smaller, use
finally,
Now you can use above (color diff) equation to get the difference of color.Basically it is the same as what is written in Wikipedia (at least this moment), except that the Matrix in sRGB->XYZ calculation is a little bit different.
References:
http://www11.tok2.com/home/yoshih/color_index.html (japanese)
http://www005.upp.so-net.ne.jp/fumoto/linkp25.htm(japanese)
http://www.jsa.or.jp/stdz/edu/pdf/b4/4_02.pdf(japanese)
http://idlab.inha.ac.kr/lecture/lecture.pdf(korean)
Chromatic Adaptation demo
I found a super cool chromatic Adaptation demo. You can test your eyes' chromatic adaptation here.
http://www11.tok2.com/home/yoshih/color_demo.html.
In the middle of the page where you see two colors, yellow on the left and blue on the right and a little circle in the center, gaze the little circle for a while, then put the mouse over the area. It's amazing you can see the picture naturally.
Friday, April 18, 2008
asyncore v.s. twisted
There are several module/packages available when you make a server-client program.
asyncore is a Python standard module, i.e. when you install Python on your machine, you can use it immediately. Twisted is an open source project. They are both for server-client programs.
While I was making pyCommandPort, I tried not to use twisted, because it's just a small utility plug-in and twisted is too much overkill. I didn't want the force the users to install twisted on their machines, instead I used asyncore. I could do low level socket programming/multi thread programming but it was another bothering and time consuming work.
Actually asyncore and twisted are quite similar. Both of them have a single main dispatcher and user functions are called by the dispathcer. While asyncore is for only server-client type programs, twisted is for any programming that deals with blocking behavior i.e. behavior that needs to wait for some slow processes. Though twisted is typically used for network programming because server/client communication is a typical slow response, twisted's usage is not limited for that purpose.
One example is "Maya execution". I used MGlobal::executePythonCommandOnIdle() API. When it is called with a Python script as a parameter, Maya registers it in the internal queue of Python scripts, and when Maya had done everything (rendering, subdividing polygon, ...), it executes the queued Python scripts one by one, in the main thread. This is not Maya specific function, many framework has it, e.g. wxPython has equivalent function. wx.CallAfter() is the one. When you call MGlobal::executePythonCommandOnIdle(), you can never see when it is executed. It may be executed immediately, or tomorrow. I wanted to send the error message to the client of pyCommandPort server, and it is another type of 'slow response' behavior. Since asyncore is only for network programming, it cannot handle these problems nicely.
If it had been something like querying something to the database server instead of Maya execution, asyncore can handle it because accessing to a database server is a network programming, but in this case not. asyncore tries to do everything in the main thread, and the main thread cannot wait for Maya execution at the same time waiting for another incoming connection.
Twisted is much more flexible. I will write what a twisted programming is like on another post soon.