Skip to main content

Posts

Showing posts from August, 2010

boost.python: os.environ and LD_LIBRARY_PATH

This article is again about programming language, so if you are not interested in this area, see you next time. My first python project is a test suite. I like Martin Fowler's articles, so, naturally, my first program is a test. My project is usually started with test, documentation, and interface design, yet incremental. This is about python's os.environ and LD_LIBRARY_PATH. This is a follow up of the boost.python's story. My development environment is Linux, but later I have a plan to go to Windows also. In python interpreter, we can change the environment variables through os.environ. For example, if you want to change the LD_LIBRARY_PATH:   os.environ['LD_LIBRARY_PATH'] = '/some/directory/lib' I thought this is all for LD_LIBRARY_PATH, but I hit a wall. My department policy doesn't allow to have administrator right and Internet access to the developers. Therefore, if I want to use something not in my computer, for example, boost or python,

German translation of Murakami Haruki's cool and wild daydream

We translated Murakami Haruki's cool and wild daydream (in Murakami Asahidou Haiho-, Shinchousha) to German.  (村上春樹のワイルドでクールな白昼夢)

boost.python: how to pass a python object to C++ world and how to return a C++ created object to the python interpreter

This is a programming language story. If you are not interested in such theme, see you other time... I usually use ruby for scripting, however, in industry python is quite widely used. When I was a student, I was just interested in programming languages, yet I just interested in them for a few weeks and I did not use most of them. But, recently I even did not look into, I feel I become old... This time, I will try what so called ''python.'' (In my Japanese Web, this is ''皆のすなる python というものを,'' this is beginning of Tosa-nikki by Kino Turayuki, established around 935. Sadly, I can not translate this well by my poor English skill.) First I read a book, Learning Python by Marc Lutz. I took around two weeks, it is fun and I find python interesting. Then this week, I started to implement a program. There are a lot of introduction web pages of python, so, it is not worth to add something similar to the net, the readers will be also bored such blog entry.

unsigned and size_t are hard.

This is a computer language story. So you are not interested in that, I recommend to go to next. C++ has a type 'unsigned' X, e.g., 'unsigned int.' For example, a minus index of an array usually doesn't make sense, therefore this type is used for that. This type is good for bit array storage, but using an unsigned int instead of an int to gain one more bit is almost never a good idea. (*) Especially combination with implicit conversion makes this hard. I think this unsigned number is not intuitive when the computation result is minus, it still stays a positive number. For example, unsigned int -1 is usually equal to 4294967295 on 32bit machine.  This is depends on how an integer number is represented in a computer. Even one who knows this internal representation wrote a code on 32bit environment, sometimes it doesn't work on a 64bit machine. For example, he/she assumes size_t and unsigned int are the same type, and uses -1 as an illegal value. The followin

A personal annotations of Veach's thesis (16) p.168

p.116 4.6 Adjoint operator I look back to the chapter 4.6 since adjoint operator is important topic now. This operator is written as Hermitian. This is a conjugate transpose, I just imagine what could be imaginary energy. There was a story about Hilbert space, so, maybe this is related with that. But until chapter 7, this operator indicates only real symmetry. In the light transport equation, the light emitted to a surface and reflected, then reaches to the camera. If the camera and the light exchanged, the equation should be the same. I think that is this adjoint operator about. Acknowledgements Carsten W. gives me a comment my understanding sounds OK. Thanks. p.122 particle tracing Equation 4.32's comment's comment My blog explain why the weight is there. But if you see p.226 Equation (8.9) explains brief and precise. Also it is general, since I only handled two cases, instead, Veach's form is an integral form and everything is there. How simple he explained t

A personal annotations of Veach's thesis (15) p.168

p.168 D3 and Equation 5.30 updated I got a comment about Equation 5.30 from my friend Daniel. However, Equation (1) has absolute value operator at |f'(x_0)|, I don't understand this yet. To see this Equation, we could think about this is a chain rule. If we write this in an integral form (as the substitution rule) as in the Equation (2). This is substantially equivalent with the chain rule. But still, the domain doesn't match with Equation 5.30. On the other hand, if we read the thesis until p.170, Equation 5.35 is a definition and this looks like showing a linearity. It is Equation (3). Maybe the question is, what is the linear coefficient a_{\beta}. That's my guess. What coefficient makes this equation consistent through the Dirac's \delta, that could be the definition of Equation 5.35. This has an advantage, if this can be, we don't need integrate every time, this \delta looks like just an ordinary function. This is convenient. (as the Veach said in

A personal annotations of Veach's thesis (14) P.137,p.140,p.168

p.137 Shading normal The shading normal differs from the geometry normal. The shading normal has no physical meaning, therefore, this causes a trouble if we use it to compute physical energy. Indeed, if we use the bump mapping, then the energy computation for the geometry must be handled something special. p.140 Figure 5.1 The light energy inside of refraction object should be scaled. I never think about that. Indeed, water (refraction object) makes incoming light more dense inside the water. This means energy is concentrated inside. Therefore, we need to consider this. But the usual case, when light goes into the refraction object, then energy concentration happens, also when light goes out from the same refraction object, the inverse effect happens and the energy is un-concentrated. Therefore, I never think about that. In this figure, the algorithm need the energy of inside the water, this effect should be considered. For example, if a camera is inside the water, there could be

A personal annotations of Veach's thesis (13) P.88, p.122

p.88 Notation of Equation 3.6.3 In Equation 3.6.3, there is a d!, it looks like a operator. It is used as d! cos theta d phi. However, I could not find the definition of this (friends and web.) p.122 particle tracing Equation 4.32 In this Equation about alpha , there is a mysterious (for me) term 1/(q_{i+i}) . f is projected solid angle, p_{i+1} is approximation of BSDF, so no problem. But, what is this 1/(q_{i+i}) ? Figure 1: Sampling weight $\frac{1}{q_{i+1}}$. (1) terminate sampling by  probability $p$, (2) bounce probability is $(1-p)$. Because, the sample  value is better than nothing, the case (2) is respected by  $\frac{1}{1-p}$, that is $\frac{1}{q_{i+1}}$.} Figure 1 shows the alpha update. The sampling is done by the Russian roulette method, then, the termination of a ray is decided by a probability. Intuitively, when you continue to sample, it is natural to respect the sampled result more. Because a sample has more information than no sample. Therefore, the sam