• Using an Apple Keyboard on Windows

    Intuitively I would like to use the Cmd key (the left one at least) in a similar way as on Mac OS. The easiest method for that is to map the LWin to LCtrl from SharpKeys. This also provides ergonimic assists for using emacs. Some other keys such as Ins …


    Install pip packages for Blender

    Find out the version of python bundled with Blender by using the python executable at Blender/version_number/python/bin/python.exe Install python of the same version elsewhere on the computer Copy "include" and "libs" directories from that installation and paste them to Blender/version_number/python. We need the c …


    VisualSVN Notes

    VisualSVN Notes VisualSVN Server comes with svn.exe on its own. It doesn't depend on TortoiseSVN(Graphical client with optional toolchain) or ApacheSVN(toolchain only). If VisualSVN and TortoiseSVN are both installed, they will be accessing the same .svn folder of a repository. So TortoiseSVN can serve as a graphical …


    Using Vulkan dynamic uniform buffer

    Alignment Dynamic offsets can only be read correctly when aligned. The alignment usually lead to paddings between the required data structures. E.g., minUniformBufferOffsetAlignment = 0x100 // 256 a 192-byte uniform struct will be padded and takes 256 bytes. Struct array Struct arrays are usually used in storage buffers. The length of …


    Blender materials notes

    Things I've noticed about Blender created materials: Generally what you set in Maya materials will reflect truthfully by ASSIMP. Therefore Maya can be used to inspect materials created by Blender, saving the work of compiling programs to print the values of ASSIMP material keys. Blender sets default values to material …


    Transforming screen space to/from camera space

    Camera space to screen space $$ clip = \text{projection matrix} \cdot \text{camera space position} $$ $$ ndc = \frac{clip_{xyz}}{clip_{w}} $$ In OGL, NDC space is left-handed. While in Vulkan, it is right-handed ($y$ pointing down, $z$ pointing front). In glm there are different projection matrices to reflect that. $$ screen_{xy …


    Building ASSIMP

    Notes on building ASSIMP Read CMakeLists.txt to find the right variables to change. Enable/Disable importers with ASSIMP_BUILD_XXX_IMPORTER option I've only been able to build its Android lib in static for Android Studio projects so far. To link to the files in INSTALL directory should be the most convenient …


    Vector transformation using projection between orthonormal bases

    $a_{\text{object}}$ is a vector in the object space, which has an orthonormal basis $(u, v, w)$. $$ a_{\text{object}}(u, v, w) = \text{u} u + \text{v} v + \text{w} w. $$ The projection relation between $(u, v, w)$ and the world space orthonormal basis $(x, y, z)$ is …


    Build shared libraries with CMake on Windows

    Snippets of building shared library with CMake using different compilers.


    Sampling from an image

    Code and result of sampling an image using inversion method.


    Sampling from 2D distribution

    An example program of 2D distribution sampling using inverse CDF method.


    Sampling from 1D distribution

    An example program of 1D distribution sampling using inverse CDF method.


    Mitsuba renderer built-in BSDF samples

    For study purposes, I was trying out the Mitsuba renderer. The first of the following renders shows the result from a "path" integrator, and the second from a "bdpt" integrator (which appears to has higher noise then the former) with spp of 64 and max path trace depth of 7 …


    Sampling from a hemisphere

    By following the same steps of CDF function inversion method from the previous post, a pair of canonical random variables $(\varepsilon_1, \varepsilon_2)$ can be transformed to sample on a hemisphere. The general CDF takes the form of $$ C \int_0^{\phi_0} \int_0^{\theta_0} w(\phi, \theta) \mathrm{sin}\theta\mathrm{d …


    Uniform sampling from a disk

    To use a pair of canonical random variables $ (\varepsilon_1, \varepsilon_2) $ to sample uniformly from the disk of radius $ \mathit{ R } $, the CDF function inversion method can be applied. The first step is to calculate the normalization constant $ \mathit{ C } $ of the probability density distribution function under the polar coordinate measure …


    Using Flycheck with glslangValidator for syntax checking and SPIR-V compilation from GLSL source code

    In the not so long time that I have been working with Vulkan, I adopted the method of scheduling shader compilation right before starting building the program. Syntax checking therefore happened at a rather inconveniently late stage. On the other hand, I haven't successfully spotted a Visual Studio plugin that …


    Rendering dynamic cube maps for omni light shadows with Vulkan API

    This post shares my process and discovery during the implementation of a dynamic variance shadow map with Gaussian pre-filter for omni lights. The first part explains three possible solutions for dynamic cube map rendering. The second part focuses on UV wrapping for the filter pass.