Thursday, March 29, 2012

vector class in c++

This is the header file for my vector class its the simplest form of a vector class in c++ and i save it as a vec3.h file

class vector3

{
/*
vector class and method defnition goes here
*/
public:

double x, y, z;

// Constructor
vector3() : x(0.0), y(0.0),z(0.0){};
vector3(double a_x,double a_y,double a_z) : x(a_x), y(a_y),z(a_z){};

// Methods
double magnitude();
double dotProduct(vector3 d_v);
vector3 crossProduct(vector3 c_v);
vector3 normalize();
vector3 add(vector3 a_v);
vector3 sub(vector3 s_v);
vector3 mult(vector3 m_v);
};

Below in the cpp file for the class

#include
#include "vec3.h"

/*
Vector class methods
*/
double vector3::magnitude()
{
return (double)sqrt((x * x) + (y * y) + (z * z));
}

double vector3::dotProduct(vector3 d_v)
{
return (x * d_v.x + y * d_v.y + z * d_v.z);
}

vector3 vector3::crossProduct(vector3 c_v)
{
return vector3((y * c_v.z) - (z * c_v.y), (z * c_v.x) - (x * c_v.z), (x * c_v.y) - (y * c_v.x));
}

vector3 vector3::normalize()
{
double mag = (1.0 / magnitude());
double i = x * mag;
double j = y * mag;
double k = z * mag;
return vector3(i,j,k);
}

vector3 vector3::add(vector3 a_v)
{
return vector3(x+a_v.x, y+a_v.y, z+a_v.z);
}

vector3 vector3::sub(vector3 s_v)
{
return vector3(x-s_v.x,y-s_v.y,z-s_v.z);
}

vector3 vector3::mult(vector3 m_v)
{
return vector3 (x*m_v.x,y*m_v.y,z*m_v.z);
}

Friday, March 23, 2012

What is a Ray ?

To talk about ray let me first talk about a line, a line is a parametric equation based on a point and a vector. It will have a point P which is the point @ which line starts and a direction V which is a vector as shown in image.


A point on line can be represented as where t is a scalar

Point(t) = P + t * V


Varying t will give you points on the line, Now let’s see what is the difference between a line and a Ray, a line extends to both direction whereas a Ray has a origin and one direction @ which it travels. Also for a ray t must be a non-negative value.

Thursday, March 15, 2012

What is a Ray tracer?

Before I go to raytracing let me just talk about some basic physics known as optics, which on the fundamental level says we see objects when light bounces of the object surfaces or object themselves produce light and reaches our eyes

Ray tracing is a technique for generating an image by tracing the path of light through pixels in an image plane and simulating the effects of its encounters with virtual objects. This technique is capable of producing hyper realistic visuals compared to regular scanline rendering methods. Ray tracing is capable of simulating a wide variety of optical effects, such as reflection and refraction, scattering, and dispersion phenomena.

The basic idea of ray tracing is to care only about the rays that hit our eyes directly or after some re-bounce, also the generated images will be grids of pixels with limited resolution.

Tuesday, January 31, 2012

Animation Blog - Megha Jois: Animation Reel 2011

Animation Blog - Megha Jois: Animation Reel 2011: Hey this is my friend's reel people
have a look @ this....

Friday, October 7, 2011

Fire Flames

Another motion study on fire flames... again maya fluids and mentalray render


Wispy Smoke

I recently spend some time on getting a wispy smoke motion and look have a look @ my video
It was done using maya fluids and rendered using mental ray


Thursday, September 1, 2011

Liquid in HOUDINI

I have been doing some test in houdini for some liquid fx so i thought i should upload some of them here
goes a very basic test i did in houdini.

It is basic particles sim just meshed no inter particle collision

This setup was done in 10 mins and took 15 mins to render