<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on siware.dev</title><link>http://localhost/post/</link><description>Recent content in Posts on siware.dev</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><copyright>© 2026</copyright><lastBuildDate>Fri, 06 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://localhost/post/index.xml" rel="self" type="application/rss+xml"/><item><title>Texture Compression of Smooth Gradients</title><link>http://localhost/post/016-texture-compression-smooth-gradients/</link><pubDate>Fri, 06 Nov 2026 00:00:00 +0000</pubDate><guid>http://localhost/post/016-texture-compression-smooth-gradients/</guid><description>&lt;p&gt;A smooth gradient looks simple, but it can be surprisingly difficult to compress. Small errors that disappear inside a detailed texture become visible as bands, color shifts, and block boundaries against a smooth background.&lt;/p&gt;</description></item><item><title>Line Fitting</title><link>http://localhost/post/012-line-fitting/</link><pubDate>Fri, 21 Jul 2023 00:00:00 +0000</pubDate><guid>http://localhost/post/012-line-fitting/</guid><description>&lt;h2 class="relative group"&gt;Line Fitting via Least Squares&#10; &lt;div id="line-fitting-via-least-squares" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#line-fitting-via-least-squares" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;Given a data with $n$ samples ${(x_0, y_0), (x_1, y_1), ..., (x_{n-1}, y_{n-1})}$, we want to approximate the function with a line $y = f(x) = mx + c$.&lt;/p&gt;</description></item><item><title>Linear Spherical Harmonics</title><link>http://localhost/post/010-linear-spherical-harmonics/</link><pubDate>Tue, 30 Nov 2021 00:00:00 +0000</pubDate><guid>http://localhost/post/010-linear-spherical-harmonics/</guid><description>&lt;p&gt;In graphics, we often deal with spherical function, i.e. function that is defined on the surface of a sphere. &lt;em&gt;Spherical Harmonics (SH)&lt;/em&gt; is a commonly used tool to represent spherical function by writing it as an infinite sum of these spherical harmonics. However, in games, we usually limit the number of basis functions to either 4 or 9 basis functions. They are called linear SH (SH2) and quadratic SH (SH3) respectively.&lt;/p&gt;</description></item><item><title>Transformation Notes</title><link>http://localhost/post/009-transformation-notes/</link><pubDate>Tue, 26 Oct 2021 00:00:00 +0000</pubDate><guid>http://localhost/post/009-transformation-notes/</guid><description>&lt;p&gt;Here&amp;rsquo;s my notes on transformation between 3d spaces. All maths tries to follow math textbook notation.&lt;/p&gt;&#10;&#10;&lt;h2 class="relative group"&gt;Inverse of 3x3 Matrix&#10; &lt;div id="inverse-of-3x3-matrix" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#inverse-of-3x3-matrix" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;Inverse of 3x3 Matrix can be defined as dot and cross products computation (so it&amp;rsquo;s easier to remember).&lt;/p&gt;</description></item><item><title>Compute Shader Spaces</title><link>http://localhost/post/007-compute-shader-spaces/</link><pubDate>Wed, 19 May 2021 00:00:00 +0000</pubDate><guid>http://localhost/post/007-compute-shader-spaces/</guid><description>&lt;p&gt;Many times I found myself having difficulty with compute shaders and its mostly about terminology. As always, my way of overcoming this confusion is to make rules for it. This post is my personal rules about how I think about compute shaders in D3D, hopefully you will find this useful.&lt;/p&gt;</description></item><item><title>The Rendering Equation</title><link>http://localhost/post/006-the-rendering-equation/</link><pubDate>Fri, 14 May 2021 00:00:00 +0000</pubDate><guid>http://localhost/post/006-the-rendering-equation/</guid><description>&lt;p&gt;This is one of the most important equation for rendering:&lt;/p&gt;&#10;&lt;p&gt;$\displaystyle \quad L_o(p, \omega_o) = L_e(p,\omega_o) + \int_{S^2} f(p,\omega_o,\omega_i) \\; L_i(p,\omega_i) \\; (n \cdot \omega_i) \\; d\omega_i$&lt;/p&gt;&#10;&lt;p&gt;The equation above requires integration of incoming radiance over all possible directions in the hemisphere. Note that this formulation is more suited for distant lighting which is why it&amp;rsquo;s weighted by the solid angle $d\omega_i$.&lt;/p&gt;</description></item><item><title>Discrete Fourier Transform</title><link>http://localhost/post/005-discrete-fourier-transform/</link><pubDate>Tue, 16 Mar 2021 00:00:00 +0000</pubDate><guid>http://localhost/post/005-discrete-fourier-transform/</guid><description>&lt;p&gt;The idea of &lt;em&gt;Fourier&lt;/em&gt; is that a function (signal) can be decomposed as infinite number of &lt;em&gt;sine/cosine&lt;/em&gt; waves (harmonics). We can consider $sin$ and $cos$ as the basis function and they form an &lt;em&gt;orthogonal&lt;/em&gt; basis.&lt;/p&gt;</description></item><item><title>Custom std::streambuf</title><link>http://localhost/post/004-cpp-custom-streambuf/</link><pubDate>Wed, 10 Feb 2021 00:00:00 +0000</pubDate><guid>http://localhost/post/004-cpp-custom-streambuf/</guid><description>&lt;p&gt;C++ has stream classes that are useful for input and output operations on files, io devices and strings. For example, we can use &lt;code&gt;std::ostream&lt;/code&gt; to output to &lt;code&gt;std::stringstream&lt;/code&gt;. However, there&amp;rsquo;s no built-in way to pre-allocate output buffer of &lt;code&gt;std::stringstream&lt;/code&gt; which means there might be multiple allocations call as we output more bytes to the stream. Luckily, stream exposes the buffer that we can inherit and override some of the methods.&lt;/p&gt;</description></item><item><title>Ubuntu 20.04 LTS Tips</title><link>http://localhost/post/003-ubuntu-tips/</link><pubDate>Mon, 30 Nov 2020 00:00:00 +0000</pubDate><guid>http://localhost/post/003-ubuntu-tips/</guid><description>&lt;p&gt;I have started using Ubuntu 20.04 LTS on my Surface Pro 3. Simple story is that I got fed up with the usual Windows issues (Windows update, background processes causing slowdown, etc) and decided to try Linux (&lt;em&gt;I am still using Windows 10 on my desktop PC though&lt;/em&gt;).&lt;/p&gt;</description></item><item><title>Git cheat sheet</title><link>http://localhost/post/002-git-cheat-sheet/</link><pubDate>Mon, 23 Nov 2020 00:00:00 +0000</pubDate><guid>http://localhost/post/002-git-cheat-sheet/</guid><description>&lt;p&gt;git has become industry standard for version control system so if you are software developer, there&amp;rsquo;s no way to escape git. I&amp;rsquo;ve been using git for about a year for now and have developed my own workflow. My core philosophy is to make sure the commits are as linear as possible, this basically means I&amp;rsquo;m using &lt;em&gt;rebase&lt;/em&gt; as much as I can. In addition, I use git mostly via command line and only use gui for browsing. This allows me to be as cross platform as possible.&lt;/p&gt;</description></item><item><title>Useful C++ Code Snippets</title><link>http://localhost/post/001-cpp-useful-code-snippets/</link><pubDate>Fri, 30 Oct 2020 00:00:00 +0000</pubDate><guid>http://localhost/post/001-cpp-useful-code-snippets/</guid><description>&lt;p&gt;Some useful C++ code snippets that I find useful from time to time.&lt;/p&gt;&#10;&#10;&lt;h3 class="relative group"&gt;Simple Profiling&#10; &lt;div id="simple-profiling" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#simple-profiling" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;If you want to get statistical confidence, just use google benchmark &lt;a href="https://github.com/google/benchmark" target="_blank" rel="noreferrer"&gt;https://github.com/google/benchmark&lt;/a&gt;. Otherwise, simple profiling can be done with chrono:&lt;/p&gt;</description></item><item><title>Hello World!</title><link>http://localhost/post/000-hello-world/</link><pubDate>Thu, 29 Oct 2020 00:00:00 +0000</pubDate><guid>http://localhost/post/000-hello-world/</guid><description>&lt;p&gt;Hello world! This is my brand new blog powered by Hugo, Github and Firebase. I decided to start fresh and delete the old content. I hope things will be much easier going forward and that will encourage me to post more things.&lt;/p&gt;</description></item><item><title/><link>http://localhost/post/014-content-management-system/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://localhost/post/014-content-management-system/</guid><description>&lt;p&gt;There are three different things here.&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Filesystem&#10;&lt;ul&gt;&#10;&lt;li&gt;has mounts&lt;/li&gt;&#10;&lt;li&gt;metadata&lt;/li&gt;&#10;&lt;li&gt;last modified time&lt;/li&gt;&#10;&lt;li&gt;file content&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Asset&#10;&lt;ul&gt;&#10;&lt;li&gt;can import from file system &amp;ndash; has a cost&lt;/li&gt;&#10;&lt;li&gt;imported asset has identity (asset uri), has unique content (file content hash &amp;ndash; auto dedup)&lt;/li&gt;&#10;&lt;li&gt;can have metadata &amp;ndash; knows the asset type&lt;/li&gt;&#10;&lt;li&gt;asset manager &amp;ndash; doesn&amp;rsquo;t cache, loads all metadata&lt;/li&gt;&#10;&lt;li&gt;can build composite asset &amp;ndash; (because its asset it has all the above properties)&lt;/li&gt;&#10;&lt;li&gt;can write to filesystem&lt;/li&gt;&#10;&lt;li&gt;replication&lt;/li&gt;&#10;&lt;li&gt;permission&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Resource &amp;ndash; in memory, used for game&#10;&lt;ul&gt;&#10;&lt;li&gt;static resource &amp;ndash; created procedurally, created from asset (can be reloaded)&lt;/li&gt;&#10;&lt;li&gt;dynamic resource &amp;ndash; updated&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;</description></item></channel></rss>