Rhythms Of Pride – Painting

On April 29, 2012 in Paintings | 1 Comment

A painting done long time back, to be used as the cover picture of one of my music tracks,

You may listen to the music track “here”

Share

If music be the food of love, play on

On August 8, 2011 in Paintings | 1 Comment

 

Share

Music Box

On April 5, 2013 in Music | 2 Comments

Share

Backface Culling

On February 2, 2013 in 3D Graphics | No comments

It is a test using which we can avoid drawing some faces of the geometry which the user not likely to see, thus improving the performance of rendering.  Using this test, the renderer module can efficiently skip the faces while drawing, using the following way.

We can imagine that every polygon has two sides.  We need to draw the polygon only if it is facing the viewer, and we just skip drawing the polygons which are not facing the user.  To determine whether a polygon is facing the user or not, just calculate the polygon’s Normal vector and calculate the angle between the viewer’s view direction and the normal vector.

geom_with_normals

In the above figure, the blue lines represent the normal corresponding to each of those planes.  you can see there are normals facing away from the viewer.

Share

Triangle Rasterization

On January 28, 2013 in 3D Graphics | No comments

This functionality is the heart of any 3D APIs such as Direct3D or OpenGL.

It addresses the problem, how fast you can render a triangle?

in 3D graphics, all the geometry entities are composed of polygons, where a single polygon can be represented by the help of one or more triangles.

3dCube

In general, any complex geometry can be divided into a number of triangles and we can solve them individually. Thus, to draw a geometry, we have to provide these 3D APIs with a collection of polygons or triangles. And they’ll draw the triangles on the screen using their version of Triangle Rasterization function.

Share

3D Projection using lens formula

On January 25, 2013 in 3D Graphics | No comments

This is how I re-invented the wheel :)

This is an alternate approach to do projection in computer graphics using a lens formula. As it is a technique which is derived from lens formula, the focal length of the lens is the major parameter. The traditional projection techniques uses the ‘field of view’ value – which is an angle expressed in degrees or radians.

Anyways, if you are a person who didn’t even experienced the 3D graphics programming, you may ask these following questions to yourself before you get started.

1. How to draw 3D objects on a 2D Plane?

2. How can we plot a 3D vertex(x, y, z) into a 2D plane which has only 2 axes.

I asked this questions to myself long time back before attending some 3D graphics lessons. As a result, after some days of deep thought, I landed up with an idea to go through my Physics book. I flipped through the pages and stopped at the chapter Ray Optics. Finally, after some days, I ended up with some clues to solve the above problems. The final outcome of this was an equation by which we can accomplish projection. Later when I covered computer graphics I came to know that this is called the “Projection” operation in 3D Graphics. Yeah. The moment I came to know that I re-invented the wheel.

Here we start,

\frac{1}{v} - \frac{1}{u} = \frac{1}{f}

Share

Junaid Hassan

On July 22, 2012 in Sketches | No comments

Junaid Hassan – Sketch of a character from the story – Noritia Valley.

Share

Time Duration of a wave file

On July 7, 2012 in TechSpace | No comments

Calculating time from a wave file is a simple and a straight forward process. Here goes the trick.

Step 1: Open the wave file and read the wave format block (Described by the WaveFormat structure in the code snippet below)

Step 2: Read the data chunk size.

Step 3: Duration of the wave file in seconds = data chunk size / (WaveFormat.nAvgBytesPerSec * 60.00f)

#include <stdio.h>

typedef unsigned short WORD;
typedef unsigned long DWORD;

// it defines a chunk in the wave file, 4 bytes to store chunk id, another 4 bytes for the chunk's size
 typedef struct SChunk
 {
     union
     {
         long lChunkId;
         char chId[4];
     };
     long lChunkSize;

 }CHUNK;

// wave format block
 typedef struct SWaveFormat
 {
     WORD        wFormatTag;         /* format type */
     WORD        nChannels;          /* number of channels (i.e. mono, stereo...) */
     DWORD       nSamplesPerSec;     /* sample rate */
     DWORD       nAvgBytesPerSec;    /* for buffer estimation */
     WORD        nBlockAlign;        /* block size of data */
     WORD        wBitsPerSample;     /* number of bits per sample of mono data */
                                     /* extra information (after cbSize) */
 } WaveFormat;

 void ReadWaveFileData(const char * wavefile)
 {
     CHUNK mainChunk;
     CHUNK formatChunk;
     CHUNK dataChunk;
     WaveFormat wf;
     char chFmt[4];
     FILE * fp;
     float fTime, fMins, fSecs;

     fp = fopen(wavefile, "rb");

     // read(8 bytes) the main chunk, must be a chunk with id 'RIFF'
     fread(&mainChunk, sizeof(mainChunk), 1, fp);

     // read(4 bytes) the format, must contain 'WAVE'
     fread(&chFmt, sizeof(chFmt), 1, fp);

     // read(8 bytes) the format chunk
     fread(&formatChunk, sizeof(formatChunk), 1, fp);

     // now read the wave format information such as
     // the sample rate, avarage bytes per second
     fread(&wf, sizeof(wf), 1, fp);

     // read(8 bytes) the data chunk, the id must be 'data'.
     fread(&dataChunk, sizeof(dataChunk), 1, fp);

     // Now, we can calculate the time in seconds
     fTime = dataChunk.lChunkSize / (wf.nAvgBytesPerSec * 60.00f);

     // minutes
     fMins = abs(fTime);

     // seconds
     fSecs = abs((fTime - abs(fTime)) * 60.00f);

     fclose(fp);
 }


That’s all folks. Hope it helps !!! :)

Share

Ubuntu – Unity Plugin effects are disabled

On June 4, 2012 in Troubleshooting | No comments

I lost the window shadows in Ubuntu 11.04, which is provided by the Unity Plugin. All I remember is I ran an update last night, and when I restarted I found all these Unity Plugin effects are missing. And I found a solution, a simple one,

Launch the terminal and enter the “gconf-editor” command,

ranjith@NStudio:~$ gconf-editor

Now edit the following key,

/apps/metacity/general/

check the value of key “compositing_manager” to TRUE. Now all the Unity effects should work fine. Enjoy !!!

Share

Rise of the Heavens

On May 9, 2012 in Uncategorized | No comments

Cover image for the recent music track – Rise of the Heavens

Download mp3

Share

Fixing Internal Server Error – WordPress

On March 2, 2012 in Troubleshooting | No comments

Encountered some technical problems last night while moving this website to another server with the latest version wordpress – wordpress-3.3.1. All setup perfectly, created a fresh wordpress database, created the user, successfully ran the wordpress setup and got the login screen perfectly.  But when I log in, I got the following error message instead of the wordpress admin console.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, <webmaster@domain.com> and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Finally the problem got solved in the following way,

1. Create php.ini with the following line of code

memory=20MB

2. Upload the php.ini file to the wp-admin folder of the wordpress installation.

Now access the http://domain.com/blog/wp-admin, it works fine.

Share