| |
| † news/blog † |
|
« | ‹ Prev |
1 2 3 4 5 6 7 8 |
Next › | »  |
| |
| Fri 08 Aug 08 - PROGAMMING - Two Methods for 3x3 matrix re-orthogonalization. |
|
Here are two methods for 3x3 matrix re-orthogonalization of a given matrix M.
Method 1: Using a correction matrix.
We are going to re-orthogonalize M by computing a correction matrix C. The C is given as:
C = ( (3 * I) - (M * T) ) / 2
where 3 and 2 are just scalars, I is the identity 3x3 and T is the transposed of M. Then O, the re-orthogonalized M, is:
O = C * M
Method 2: Gram-Schmidt orthogonalization with a twist for z_axis.
We are going to use some C++ code here. We assume that the M is in the classic format (not like opengl but the transposed). Here is the code:
vec3_t x_axis, y_axis, z_axis; // temp vectors
M.GetColumns( x_axis, y_axis, z_axis ); // get the columns of out M
x_axis.Normalize(); // self explanatory
y_axis = y_axis - ( x_axis * x_axis.Dot(y_axis) ); // the result of the big parenthesis is the projection of y_axis into x_axis
y_axis.Normalize(); // self explanatory
z_axis = Cross(x_axis, y_axis); // we compute the z_axis using cross product
M.SetColumns( x_axis, y_axis, z_axis ); // we restore M |
|
| |
| |
| Mon 07 Jul 08 - Buy Crysis Warhead, NOT pirate it |
|
Crysis Warhead is the follow up of the Crytek's great Crysis, a game released in November 2007. Crysis was one of the biggest PC exclusives of the previous year, a major success but with poor sales. It sold one unit for every 20 pirated copies!!! I mean with a number like that I can completely justify the developer's frustration about the current PC-gaming scene. Ok Crytek made a few mistakes but the issue lies with the greedy/non supportive/pirates gamers.
Crytek wants to give PC-gaming a second chance with Warhead. This time around they state that the previous issues are dissolved. Warhead will be in top of a more optimized engine, with more shooting and non linear approaches.
This time Crytek gives PC a second change, they dont need our alms, they only ask of what they deserve.
Check the official site for more info: crysis-thegame.com |
|
| |
| |
| Sun 29 Jun 08 - Mass Effect Review |
|
Bioware is well known for their quality games and Mass Effect is one of them. The events of the game take place a few hundred years from now. In the distance future, Earth is a united nation and a part of a large alliance between alien races (yes there are aliens). The aliens are inhabitants of the same galaxy as we and they are having technology and intelligence close to humans. In this futuristic world giant ships, called mass relays, work like slingshots, throwing the ships in distant systems. With this way the intergalactic travel is a reality. This interesting technology is a product of a powerful alien race suddenly disappeared 50.000 years ago. The Protheans left behind the mass relays, a giant ship called the Citadel and ruins scattered throughout the galaxy, these are the only remains and the legacy they left behind. Questions of how the Protheans disappeared, who build the mass relays initially and many more will be answered during the game. The story is really epic and one of the best I've ever encounter in game.
In Mass Effect you play Separd, a space marine with a great task, to save the universe and establish humanity among the strong players of the alliance. In this fight you are not alone, in the beginning of every mission you can chose 2 of your comrads to fight along you. Your commrads are part of your crew and the play their part in the story. Just like every RPG you will face the main quest as well as the secondaries. With the help of your ship and mass relays you can travel in distant lands to complete your quests. Unfortunately the secondary quests are not in par with the main. You can find 2 kinds of secondary quests. The first kind is when you land in a planet with your vehicle and search for ruins, or rare metals and occasionally wipe out bases or camps (...boring). The other kind happen in places of your main quest and they are more interesting but few.
Mass effect features action elements already seen in the SUPER AWESOME CRAP game called Gears of War. Mass Effect uses Unreal Engine 3 and the developers copied many elements from gears of war like the covering system. Your inventory features 5 weapons (pistol, shotgun, machine gun, sniper rifle, grenades) and biotics. Biotics is another name for the “magic spells” every RPG features. During your play you can update your weapons with mods, buy new and better ones and bla bla bla your armor too. Classic RPG stuff. Compared with Gears the combats are better because biotics give a new twist.
In this epic journey you travel different planets and areas as well as the Citadel, the giant Prothean ship inhabited by humans and aliens members of the alliance. The Citadel is an epic and beautiful place but with not all the places you visit are that good. The environments in general are not detailed enough but at least they differ from each other in both architecture and textures.
The graphics are good, great cinematics, the models are high poly with detailed textures, the game features Unreal 3 after all. But the truth is that I never liked Unreal 3. They always use tricks to avoid realistic approaches. The absence of global illumination model always bugged me and this time more than ever.
Overall the game is good build in a great story, a fairly good combat system and great production. In the other hand the game is short and the secondary missions lame. In the end Mass Effect leaves you with a sweet taste that wont last long. If you liked it you should check The Witcher witch is a far better game in every way.
Enjoy!
|
|
| |
| |
| Wed 25 Jun 08 - GLSL specular shader |
|
I've been playing with GLSL for a week now and the first think I've tried to make was a specular shader. OGL's fixed functionality produces very ugly speculars in low geometry so pixel shaders is the only solution. I've searched the net to find a spec shader but nothing was good enough and in terms of visuals and from speed's standpoint. Im not a GLSL guru but some optimizations are pretty obvious even for me. Anyway I present you a specular program witch contains a speed hack.
Shader specs are. Phong shading for one light (the GL_LIGHT0) using the material properties and combines the light result with 2 textures. The files bellow have detailed comments.
vertex shader
fragment shader
screenshot without textures
Enjoy!
|
|
| |
| |
| Mon 16 Jun 08 - Invert square root (invsqrt) in 64bit compilers/architectures |
|
Invert square root, or simply invsqrt, is a mathematical function that calculates the "1/square_root(x)" expression of a given number 'x'. The function's origin is uncertain but it believed that 3Dfx invented it many years back. After that, John Carmack used it in quake engine and when the source of the engine got published the invsqrt made its way to the masses. The awesomeness of this functions is that its really really fast, faster than computing the "1/sqrt(x)". The most common use of invsqrt is in computer graphics and especially in vector normalization. The version found in Carmack source is the following:
float InvSqrt( float f )
{
float fhalf = 0.5f*f;
int i = *(int*)&f;
i = 0x5F3759DF - (i>>1);
f = *(float*)&i;
f *= 1.5f - fhalf*f*f;
return f;
return 1/sqrtf(f);
}
...unfortunately this version uses a trick that it is relying in 32bit architecture and if someone tries to compile it in 64bit the result will be incorrect. So I sat down and replaced the sensitive code with inline assembly and here is the result:
float InvSqrt( float f )
{
float fhalf = 0.5f*f;
asm
(
"mov %1, %%eax;"
"sar %%eax;"
"mov $0x5F3759DF, %%ebx;"
"sub %%eax, %%ebx;"
"mov %%ebx, %0"
:"=g"(f)
:"g"(f)
: "%eax", "%ebx"
);
f *= 1.5f - fhalf*f*f;
return f;
}
The code is for the GNU C/C++ compiler and its probably compatible with 32bit architectures.
Enjoy! |
|
| |
| |
| |
|
« | ‹ Prev |
1 2 3 4 5 6 7 8 |
Next › | »  |
|
|
|