Why on earth would this happen (Look at picture)
The lines you see seemingly appear behind me from the point you can see them in the pic onward.
On the way back from the otherside, all you can see above you is some nasty spaces apart lines, it is super ugly...*** is going on.
The vertices MUST be getting listed incorrectly.
Scale = 1024, size = 128.
This is the code which generates the map you see
PHP Code:
bool Landscape::GenerateHeightMap(int size, int scale)
{
FILE *fp;
Segments[0].Size = size;
Segments[0].Scale = scale;
int Size = size;
int Scale = scale;
int idx=Segments[0].NumIndices;
for (y=0; y < Size-1; y++)
{
for (int x=0; x < Size-1; x++)
{
CurrVertex = y*(Size)+x;
Segments[0].Indices[idx--] = CurrVertex;
Segments[0].Indices[idx--] = CurrVertex+1;
Segments[0].Indices[idx--] = CurrVertex+(Size);
Segments[0].Indices[idx--] = CurrVertex+(Size)+1;
Segments[0].Indices[idx--] = CurrVertex+(Size);
Segments[0].Indices[idx--] = CurrVertex+1;
}
}
// we dont need the heightmap anymore, get rid of it
if (hmap) { delete hmap; hmap = NULL; }
return true;
}
Edit:
What type of draw method should I use? STRIP, LIST?
Notice how I am listing the indice backwards...If I don't, then I only seem every 2nd triangle on the terrain unless my camera is below the terrain then I see it all.....
That code is generating enough triangles for the top and bottom to be displayed. I only need to see the top...when the camera is above.
If I do a LINESTRIP it seems every vertice point runs a tangent to an infinite nowhere.
Last edited by Halsafar; Nov 28th, 2004 at 11:09 PM.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
If I use TRAINGLELIST and put the camera below the terrain it works fine. I think...so it is actually sitting below 0..ie the triangles are being render in the wrong orientation.
any assistance?
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
can you post a couple more pictures from different angles so I can see what is actually happening. Also are all those lines going to 0,0? This is a common problem when you run out of verts in your buffer.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Also instead of making the indices in reverse order try using Clockwise Culling instead of Anticlockwise Culling, or vise verser.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
I had to record the indices in the proper order 0 to end..
They were originally being ordered clockwise....so by reversing it I sorta fixed the problem on TRIANGLESTRIP.
TO FIX IT:
First off, using TRAINGLELIST allowed me to only see the outline of hills above the terrain, and I could see everything if I went below the terrain and looked up at it.
So after staring at the code forever I realized the indices where still being ordered clockwise...so I switched it to the opposite.
Segments[0].Indices[idx++] = CurrVertex+(Size);
Segments[0].Indices[idx++] = CurrVertex+1;
Segments[0].Indices[idx++] = CurrVertex;
Segments[0].Indices[idx++] = CurrVertex+1;
Segments[0].Indices[idx++] = CurrVertex+(Size);
Segments[0].Indices[idx++] = CurrVertex+(Size)+1;
That minor change to the code fixed it fine...No crazy lines, I can see the terrain from any angle above the terrain. Using TRAINGLELIST.
Only problem I encounter now....Is below the terrain I should not see anything...assumably...But I can see every 2nd triangle
I'll post a jpeg showing an example....It weird. Literally every 2nd triangle is removed from culling when below the terrain, but they all show above the terrain....
I do not get it...
I can't seem to see if the code I posted above is trying to create the terrain as to allow seeing from both sides.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama