Heightmaps on Terrain?
by Nicolai Dutka · in Torque Game Engine Advanced · 02/13/2009 (7:53 am) · 4 replies
I want to create a terrain from a couple images (one for heightmap, one for texture). I tried using the texture editor and found a spot to add my bitmap, but when I click on apply, the terrain changes but looks nothing at all like my image...
How can I use my heightmaps to form my terrain?
How can I use my heightmaps to form my terrain?
#2
Use the Mission Editor -> Terrain Terraform Editor to import heightmaps.
EDIT: must remember to refresh open pages more often ;) Reverse/flip/mirror your htmap in an image editing program and try again -- see if that helps.
02/13/2009 (9:57 am)
Terrain textures are "blended" tiles repeated across the terrain -- only Atlas terrains have the capability for a "unique" texture image. Atlas terrains are created in 3rd party software and then imported into TGEa and can't be edited in-game like legacy or mega-terrains.Use the Mission Editor -> Terrain Terraform Editor to import heightmaps.
EDIT: must remember to refresh open pages more often ;) Reverse/flip/mirror your htmap in an image editing program and try again -- see if that helps.
#3
I have everything going the way it should and the way I want it. YAY! :P
02/13/2009 (10:30 am)
Ok, I design in Photoshop and flip it right before saving, then flip back to edit some more. Awkward, but it's all good now.I have everything going the way it should and the way I want it. YAY! :P
#4
To fix the flipping applied to the heightmap, replace Terraformer::loadGreyscale with:
Cheers,
Rene
02/13/2009 (12:19 pm)
To fix the flipping applied to the heightmap, replace Terraformer::loadGreyscale with:
//------------------------------------------------------------------------------
bool Terraformer::loadGreyscale(U32 r, GBitmap *bmp)
{
Heightfield *dst = getRegister(r);
for( U32 yh = 0, yb = blockSize - 1; yh < blockSize; yh ++, yb -- )
for( U32 x = 0; x < blockSize; x ++ )
{
ColorI color;
bmp->getColor(x,yb,color);
// compute the luminance of each RGB
dst->val(x, yh) = ((F32)color[0]) * (0.299f/256.0f) +
((F32)color[1]) * (0.587f/256.0f) +
((F32)color[2]) * (0.114f/256.0f);
}
return true;
}Cheers,
Rene
Torque 3D Owner Nicolai Dutka
Everything is backwards... I have a path curving off to the right, but in Torque, it's curving off to the left. I suppose this would be beneficial if I were dyslexic, but it is making it terribly difficult to design a decent map...