Thanks for your feedback!
@Jim:
Thanks for helping to fix my problem when having two different values for sizeX and sizeY. I think there is a small bug and an unneeded muliplication of 255 in your code. However i got the idea and managed to get it work. Input values for sizeX and sizeY are still values like 5 and 4 instead of 32 and 16... but i think its still ok for the first.
Maybe there are parts for optimisations like doing all in just one For/Next loop or whatever... I am not sure...
Here is the fixed working version, thanks to Jim!
// ------ Checkerboard by va!n
int sizeX = 6; // 128
int sizeY = 5; // 64
// Define colors and save to array
Color color0 = new Color(255, 255, 255, 255);
Color color1 = new Color(255, 0, 0, 255);
Color[] array = new Color[2] { color0, color1 };
// Create stuff...
for (int y = 0; y < 256; y++)
{
int ty = y << 8; // y * 256
for (int x = 0; x < 256; x++)
{
int col = ((x >> sizeX) ^ (y >> sizeY)) & 1;
texData[x + ty] = array[col];
}
}
I know two ways to convert an image to greyscale... One way is just to add r,g,b and divide by three, which is possible the fastest way but afaik it does not represent 100% the greyscale range of human eye. The other way and afaik more exact greyscale converting way is to multiply each color channel with a defined value. Does it makes any big difference in the normalmaps or bumpmaps result?
a) grey = r + g + b / 3
b) grey = r * 0.3 + g * 0.59 + b *0.11
Atm i am not really sure how to calculate the wanted maps from the greyscaled image using this 8x8 neighbouring pixels. I will try to find hopefully something at google.