# problems rendering a heightmap on ATI cards

This topic is 4844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

the issues from my previous thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=339118 seem to have been sorted outsomewhat by drawing whole strips of my terrain at once, and not just one quad at a time, lowering the amount of times I call DIP from about 32,000 to 180 (at most depending on how much is culled using my quadtree), I'm still confused as to how this is a problem on ATI cards and not nVidia but now I seem to have another issue, which is only present on ATI cards again, I've not seen it myself due to having an nVidia card but here's a pic a friend of mine took: http://img330.imageshack.us/img330/9358/issue9je.jpg I really don't know what is causing this, everything is fine on my computer. Any help at all would be really great. [Edited by - Starcide on August 17, 2005 3:11:06 PM]

##### Share on other sites
It looks like the vertices are in opposite order at one end.

##### Share on other sites
I'm pretty sure I'm setting up my vertex buffer fine, as well as the index buffer, if I missed anything myself here they are:

vertex buffer
	for(int j=0; j<HeightCells+1;j++)	{		for(int i=0;i<WidthCells+1;i++)		{			Floor_Data[i+j*(WidthCells+1)].x=x;			Floor_Data[i+j*(WidthCells+1)].z=z;			Floor_Data[i+j*(WidthCells+1)].y=floorheight;			Floor_Data[i+j*(WidthCells+1)].diffuse=colour;			Floor_Data[i+j*(WidthCells+1)].normal=normal;			x=x+CellStep;		}		x=StartX;//set the X value back to the start of the next row	z=z+CellStep;//move up a row	}

this produces a regular grid(in this case WidthCells=HeightCells=2:

  7---8---9  |   |   |  4---5---6  |   |   |  1---2---3

then my index buffer is set up like so:

for(int j=0;j<HeightCells;j++)	{		for(int i=0;i<WidthCells;i++)		{				//    v3   v4			//	|/|			//    v1   v2			//CLOCK WISE			Floor_Index[k++] = i+j*(WidthCells+1);					//v1			Floor_Index[k++] = i+(j+1)*(WidthCells+1);			//v3			Floor_Index[k++] = i+1+(j+1)*(WidthCells+1);		//v4			Floor_Index[k++] = i+j*(WidthCells+1);				//v1			Floor_Index[k++] = i+1+(j+1)*(WidthCells+1);		//v4			Floor_Index[k++] = i+1+j*(WidthCells+1);			//v2		}	}

as you can see from my index buffer I am using triangle lists

##### Share on other sites
The nVidia driver ignores the performance hint parameters passed to DrawIndexedPrimitive (MinIndex and NumVertices). It's possible that these values are incorrect, and the nVidia driver just doesn't care.

Have you tried using the reference device? If you get the same problem there, then the above is almost certainly the problem.

##### Share on other sites
sorry I forgot to mention that running this on the debug version of direct x(i guess this uses the reference driver) doesn't produce the problem seen in the picture, it looks normal using retail and debug on my card.

I know about nVidia drivers ignoring NumVertices and MinIndex i don't think these values are wrong as I added asserts that ATI cards use to my code to check that the values were in the correct range as was stated in the FAQ for the forum.

but for reference here's my DIP call, my quadtree outputs a list(CulledTerrainList) of Nodes each of which is a square and is defined by it's max and min points, each square is drawn using a DIP call for each line of the square:

int items = CulledTerrainList->GetCount();	for(int i=0;i<items;i++)	{		CurrentNode = CulledTerrainList->Remove();		//works out the coord of the cell		int LxPos = (CurrentNode->lx - Terrain.StartX)/Terrain.CellStep;		int LzPos = (CurrentNode->lz - Terrain.StartZ)/Terrain.CellStep;		int HxPos = (CurrentNode->hx - Terrain.StartX)/Terrain.CellStep;		int HzPos = (CurrentNode->hz - Terrain.StartZ)/Terrain.CellStep;			//TERRAIN		//	*--------------------(WidthCells,HeightCells)		//      |                            |		//	|      xSpan--->             |		//	|	                     |		//	|	 NODE          ^     |		//	|	*------Hx,Hz   |     |		//	|       |      |       |     |		//	|       |      |     zSpan   |		//	|   Lx,Lz------*             |		//      |                            |		//      |                            |		//     (0,0)-------------------------*			int xSpan = HxPos - LxPos;		int zSpan = HzPos - LzPos;			int IndicesPerCell = 6;//number of indices each cell has in the index buffer		int VerticesPerCell = 4;				int VerticesUsed = (Terrain.WidthCells+1)*2;		int PrimCount = xSpan*2;		int MinVertex,MaxVertex,MinIndex,NumVertices,StartIndex;		//draw whole strips of the square		for(int i=0;i<zSpan;i++)		{				MinVertex = ((i+LzPos)*(Terrain.WidthCells+1))+LxPos;				MaxVertex = ((Terrain.WidthCells+1)*((i+1)+LzPos)+(xSpan+1));				MinIndex = MinVertex;				NumVertices = MaxVertex-MinVertex;				StartIndex = (((LzPos+i)*(Terrain.WidthCells))+(LxPos))*IndicesPerCell;								assert(Terrain.Floor_Index[StartIndex] >= MinIndex);				assert(Terrain.Floor_Index[StartIndex] < (MinIndex + NumVertices));								d3d_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,									0,									MinIndex,//index in vertex buffer of first vertex																	NumVertices,//span of vertices used									StartIndex,									PrimCount);//triangles		};	};

1. 1
Rutin
69
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633420
• Total Posts
3011793
• ### Who's Online (See full list)

There are no registered users currently online

×