DirectX Performance Tips
Blitz3D Forums/Blitz3D Programming/DirectX Performance Tips
| ||
Just thought some points of this article could prove to be useful for us blitzers: http://wiki.directxers.com/index.php?title=Performance_optimizations (EDIT: I just checked, all these tips come from the DirectX 7 SDK) Many tips rely on having a control that only using the DirectX SDK itself could we use, but there are some interesting points like: - Clear only when you must (for those thinking that the Devil Child's Particle System is well optimized...it uses ClearSurface every time it updates the particles). - 256x256 textures are the fastest (if not that exact size, then at least square textures). - Directional lights are more efficient than point lights or spotlights. Cyas. |
| ||
That is interesting.. and helpful, thanks for the link, Kryzon. I'm a little unsure of some of the meanings used such as "Vertex Buffer switches" or "vertex format size", but that seems beyond my 'level of Blitzing' anyway. |
| ||
I think that this would be intended for DX 9, so you'd have to pick out what is useful from the article. |
| ||
Bah, directional lights can go kiss my... fart... because I like point lights. |
| ||
You should be using vertex lighting - it is the snizz. |
| ||
You don't even need to worry about that Malice, that's the part I mentioned that is beyond our Blitz3D-abled control. Only with C++ and the SDK could you handle such things. |
| ||
D:) Vertex lighting eh? NOT POSSIBLE I SAY!! *expects to be handed an extremely simple vertex lighting example* |
| ||
There are about 3 or 4 in the code archives. |
| ||
Ha! I'll prove you wrong! *doesn't look and simply heads off to see how to make a .dll* *finds out making a .dll to store all his useful functions is harder than he thought* http://www.codeproject.com/KB/DLL/DLL_EZ_Build_EZ_Usage.aspx |
| ||
DX lights are vertex lights anyway, so i reckon it'd be slower than the hardware lights. Anyway, making each entity less than 2000, or the closest to a multiple of 2000, will make your rendering more effient. SOmething to do with dx 7 sending 2000 triangle at a time to the graphics card. So if your model was 2,100 triangles, then it would sending 2 lots of triangles to the graphics card. |
| ||
Anyway, making each entity less than 2000, or the closest to a multiple of 2000, will make your rendering more effient. SOmething to do with dx 7 sending 2000 triangle at a time to the graphics card. So if your model was 2,100 triangles, then it would sending 2 lots of triangles to the graphics card. hm...any references to verify this? google just has results regarding the year 2000, when dx7 was released... ;) even if that were true, it would make a difference only, when you change the mesh structure. since a normal mesh is send to the graphicscard only once after loading. transforming and rendering an entity happens entirely on the graphicscard due to T&L... so this would affect you, if you're using a singlesurface particle system or something, but there really isnt much you could do about the polycount then... |
| ||
I wouldn't have thought Blitz3D would cap the triangle batches, let alone DX7. I'd say it is purely hardware-related. |
| ||
I think that this would be intended for DX 9, so you'd have to pick out what is useful from the article. Nope, I just read the Dx7 documentation and it's the same tips there, from 1999. |
| ||
I purely looked at the date at the top of the article: 'DirectX SDK June 2007'. |
| ||
Don't worry man, I'm not saying you are wrong or anything. I didn't know it was from back then either. |
| ||
Blitz3D doesn't cap it, it's a directX 7 thing. I did extensive testing on this. You can set up the experiement yourself. Something simple like creating 40 spheres. Make code so you can change the level of detail of the spheres (through the built in CreateSphere() command) Monitor the FPS on screen, and, the polycount an individual sphere. When the sphere contains 1500, then 1900, then 2200 (making these numbers up to demonstrate a point.) upon going past 2000 tris, you will notice a drop in the framerate, not inkeeping with the previous. |
| ||
Ok, here we go. It isn't much, but it's hard to tell on this old work computer. The actual limit is 2048 (2^11), between sphere detail level 23 and 24. There is a large jump in fps between detail level 23 and 24, than there is between any other detail level (this gap will occur when the traingle limit for each sphere reaches 4096 too. I have not displayed the triangle result for each sphere. You can test this by setting the number of spheres to 1 though. 21 was best for my test, on this computer. Adjust sphere detail using the left and right ARROW keys. Graphics3D 800,600 SetBuffer BackBuffer() Global camera = CreateCamera() Global timer = MilliSecs() Global fps Global frame Global detail = 23 Global number_of_spheres = 21 Dim spheres(number_of_spheres-1) For loop = 0 To number_of_spheres - 1 spheres(loop) = CreateSphere(detail) PositionEntity spheres(loop),Rnd(-10,10),Rnd(-10,10),20 Next While Not KeyHit(1) If KeyHit(203) Then detail = detail - 1 sphere_detail(detail) End If If KeyHit(205) Then detail = detail + 1 sphere_detail(detail) End If If MilliSecs() < timer + 1000 Then frame = frame + 1 Else fps = frame frame = 0 timer = MilliSecs() End If UpdateWorld RenderWorld Text 0,0,fps Text 0,15,detail Text 0,30,TrisRendered() Flip 0 Wend Function sphere_detail(detail) Local tempx# Local tempy# Local tempz# For loop = 0 To number_of_spheres - 1 tempx = EntityX(spheres(loop)) tempy = EntityY(spheres(loop)) tempz = EntityZ(spheres(loop)) FreeEntity spheres(loop) spheres(loop) = CreateSphere(detail) PositionEntity spheres(loop),tempx,tempy,tempz Next End Function |
| ||
I don't see a drop. 22 yields 555 FPS 23 yields 515 FPS 24 yields 478 FPS 25 yields 443 FPS I still deem this hardware-related. |
| ||
It's probably a drop in the ocean nowadays. I was fairly noticable though on the older hardware, and it definetly was a dx7 thing. |
| ||
Funny, there's a larger drop between 22~23 (EDIT: About 60% more, something like that). Don't know why. |
| ||
Maybe it was 2,000 tris? anyways :) there was definetly a limit round about that number. I'm glad someone else confirmed my results. Thought i was losing my memory :D |
| ||
What hardware are you using "Kryzon"? I have an 8800 GTX and an Intel E6600 Core2 Duo 2.4GHz. |
| ||
Hey, we're all here to help each other, Ross C. :) Here you go, "puki": P IV 2.2 GHz GeForce FX5200 |
| ||
Puki, your computer is probably too stupidly fast :D Try using alot more spheres? Indeedy Kryzon :) |
| ||
No, my Blitz3D is better than everyone elses. I have the best copy of Blitz3D. |
| ||
What's the good thing about having the best copy of Blitz3D if you don't make any games with it? =( |
| ||
I am more of a pioneer than a game maker. I don't do simple games. |