Game Development Community

Terrain XYZ's??

by Bobby Leighton · in Torque Game Engine Advanced · 10/09/2007 (2:09 pm) · 3 replies

Alright I'm playing with the terrain shaders again, and I'm sure I can get what I want if I can figure out how positional data is supposed to be passed to the shaders so when I make my separate opacity maps I can I know how they are going to tile across the legacy terrain, any help would be most appreciated;)

#1
10/09/2007 (8:02 pm)
Well I am not so sure about legacy terrain but I can give you what I know from working with atlas.

Inside gfxStructs.h there are a number of structures defined. The ones you are concerned with are the DEFINE_VERT ones. One of those specifies the Vertex structure for legacy Terrain. I can tell you that
DEFINE_VERT( GFXAtlasVert2,
            GFXVertexFlagXYZ | GFXVertexFlagNormal | GFXVertexFlagUV0 | 
            GFXVertexFlagUV1 | GFXVertexFlagUVW2 | GFXVertexFlagTextureCount3)
{
   Point3F point;
   Point3F normal;
   Point2F texCoord;
   Point2F texMorphOffset;
   Point3F pointMorphOffset;
};
is the one for atlas and I think all of the DIF and DTS objects are
DEFINE_VERT( GFXVertexPNTTBN,
             GFXVertexFlagXYZ | GFXVertexFlagNormal | GFXVertexFlagTextureCount5 | 
             GFXVertexFlagUV0 | GFXVertexFlagUV1 | 
             GFXVertexFlagUVW2 | GFXVertexFlagUVW3 | GFXVertexFlagUVW4 )
{
   Point3F point;
   Point3F normal;
   Point2F texCoord;
   Point2F texCoord2;

   // texture-space transform 3x3 matrix
   Point3F T;
   Point3F B;
   Point3F N;
};

This vertex structure defines the Vertex input structure for the shader. You're going to be concerned with texCoord if you want to know how something will tile. Whatever you store in legacy vertex structure will pass to the vertex shader.

I hope that helps....

Ves
#2
10/09/2007 (9:19 pm)
I think this will help, I'm think Ive even seen the legacy stuff...hmm you see i can get everything In my shader working for the most part but i cant tell how big the terrain really is, i know its a 256x256 heightmap, but lets say you wanted to just apply one big texture what would this look like then?

In.Position.xy ?? I'm getting confused a bit because it seems that some of the things like Position the way it is used in the blender shader is different from the terrain shader in legacy, or at least i get error that I have to tinker with to get it working, thanks for the help Ves!!
#3
10/10/2007 (8:41 pm)
Hey Ves, if your still watching this tread, is it this one...and is it the "normal" that i will use or should I add my own, sorry for what are probably dumb questions, but Ive only had experience programing C#, i haven't gotten to C++ yet I'm taking that after Assembly;) But this is what I found where you told me to look:


DEFINE_VERT( GFXTerrainVert,
GFXVertexFlagXYZ | GFXVertexFlagNormal |
GFXVertexFlagTextureCount1 | GFXVertexFlagUV0)
{
Point3F point;
Point3F normal;
Point2F texCoord0;
};

Seems right, but i usually spend 2-3 days ruining and breaking code until unready to let the numbers and letter win the war I'm waging with them;)

just to let you know what I'm doing is I'm try to start off getting the detail texture to work like normal, just initialized from the blender shader, i can disable it from the other shader, but if I can have them in one shader...well i don't want to give away the plan yet, I'm working on this for someone and I'm not sure what their confidentiality level is yet, but do you understand where I'm going with this...Once I get it working from the blender shader I'm hoping i can work it so i can get detail texture just where I want it, unless i can get the blender working in the terrain shader itself, sorry if I sound confusing i ramble on a bit sometimes...