Strange slowdown when model(s) goes off screen

Started by
18 comments, last by CarlML 7 years, 4 months ago

I doubt it has to do with clipping for many reasons including if it was clipping the order of draws wouldn't matter. Stick with profiling to give you hints as to what is happening.

edit - also what videocard are you running on?

I'm using GeForce GTX 1080 with the latest drivers.

In my test case I'm getting 500+ fps now in the fast frames while in the slow frames it crawls to 20-30 fps.

Advertisement

Can you try it on a different machine with a different videocard? or try rolling back your drivers to a previous version? Just to be sure its not a hardware/driver issue.

Also how is your code organized is there one draw function or is the code to draw each object spread out? Maybe you're setting some state by accident when rendering that one particular model.

-potential energy is easily made kinetic-

I may have found the source of the issue. I was creating the Direct3D device using D3DCREATE_SOFTWARE_VERTEXPROCESSING. If I use D3DCREATE_HARDWARE_VERTEXPROCESSING the issue goes away.

Turns out it was not the object above that was causing an issue since when I removed it I was able to reproduce the slowdown with other models when they were partially outside the view frustum. I'm guessing that the clipping of many polygons using "software vertex processing" is very slow.

What do you think, does it sound like a likely cause of the issue?

Btw, thanks for the input so far, it is very much appreciated.

Infiinisearch, I have tested with different drivers and the result was the same.

You will get much greater performance with hardware vertex processing so it might become a non-issue. But does it still drop frame rate depending on the order of that model? Because that really is a strange issue. Also when you replaced that model and still got the slowdown did you use the same code to draw the new model?

edit - also how many vertices is the model/s causing the problem? And you said you duplicate it a few times? how many?

-potential energy is easily made kinetic-

You will get much greater performance with hardware vertex processing so it might become a non-issue. But does it still drop frame rate depending on the order of that model? Because that really is a strange issue.

No, any hint of the issue goes away with hardware processing but I'm not entirely convinced it is fixed since it was behaving pretty strange.

Also when you replaced that model and still got the slowdown did you use the same code to draw the new model?

I used the same shader code. The other models are drawn using "mesh->DrawSubset();", which as far as I can tell from looking at PIX calls the same functions as the 4 last functions I call in the render function I posted above.

edit - also how many vertices is the model/s causing the problem? And you said you duplicate it a few times? how many?

I was rendering a model with about 800 faces and 461 verts 35 times in the same spot.

The batchmodel that I initially though was causing the problem was a single model of about 8000 faces and about 12000 verts.

Still trying to figure this out, I have stripped the project down to its bare minimum to render the objects and I can still reproduce the issue.

If any of you would like to take a look and see if you can reproduce the issue then here is the Visual Studio 2012 project with the .x object included (72 kB total):

http://www2.zippyshare.com/v/mI5AarI7/file.html

It should be ready to build if you just set the directories for the directx SDK on your computer. There is also an already built .exe in the Release folder.

The camera is controlled with WSAD, if you go backwards slightly you will see the object cross over the far clipping plane. At that point you will see the fps (in the upper left corner) go down drastically if the behavior is the same as for me.

You can try changing the device creation to use "D3DCREATE_HARDWARE_VERTEXPROCESSING" to see if the issue goes away.

Of course, if there are any debugging gurus out there that have a few minutes to spare to determine if this is actually a bug that would be great. :)

If the problem went away with hardware vertex processing, you haven't got any problems..

It sounds like a simple "CPU does no justice here", which is why we have got GPUs :)

I would just leave it be, and be happy it works now - unless you need software vertex processing for some reason?

.:vinterberg:.

If the problem went away with hardware vertex processing, you haven't got any problems..

It sounds like a simple "CPU does no justice here", which is why we have got GPUs :)

I would just leave it be, and be happy it works now - unless you need software vertex processing for some reason?

Yeah I might have to leave it be. I'm considering rewriting my engine to use Directx 11 anyway so a lot of things will probably change. Thanks for the input.

This topic is closed to new replies.

Advertisement