Browsing Tag

Game Engine

Graphics, GUI, Programming

Aspect Ratio and Context Menu

12 septiembre 2009 • By

Hi there! now I have assigned 1.3 aspect ratio and created context menu for to select easily between effects. Shortcut is available with function keys too, F1-F10.

This is the end of the first lite version using glut. Is a lightweight version, I will use Qt for a complete and complex version in the future. Example of use:

>ModelViewer path/creatures/bigdady2
>ModelViewer path/creatures/bigdady2/otherName.obj

So easy, I will explain better in other moment but you only need OpenGL 2.0 support and a model with .mtl file with a correct format.

Aspect Ratio and Context Menu

Aspect Ratio and Context Menu

Graphics, Programming

Deferred Rendering and Normal Mapping

12 septiembre 2009 • By

To do normal mapping in Deferred Rendering is little dificult because you need to store in G-buffer tangent and binormal if you want, but it is easy to calculate. Or you can calculate TBN matrix per pixel with your 2D normal map stored in G-buffer. So I can’t do that because have high GPU consumption.

Other thing that you can to do is store in 8bit the result of “light power” calc in Geometry stage and then, use that in Lighting Stage. But “normal mapping” will be based in 1 light.

Anyway, we can do an approximation using a bling phong lighting and fast normal mapping calc:

// Calculate half vector
vec3 H = normalize( normalize(lightDirection) + normalize(eyePosition.xyz - pixelPosition.xyz)); 
    
// Calculate phong shading
float shininess = 100.0;
vec3 phong = pow(max(dot(H, normal.xyz), 0.0), shininess) * specular.rgb; 

// Calculate normal mapping effect
float lightAmount = max(dot(normal.xyz, normalize(lightDirection)), 0.0);
Graphics, Programming

Adjusting SSAO

8 septiembre 2009 • By

I’m adjusting the params of my SSAO shaders. I’m trying to have more darkness in occlusion zones and more clean the others fragments. So adjusting selective fragments I have more performance.