[XNA] Basic Terrain Renders on nvidia not ati

Started by
7 comments, last by Halsafar 14 years, 11 months ago
Okay I have a 32x32 heightmap, divided into vertices (32x32) and then an index buffer is created (32x32x6) and populated accordingly to render the terrain. This is basic as in no quad tree, no LOD, no culling, just brute force render all testing and I hit a stumbling block. On one computer, running a simple Nvidia 8600GT this small terrain renders just fine. No problems. On a laptop running an HD Mobility Radeon 4500 the terrain just simply doesnt appear. There is no errors I can find. I realize I have not given much to help me solve it. Not sure what else to say. It renders fine on one computer and not on the other. I need to start figuring out what is causing it. Is there a way to check device caps in XNA? Maybe the ATI card does not support index buffer? I know the builds are the same on each comp, using svn. Thanks for any tips.
Advertisement
Do you use shaders at all in your app?
Well I have one to help render a skybox, but it and everything else has been disabled in an attempt to get this terrain to render. As of now the only thing that is attempting to render is the terrain, no shader, just using a "BasicEffect" instance.
Normally I have been attempting to render is using TriangleList. I changed it to PointList and using the same indices I got white dots at every vertices outlining the terrain. Still does not render using TriangleList on the ATI card though.
If you're using indexed triangle lists, make sure all the parameters to DrawIndexedPrimitive() are correct. Most notably check the second and third parameters (MinIndex and NumVertices). If you reference a vertex outside that range with your index buffer it may not work.

Enabling the debug runtimes may also help you find out what's wrong too.


Edit: Didn't spot this was in XNA. Parameters might be a bit different, but the same principle applies...
If you're still having trouble I will post up my code for rendering terrain that I use on my 2900XT when I get home this evening.

Oddly I'm having a problem rendering on nVidia cards where they produce great black areas when it works fine on my ATi card. I won't hijack your thread though ;)

Portfolio & Blog:http://scgamedev.tumblr.com/
Quote:Original post by Halsafar
On a laptop running an HD Mobility Radeon 4500 the terrain just simply doesnt appear. There is no errors I can find.


Have you enabled the debug runtimes? If not, then do it.



Quote:Original post by Halsafar

Is there a way to check device caps in XNA? Maybe the ATI card does not support index buffer?



Of course, see the GraphicsDeviceCapabilities class. You can also use the D3D CAPS viewer that comes with the SDK. However I can guarantee you that it supports index buffers.

Quote:Original post by Adam_42
If you're using indexed triangle lists, make sure all the parameters to DrawIndexedPrimitive() are correct. Most notably check the second and third parameters (MinIndex and NumVertices). If you reference a vertex outside that range with your index buffer it may not work.
This is what I think is happening too, particularly with something complex like terrain.

NVidia drivers ignore the second and third parameters, whereas ATI cards use them, and will not render anything if they're not set correctly. For testing purposes, try setting the second parameter to zero and the third to the number of vertices in your vertex buffer. If that then renders on the ATI card, then these parameters are definitely the problem, and you can spew out the contents of the index buffer to see what these parameters should be.
I made some headway after following some of the advice here, notably with the way I was calling DrawIndexedPrimitive.

Previous I was rendering each face on the terrain as a separate DrawIndexedPrimitive call. I had an idiot moment as this somewhat defeats the whole purpose of using the IndexedBuffer >.> I also was not using the parameters of DrawIndexedPrimitive correctly at all. Not sure exactly why NVidia didnt complain or how it managed to render it properly still. So I set it up to render all 32*32*2 primitives at once in one DrawIndexedPrimitive call. It workes! This seems significantly faster and easier on the graphics card too.

So for those who stumble upon this thread. NVidia seems very relaxed in its usage of DrawIndexedPrimitives. If you are experiencing a related problem check your vertices, indices, carefully examine your call to DrawIndexedPrimitive, then panic.

Now begs the question, who is handling it right. ATI or NVidia. Based on how NVidia was capable of rendering my terrain with completely incorrect parameters I might lean on ATI being the one who does it correctly.

HiJacks are welcome now ;)

This topic is closed to new replies.

Advertisement