About Store Forum Documentation Contact



Post Reply 
My Height Map
Author Message
Corrado Offline
Member

Post: #1
My Height Map
Hello,

i started with this great engine few days ago.
Im studing the samples, there are very nice and easy.
I have a question about the Terrain : in the basic example to build the heigth texture you wrote :
Gfx gfx(128,128,1,GFX_I8,GFX_SOFT);
can i load my heightmap ? like this :
gfx.Import("prove/xxx.gfx");

I try but my map still flat.
Maybe i have to write or set something ?

Many Tks,
Corrado
01-18-2009 06:16 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
Re: My Height Map
hi, yes you can use Gfx from disk
but make sure it's imported to GFX_SOFT mode, and single channel type (for example GFX_L8)
but normally in games heightmaps should be used from the ones created in World Editor - it's easier that way
01-18-2009 06:37 PM
Find all posts by this user Quote this message in a reply
Corrado Offline
Member

Post: #3
Re: My Height Map
Hello,

many tks for your prompt answer but my map still flat.

These are the code lines :

Gfx gfx(1024,1024,1,GFX_L8,GFX_SOFT);
gfx.Import("prove/terra1a.gfx");
mesh.create(1).B(0).createPlane(512,512,VTX_TX0);
mesh.B(0).texScale(Vec2(1));
mesh.B(0).displaceZ(gfx);
mesh.swapYZ();
mesh.matrix(Matrix().setPos(Vec(-0.5,-0.6,-0.5)).scale(Vec(50, 8, 50)));
mesh.setNormals();
mesh.setMaterial(Materials("prove/terra1c8192.mtrl"));
mesh.setBox();

and into : Bool Init()

mshg.create(mesh,VecI(5,1,5)); // create Mshg with 5x1x5 (5*1*5=25) splits (Mesh is splitted to 25 parts along axises)

NOTE : Im using a 1024x1024 height map and a 8192x8192 color map

Tks,
Corrado
01-18-2009 07:25 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
Re: My Height Map
Gfx gfx(1024,1024,1,GFX_L8,GFX_SOFT); // here you create an empty texture
gfx.Import("prove/terra1a.gfx"); // calling import discards current gfx, and creates one from the file

you should do this:

Gfx gfx;

gfx.Import("name", GFX_L8,GFX_SOFT);

cheers!
01-18-2009 08:04 PM
Find all posts by this user Quote this message in a reply
Corrado Offline
Member

Post: #5
Re: My Height Map
Many Tks,

Bye,
Corrado
01-18-2009 08:44 PM
Find all posts by this user Quote this message in a reply
Post Reply