<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by anurubha_ on Medium]]></title>
        <description><![CDATA[Stories by anurubha_ on Medium]]></description>
        <link>https://medium.com/@anurubha1998?source=rss-d0dcd060fab7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by anurubha_ on Medium</title>
            <link>https://medium.com/@anurubha1998?source=rss-d0dcd060fab7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:54:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anurubha1998/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Keep Calm and Tackle Vulkan]]></title>
            <link>https://medium.com/@anurubha1998/keep-calm-and-tackle-vulkan-4e05bc67b427?source=rss-d0dcd060fab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e05bc67b427</guid>
            <category><![CDATA[computer-graphics]]></category>
            <category><![CDATA[high-performance-graphics]]></category>
            <category><![CDATA[vulkan]]></category>
            <category><![CDATA[graphics-programming]]></category>
            <dc:creator><![CDATA[anurubha_]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 19:09:50 GMT</pubDate>
            <atom:updated>2026-03-08T19:09:50.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l305dMNJbYfcnrQDcmRxqQ.jpeg" /></figure><p>Most people starting out with Vulkan would have looked up the code to render a triangle. You expect something short and simple. What you get instead is lines and lines of code that seem to go on forever. It’s exactly at this moment that you need to keep calm and keep going.</p><p>Yes, getting a triangle on screen can feel exhausting and really test your patience. But if you push past that initial friction, you begin to realise that this complexity comes from clarity rather than chaos.</p><p>So what exactly makes Vulkan different, and why does it matter?</p><h4><strong>What Is Vulkan?</strong></h4><p><em>Vulkan is a low-level programming interface designed for graphics and compute devices.</em></p><p>While it is most commonly associated with graphics processing units (GPUs), Vulkan is not limited to traditional graphics pipelines. It can also be implemented on other compute-capable devices, such as digital signal processors (DSPs) and specialized accelerators. Regardless, a Vulkan device is <em>built for massive parallelism</em>, typically combining a multithreaded processor with fixed-function hardware blocks that accelerate common graphics and compute operations.</p><p>One of Vulkan’s defining characteristics is that it is an <em>explicit API</em>. In older APIs like OpenGL, the drivers would do a lot of work behind the scenes like tracking the state of objects, synchronization, memory management and error checks while the application was running. This made development easier, but it also meant that even stable, well-tested applications paid a constant CPU cost for that hidden bookkeeping.</p><p>Vulkan takes a different approach. Here almost everything is the developer’s responsibility. Memory allocation, synchronization, resource lifetimes and pipeline state must all be managed explicitly.</p><p>Further, Vulkan also provides a mechanism called <strong>layers</strong>, that can intercept API calls to provide functionality such as validation, debugging, logging, and profiling. A very widely used layer is the Validation layer for correctness checks, which can be enabled during development and removed entirely from the execution path in release builds. This means that when your application is running normally, the driver does only what is absolutely necessary.</p><p>Of course, this makes Vulkan extremely verbose and somewhat fragile. It demands discipline, planning, and a solid understanding of GPU architecture. But for developers who care about performance, especially in game engines, real-time rendering, and high-end visual effects, this trade-off is often worth it.</p><p>In short: Vulkan trades convenience for performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HKLCwXtZcIqcwba_Ra2RxQ.jpeg" /></figure><h4>The Anatomy of Vulkan</h4><p>Now that you have a sense of why Vulkan looks intimidating at first glance, let’s take a look at the pieces that make it work.</p><p>Like I mentioned earlier, Vulkan is not just about graphics. A Vulkan device can support multiple categories of operations. The graphics category includes functionalities like rasterization, primitive assembly, blending, depth and stencil tests, etc. Then, it has the compute category, which allows shaders to run general-purpose compute workloads. This is useful for tasks like simulations, image processing, or anything else that benefits from massive parallelism. And finally, the transfer category, which is used for copying data around.</p><p>Importantly, the support for these categories is optional. It is entirely possible to have a Vulkan device that does not support graphics at all.</p><p>Because of this, working with Vulkan means explicitly choosing what functionality your application requires and making sure that the underlying hardware can actually support it. This is precisely what happens during Vulkan’s initial setup phase.</p><p>Vulkan introduces a hierarchy of objects that need to be configured step-by-step during the setup phase and through this you are essentially deciding what your application needs from the hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*xC0YxglVVXQBg87X32PRpg.png" /><figcaption>Hierarchy of Functionality</figcaption></figure><p><strong>Instance</strong></p><p>The very first object you create in Vulkan is the <strong>instance</strong>, represented as <em>VkInstance</em>.</p><p>Unlike older APIs, Vulkan does not introduce implicit global state into your application. Instead, everything begins with a <em>VkInstance</em>, which acts as a software-level container for your Vulkan usage. It keeps your application’s Vulkan state isolated from other applications and libraries that may also be using Vulkan at the same time.</p><p>Creating the instance simply establishes context. It tells Vulkan who you are, what extensions or layers you want to use, and how the rest of the system should interpret your requests going forward.</p><p>As mentioned earlier, this decision also includes enabling validation, which I strongly recommend, unless you enjoy debugging blank screens at 3 a.m. To enable validation, we need to load the layer <em>VK_LAYER_KHRONOS_validation</em>, enable the extension <em>VK_EXT_debug_utils</em> and then use functions from the extension to configure our application to receive validation messages. In practice, validation is almost always enabled only in debug builds of the program and disabled in release builds.</p><p><strong>Physical Device</strong></p><p>A physical device represented as <em>VkPhysicalDevice</em>, corresponds an actual Vulkan-compatible hardware available on the system.</p><p>These devices can have different supported features, memory layouts, and queue families. Based on what your application needs, you then select the physical device that is best suited for the job. Again, this decision is entirely in the hands of the developer. Vulkan does not rank devices or choose one for you. You are expected to evaluate what matters most for your use case, whether that is specific features, performance characteristics, or memory capacity.</p><p><strong>Logical Devices</strong></p><p>A logical device, <em>VkDevice</em>, is the software construct around a physical device and represents a reservation of resources associated with a particular physical device. This includes a possible subset of the available queues on the physical device. Anything that is not explicitly enabled at this stage is simply unavailable later. It is technically possible to create multiple logical devices from a single physical device, each with its own set of enabled features and queues.</p><p><strong>Queues</strong></p><p>Once a logical device is created, Vulkan finally gives you a way to submit work to the GPU: queues represented as <em>VkQueue</em>.</p><p>Queues are the mechanism through which your application sends commands for execution. Every logical device exposes one or more queues, and each of those queues belongs to a specific <em>queue family</em>. A queue family represents a group of queues that share the same capabilities such as<em> graphics, compute, or transfer</em> and are able to process work in parallel. The number of queue families available, the capabilities of each family, and the number of queues within each family are all properties of the physical device.</p><p>And yeah, with that, you have created the instance, chosen a physical device, set up a logical device, and grabbed the queues you need. Vulkan now knows what hardware you want to use and how you intend to use it.</p><p>In the next part, we will finally start putting this setup to work and explore how Vulkan actually draws things on the screen, starting with <strong>render passes</strong> and the <strong>graphics pipeline</strong>.</p><p>Until next time, keep calm and keep exploring Vulkan.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e05bc67b427" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quaternions]]></title>
            <link>https://medium.com/@anurubha1998/quaternions-d0d45e730182?source=rss-d0dcd060fab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0d45e730182</guid>
            <dc:creator><![CDATA[anurubha_]]></dc:creator>
            <pubDate>Tue, 03 Jun 2025 11:02:32 GMT</pubDate>
            <atom:updated>2025-06-03T11:04:37.920Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Animating smarter, Not Harder</strong></p><p><strong>Quaternions have a reputation! </strong>From the moment they were introduced to this day, they’ve been described as confusing, unintuitive, and even <em>evil</em>. Yet, quaternions stood the test of time and turned out to be an incredibly useful tool.</p><p>Mathematically, quaternions are fascinating for so many reasons. But in computer graphics, they provide an elegant and efficient way to describe and compute 3D rotations. Now, this might not sound particularly exciting at first, but the truth is, while rotations in 3D feel natural in everyday life, representing them mathematically is another story.</p><p>If you want to rotate something in 3D, you have a few options. The first tool in the box is <strong>rotation matrices</strong>. They get the job done and stack well when you combine them, but they’re kind of a memory hog. They take up nine floating-point numbers (36 bytes), even though we really only need three numbers (12 bytes) to describe a unique rotation.</p><p>Then there are<strong> Euler angles</strong>, which seem simple — just three numbers representing rotations around the X, Y, and Z axes. But they come with a drawback — gimbal lock. Since Euler angles apply rotations one axis at a time (first X, then Y, then Z, or in another predefined order), certain rotations can cause two axes to align, effectively locking one degree of freedom. This makes some movements impossible or unpredictable, which is a nightmare for animations and physics simulations.</p><p>So, matrices are bulky and a maybe a bit hard to interpret, while Euler angles are unpredictable and prone to disaster. This is where quaternions come to the rescue. Despite their reputation for being abstract and strange, quaternions are actually compact (only four numbers), efficient, and free from gimbal lock. They also allow for smooth blending between rotations, which makes them perfect for animation and real-time graphics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wGLJT7mIgRmRRwUO6O1iZQ.jpeg" /></figure><p><strong>What are Quaternions?</strong></p><p>Quaternions, invented by <em>William Hamilton</em> in 1843, are technically <strong>four-dimensional complex numbers</strong>. But unless you’re deep into maths, that description wouldn’t help you much. So instead, let’s keep it simple for now:<strong> a quaternion represents a rotation in 3D space using four values</strong> — (x, y, z, w). The vector (x, y, z) defines the axis of rotation, while w determines how much to rotate around that axis.</p><p>However, if you are already familiar with the Complex Number System, you will start noticing some parallels between the two as you read on.</p><p>The quaternion form for a rotation by θ around an axis (ax, ay, az) is</p><blockquote><strong>q = (ax*sin⁡(θ/2), ay*sin⁡(θ/2), az*sin⁡(θ/2), cos⁡(θ/2))</strong></blockquote><p>For example, 180° (π radians) rotation around y axis: q = (0, sin⁡(π/2), 0, cos⁡(π/2)) = (0,1,0,0).</p><p>Similarly, a 180° rotation around the x-axis would be: q=(1,0,0,0).</p><p>And for a 180° rotation around the z-axis: q=(0,0,1,0).</p><p>Now the obvious question would be, what happens when <strong>w = 1</strong>, like in q = (0,0,0,1)?</p><p>Well, since w = cos(0/2) = 1, this corresponds to a rotation of 0° — meaning no rotation at all. And this is called an <strong>Identity quaternion</strong>. Just like how multiplying by 1 doesn’t change a number, applying the identity quaternion leaves an object’s orientation unchanged.</p><p>When it comes to rotations, <strong>Unit quaternions</strong> are the key players. A unit quaternion is a quaternion with a magnitude of 1:</p><p><em>∥q∥ = sqrt (x2 + y2 + z2 + w2) = 1</em></p><p>This is important because only <strong>unit quaternions represent pure rotations</strong>. If a quaternion’s magnitude is greater or less than 1, it introduces scaling, which distorts objects rather than simply rotating them. To ensure we preserve pure rotation, we should normalize quaternions before applying it to our model.</p><p>If a <strong>unit quaternion has one of the axis components equals w</strong>, then the quaternion represents a <strong>90°</strong> rotation (π/2 radians) around that axis. For example, q = (0, 0, 0.7, 0.7) gives a 90° rotation around the z axis.</p><p>Now, I guess you got an idea on how quaternions represent simple rotations. But in graphics we would need rotations that are more complex than these. This is where quaternion arithmetic comes in, allowing us to compose, interpolate, and blend rotations in ways that are both efficient and elegant. Let’s see how these operations work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*7pQUKNi-ZTEbvl-6s5EOXg.gif" /></figure><p><strong>Quaternion Multiplication = Rotation Composition</strong></p><p>When you multiply two quaternions, you are essentially applying one rotation after another.</p><blockquote>q = q2q1​</blockquote><p>This means if you rotate an object using q1​ first and then apply q2​, the final transformation is the multiplication q2q1​.</p><p><em>NOTE</em>: <em>quaternion multiplication is NOT Commutative — changing the order gives a different result!</em></p><p>pq ≠ qp</p><p>This shouldn’t be surprising as 3D rotations don’t commute either, i.e., the result of applying two rotations depends on the order of rotations.</p><p><strong>Adding Quaternions ≈ Averaging Rotations</strong></p><p>Adding quaternions can be thought of as blending rotations, much like mixing colours. When you mix two colours, you get a shade that is somewhere between them. Similarly, when you add two quaternions, you get a rotation that lies between the two original orientations.</p><p>For example, if we add q1=(1,0,0,0) and q2=(0,0,1,0), we get a quaternion that still gives a 180 rotation, but around an axis that is directly in between the x and z axes.</p><p>However, just like mixing one cup of red with one cup of blue would give you 2 cups of purple, adding two unit quaternions produces a quaternion with a larger magnitude. This means the sum no longer represents a pure rotation and should be normalized to avoid unwanted distortion.</p><p>Also, the amount of each quaternion in the sum affects the result. If you mix equal parts red and blue, you get a balanced purple. But if you add more blue, the resulting colour leans toward blue. This means that quaternion addition can be weighted, i.e., more influence from one quaternion shifts the result toward that rotation.</p><p><strong>Interpolating Quaternions</strong></p><p>Now what if we need to smoothly transition from one rotation to another over time? This is where interpolation comes in. Depending on what you need it for, there are two ways to interpolate between quaternions. One method is simple and fast while the other is more complex but produces more accurate results.</p><p>The simple way to do this is <strong>Linear Interpolation (LERP)</strong>, which works much like blending colours. Given two quaternions, q1 and q2​, we can mix them based on a factor t (where t is between 0 and 1)</p><blockquote><strong>qlerp = (1−t)q1 + tq2</strong></blockquote><p>This means at t=0, we are fully at q1​, at t=1, we are at q2, and in between, we get a gradual blend.</p><p>However, this method has a drawback: a quaternion is a point on a hypersphere (4D sphere), but LERP moves in a straight line through 4D space, not along the sphere. This can cause uneven rotation speeds, which may not look natural.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*w-aQH42Cnf-zDG9n8cBU4A.png" /><figcaption>Figure 1: LERP and SLERP visualisation</figcaption></figure><p>A better approach is <strong>Spherical Linear Interpolation (SLERP)</strong>. Instead of cutting through the hypersphere, SLERP moves along the surface of the hypersphere, yielding a smoother and more natural transition. The formula for SLERP is:</p><blockquote><strong>qslerp = (sin⁡((1−t) θ) / sin⁡θ) q1 + (sin⁡(tθ) / sin⁡θ)q2 ​</strong></blockquote><p>where θ is the angle between q1 and q2.</p><p>For a more intuitive visualization, think of a point on a regular sphere (like in <em>Figure 1</em>). To move between two points on the sphere, you could take a straight line through the inside of the sphere (LERP) or you could follow the curved surface of the sphere between the two points(SLERP).</p><p>LERP is simple, fast, and works fine for less dramatic changes in rotations or cases where performance is critical. But when you are getting closer to a 180 degree change in rotation LERP may start looking incorrect and SLERP might be the better choice for a smoother, more accurate transition.</p><p><strong>Bit of Maths</strong></p><p>Now that we have some idea about how quaternions work, let me tell you a bit of the mathematics behind quaternions before you go.</p><p><strong>The root of quaternions is based on the concept of the complex number system. </strong>The Complex Number system extends real numbers by introducing an <strong>imaginary unit </strong>𝑖, where</p><blockquote><strong>𝑖2 = -1</strong></blockquote><p>Unlike real numbers which exist on a one-dimensional number line, complex numbers exist in a two-dimensional plane, called the complex plane. Here, real numbers lie on the x-axis, while multiples of 𝑖 extend along the y-axis.</p><p>A complex number is written as:</p><blockquote><strong>z = a + b</strong>𝑖<strong>, </strong>a,b ∈ R</blockquote><p>Here, a is the real part and b𝑖 is the imaginary part of the complex number.</p><p>But here’s where things get interesting — complex numbers provide a natural way to represent 2D rotations since every position in the 2D space can be represented using the numbers in the complex plane. Further, we can rotate a point in the 2D space by multiplying it by a unit complex number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WdjYjOux2hCnavg5xWkX7A.png" /><figcaption>Figure 2: Complex Plane</figcaption></figure><p>In polar form, a complex number can be written as</p><blockquote><strong>z = r cosθ + </strong>𝑖<strong> r sinθ</strong></blockquote><blockquote><strong>= r (cosθ + </strong>𝑖 <strong>sinθ)</strong></blockquote><p>where r is the magnitude and θ is the angle from the positive x axis.</p><p>Now, a point (x, y) in the Cartesian plane can be represented using the complex number x + y𝑖. Multiplying two numbers would give us:</p><blockquote>z1z2 = (r1 cosθ1 + 𝑖 r1 sinθ1) (r2 cosθ2 + 𝑖 r2sinθ2​)</blockquote><blockquote>= r 1 ​ r 2 ​ [(cosθ1 ​ cosθ2 ​ −sinθ1 sinθ2 ​ )+i(sinθ1 ​ cosθ2 +cosθ1 sinθ2 ​ )]</blockquote><blockquote>= r 1 ​ r 2 ​ [cos(θ1 +θ2 ​ ) + i sin(θ1 +θ2)]</blockquote><p>This means that on multiplication, the length of the result is just the product of the original lengths (r 1​r 2 ) the new angle is the sum of the original angles (θ1 +θ2​). So, instead of just scaling like real numbers, complex multiplication acts like a spin-and-stretch operation. If you multiply by a unit-length complex number, you get pure rotation with no stretching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsmYmAWSmyH-ZWkZE7mhfA.jpeg" /></figure><p>Now you can see how all these correspond to the properties of quaternions we were talking about earlier. <strong>Quaternions are a four-dimensional extension of complex numbers</strong>, introducing three imaginary units: <strong>i, j, k</strong>.</p><p>Mathematically, a quaternion is expressed as:</p><blockquote><strong><em>q = s + xi + yj+ zk ,</em></strong></blockquote><p>where the imaginary units satisfy Hamilton’s rules:</p><blockquote><strong><em>i2 = j2 = k2 = ijk = -1</em></strong></blockquote><p>and follow non-commutative multiplication rules:</p><blockquote><strong><em>ij=k, ji = −k</em></strong></blockquote><blockquote><strong><em>jk=i, kj= −i</em></strong></blockquote><blockquote><strong><em>ki=j, ik= −j</em></strong></blockquote><p>Now, if these look familiar, that’s because they resemble the cross product of unit vectors in 3D space. Hence, i, j, k could be interpreted as the basis vectors of 3D space, with multiplication rules that naturally encode rotational behaviour.</p><p>To represent our three-dimensional world in this four-dimensional system, we use a subset of quaternions known as <strong>pure imaginary quaternions</strong>. A point (x, y, z) in space can be written as the quaternion p = ix + jy + kz, where the real part is zero. These pure imaginary quaternions naturally form a 3D subspace within the larger quaternion framework, giving us a clean way to represent positions and directions in space while still leveraging the power of quaternion math.</p><p>Now what is tricky here is, we have to ensure that rotations stay within this 3D sub-space. Simply multiplying a pure imaginary quaternion by a unit quaternion doesn’t necessarily result in another pure imaginary quaternion. If the result has a nonzero real part, it would no longer belong to the 3D subspace, effectively causing the point to “vanish” from our 3D world.</p><p>So instead of just multiplying a quaternion with a point, we use something called conjugation, which means applying the transformation <strong>qpq−1</strong> (where q−1 is the inverse of q). If p is pure imaginary, then it turns out qpq-1 is also pure imaginary and represents a rotated version of p.</p><p>One thing to note is that, for every rotation, there are actually two possible quaternion representations. We will see that q and -q perform the same rotation. The algebra shows that flipping the sign of q doesn’t affect the rotation as they cancel out during conjugation, which leads to a cool property called double cover. Basically, this means every rotation has two ways of being expressed in quaternion form. This might feel like redundancy, but this property is why quaternions avoid the gimbal lock that messes with rotations in other systems.</p><p>And with that, let me wrap up this introduction to quaternions for now! Not so intimidating after all, right? Just a clever way to handle rotations with some cool mathematical properties.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0d45e730182" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking FABRIK for Inverse Kinematics]]></title>
            <link>https://medium.com/@anurubha1998/unlocking-fabrik-for-inverse-kinematics-fd4e6b223038?source=rss-d0dcd060fab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd4e6b223038</guid>
            <category><![CDATA[inverse-kinematics]]></category>
            <category><![CDATA[fabrik]]></category>
            <category><![CDATA[procedural-animation]]></category>
            <category><![CDATA[graphics-programming]]></category>
            <dc:creator><![CDATA[anurubha_]]></dc:creator>
            <pubDate>Tue, 03 Jun 2025 10:45:17 GMT</pubDate>
            <atom:updated>2025-06-03T10:45:17.811Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Animating smarter, Not Harder</strong></p><p>Inspired by the procedural animation in Rain World, I took to exploring this fascinating technique, where not everything is pre-animated, but instead calculated in real-time to respond with genuine physical reactions. What stood out to me in Rain World was how its animation system brought creatures to life by creating movements that felt organic. Here, each creature exhibits an almost life-like dynamism; their wings flap, bodies wriggle, and the animation seems to breathe life.</p><p>In an attempt to recreate the movements of the creatures in Rain World, I took to Inverse Kinematics and here is what I have.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXgaZp0DS98g%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXgaZp0DS98g&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXgaZp0DS98g%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/953596628c9104dfce605f31b67efd48/href">https://medium.com/media/953596628c9104dfce605f31b67efd48/href</a></iframe><p><strong>Inverse Kinematics</strong></p><p>As with animating human figures, in animation, we often find objects that are linked together in such a way that their movements are interconnected. In a simple animation, a number of keyframes that describe the position of the various parts of the linked object are interpolated to create the animation. However, this requires the animator to provide the position of each joint for all the keyframes and can easily be a tedious process to create an animation that looks natural. Here’s where Inverse Kinematics shines. It allows a user to simulate the motion of a linked system without having to manually control each of them. Inverse Kinematics(IK) is an animation technique that answers the question: given a desired end position, how should all parts of a linked figure move to reach this position?</p><p>IK simplifies and enhances animations by computing how a series of joints should adjust to position the end-effector exactly where intended, in real-time. While there are analytical and numerical methods to solve an IK, I chose to dive into a heuristic algorithm called FABRIK. FABRIK is computationally simple and intuitive, and yet creates animations that feel natural and realistic.</p><p><strong>FABRIK (Forward And Backward Reaching Inverse Kinematics)</strong></p><p>A simple explanation of the basic FABRIK algorithm, given a linked system / chain with a fixed root and no constraints in movement and a target position, is as follows:</p><blockquote><strong>Step 1. Reachability Check</strong>:</blockquote><blockquote>Start by checking if the target is reachable by the chain. For this, calculate the total length of the chain and check if the distance between the root joint and the target is less than this total length. If not, the target is unreachable; so move the chain such that it forms a straight line in the direction of the target, as if it is trying to reach the target. If the target is reachable, go to step 2.</blockquote><blockquote><strong>Step 2. Forward Adjustment:</strong></blockquote><blockquote>Here, we move the end-effector towards the target, with the connected joints following it (move from end-effector towards root). Begin by placing the end effector on the target. Then, for each joint, calculate the new position such that it lies on the line connecting it to the newly adjusted joint, maintaining its fixed distance from that joint.</blockquote><blockquote><strong>Step 3. Backward Adjustment:</strong></blockquote><blockquote>Now, since the root is fixed, we need make sure that the position of the root is same as it’s initial position. So the same procedure as forward adjustment is repeated, but now from the root towards the end effector, starting by placing the root at it’s initial position. This completes an iteration of the algorithm and if the end effector’s current position is within the tolerance distance of the target, you’ve found a good solution; stop the algorithm. If not, repeat from step 2 (Forward Adjustment) until convergence criteria are met.</blockquote><p>The beauty of FABRIK lies in its simplicity and the ability to handle complex movements with fewer computations. The blend of efficiency, accuracy, and ease of implementation, makes this algorithm an ideal choice for real-time applications where speed and natural movements are important.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd4e6b223038" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>