Author Archives: Amol

Zigzag Decoding and SIMD

I went through an article today, about Zigzag decoding. It was interesting, I grasped some information on SIMD, AVX-12, SSE, FPU, GPU, etc. There are instructions that operate on multiple data at a time. From the context, it looks like it is related to graphics programming.

Single Instruction Multiple Data operates on multiple data at a time. This seems important in the processing of graphics. It must be a common problem in graphics rendering. In particular, ray tracing. Ray tracing is a method used in computer graphics to render a 3D world to a 2D screen. SIMD, or AVX-12 seems to aid this, by processing multiple data points at once. This is important in computer graphics, where speed is important, or, critical, for no one likes to see a slow view of movement all the time.

There are instructions specialized for SIMD. The operations commonly performed may be ‘and’, ‘xor’, etc. It seems that, it may be an optimization to process unsigned numbers in processors. Hence, the Zigzag encoding and decoding, to convert signed integers to unsigned one’s and vice-versa.

How it works from programming point of view can be seen. There will be a graphics library and headers and other code, the library can be used, by using the headers, the linker will do the job of providing the low level code. OpenGL might be an example of such a library.

Greedy Design

A greedy algorithm is a problem-solving paradigm that builds a solution step-by-step, making the locally optimal choice at each point with the hope of finding a globally optimal solution.

The problem must possess the following two properties.

Greedy Choice Property: A global optimum can be reached by making local greedy choices.

Optimal Substructure: An optimal solution to the entire problem contains optimal solutions to its smaller subproblems.

Step by step architecture.

Candidate Set: A collection of all available components from which a solution is created.

Selection Function: Chooses the absolute best candidate available at the current moment.

Feasibility Function: Checks if a candidate can legally contribute to the solution without breaking constraints.

Objective Function: Assigns a value or score to a partial solution to maximize or minimize a goal.

Solution Set: Tracks candidates that have been accepted into the final configuration.

Classic applications.

Dijkstra’s Algorithm: Finds the shortest path in a graph by continually visiting the nearest unvisited node.

Kruskal’s & Prim’s Algorithms: Computes Minimum Spanning Trees (MST) by greedily picking the edges with the lowest weight.

Huffman Coding: Compress data optimally by pairing the least frequent characters first.

Fractional Knapsack: Maximizes item value inside a weight capacity by sorting items by their value-to-weight ratio.

Activity Selection: Schedules the maximum number of non-overlapping tasks by prioritizing the ones that finish earliest.

Shaders and Computer Graphics

I recently came across the concept of shaders. I remember the concepts related to them, from the subject of Computer Graphics, in college. The subject is interesting, it has some connection to the world of games.

Upon searching the Internet, I found some information related to the shaders. The implementation part of shaders seems have multiple concepts related to the shaders, vertex shaders, geometry shaders, fragment shaders and compute shaders. This must be the worldly, or, engine/software part of the concept of shaders.

Any concept seems to have 3 parts, theory, or academic part, library, or real world helper part, and, engine/software part, or, real world application part. The shaders have these 3 parts, theory, library and engine. The theory can be found in the book written by Hearn and Baker, the libraries are OpenGL, DirectX and Metal, and, the engines/software are Unity, Godot, CAD applications, etc.

The concept of ray tracing also comes to the mind.

The ray tracing, from theory and observation can be described as follows. For rendering a scene from the 3D world, that is, from a 3D space to a 2D (screen) space, we need ray tracing. A camera may be involved, a camera must be the source of lines to be followed in order to render 3D into 2D. Such lines can be used to resolve 3D co-ordinates into 2D screen. Logic here may be, to trace all the 3D objects that intersect this camera line, and, choose a point closest to the camera for rendering into 2D screen. Of course, other factors may be involved, apart from just 3D co-ordinates, like, light, darkness, etc. Light source and darkness source calculations can be performed, to render a 3D scene onto a 2D screen.

Force, Velocity and Gravitational Force

Force is ‘mass multiplied by acceleration’. Velocity is speed at a given point. Gravitational force is a ‘product of G, mass 1 and mass 2, divided by r squared’, where G is the universal gravitational constant and r is the distance between the objects.

First Post

This is the study blog site of Amol.

Hello World!

Welcome to WordPress! This is your first post. Edit or delete it to take the first step in your blogging journey.