lunes, 2 de septiembre de 2013

New website


Recently I've finished (almost) the redesgin of my ancient official website. Check it out at: http://www.gamedusa.com Also, the blog was moved to: http://www.gamedusa.com/blog/ I'm very proud with the new design. There you can find more information about cool developments if you want to hire a coder :D

martes, 19 de junio de 2012

Host emulator

This is the last program that I finished. The program basically, receive, sends and displays messages in linux. Can be configured in UDP and TCP modes. I used Ubuntu 12.04 for the development but the end aplication works into a Fedora Core 9. Also uses GTK+ 2.0 and the development environment was of course: http://www.codelite.org

jueves, 29 de diciembre de 2011

Terrain updates (II)


This is a new screenshot of my 3d planet simulation.

There are a lot of improvements since the last blog update, but I'll try to explain it in the next blog entries...

miércoles, 23 de febrero de 2011

Terrain updates

After at least one year without any entry, finally I decided to post my evolution on terrain rendering.

The planet has geometry and texture streaming of whole earth at 1km resolution (for now). And as a bonus, a little galaxy :D










lunes, 29 de marzo de 2010

Pack normal and height data in one float texture

Wow, hard coding night. But in the end I can code two routines that allows me to store normal mapping data and terrain height in one float texture. Remember that in order to perform vertex texture fetch in the vertex shader we need to access to the topology with one float texture.

I coded this in C++ but it's easy portable to GLSL or HLSL.

In this example I store only 2 normal components: X and Y in range 0 to 255. Remember that you must extract third component as follows: sqrt( 1.0 - nx*nx + ny*ny );

Heightmap has custom precision values, due big imprecision of floating point conversion. With 11 bits of precision we can store heights from 0 to 2043. This happened because we loose 4 numbers with this precision. The formula is:

unsigned char hPrecisionBits = 11; // (1<<11) = 2048
unsigned char expectedError = 1 << (hPrecisionBits - 9); // 4
unsigned short maxHeight = (1 << hPrecisionBits) - expectedError; // 2044

//! Gives fractional number
inline float frac( float _value ) {
return _value - floorf( _value );
}

// NX | NY | HEIGHT -> float32
// 8 | 8 | 16
inline float packNormalAndHeight( unsigned char _nx, unsigned char _ny, unsigned short _height, char _hPrecisionBits )
{
return
(_nx / 256.0) +
((_ny / 256.0) / 256.0) +
(_height / ((float)(1<<_hPrecisionBits)) / 65536.0);
}

// float32 -> NX | NY | HEIGHT
// 8 | 8 | 16
inline void unpackNormalAndHeight( float _value, char _hPrecisionBits, float* nx_, float* ny_, float* height_ )
{
*nx_ = floorf( frac( _value ) * 256.0 );
*ny_ = floorf( frac( _value * 256.0 ) * 256.0 );
*height_ = frac( _value * 65536.0 ) * ((float)(1<<_hPrecisionBits));
}


Usage example:

unsigned char hPrecisionBits = 11; // (1<<11) = 2048
unsigned char expectedError = 1 << (hPrecisionBits - 9); // 4
unsigned short maxHeight = (1 << hPrecisionBits) - expectedError; // 2044

// Pack as 8 | 8 | 16
float packedValue = packNormalAndHeight( 231, 137, 2043, hPrecisionBits );

// Unpack from single float
float x,y,h;
unpackNormalAndHeight( packedValue, hPrecisionBits, &x, &y, &h );

Notice that 'expectedError' brings us the amount of error values returned in height function. For example, if our precision bits are 9, expected error will be 1 (135 when we store 136 number). For 10, error will be 2, for 11, will be 4, for 12 will be 8, etc...

I hope it will be useful.

miércoles, 6 de enero de 2010

A message to the world



...or when the human beings became adults.

sábado, 5 de diciembre de 2009

Codelite


Surfing through the xubuntu repository I found this new fantastic c++ multiplatform ide:
In Windows it uses gcc 4.4 and has an integrated Subversion plugin!!!
http://www.codelite.org/

Currently I'm trying it with my home projects. OhYesYesYesYes