i'm confused about fps in my programme.
i draw 200 textured triangles in 640x480 window but get only approximately 160 fps.
it's strange but when i zoom out from triangles fps growth momentally, but when i close...
PreferMultiSampling =
false;SynchronizeWithVerticalRetrace =
false;RenderState.DepthBufferWriteEnable = false; (i need it coz, ill render triangles with transparent textures)
i use DrawIndexPrimitives, i.e. useing vertex and index buffer.
any ideas how to increase fps

low fps
Aun
It really isn't worth reading too much into performance measurements for applications that are not doing very much work, and are running at ridiculously high framerates. The actual cost of your drawing code usually ends up being so low that performance is totally dominated by system overhead, so you end up accidentally measuring uninteresting things like how long Present takes or how fast Windows is at dispatching input messages.
Before doing any kind of serious performance investigation, you need to make sure you are doing enough work that your framerate falls below the monitor refresh rate. Try drawing hundreds of thousands, or even millions, of triangles, and then you'll get results that can really tell you something interesting.
sigme
My terrain engine, for a 1024x1024 heightmap, using 2 shaders, one for hi detail (6 alpha blended textures, base layer and lightmap) and one for low detail (1 texture stretched the entire terrain), I blend from hi detail shader and switch to low detail based on a certain distance, rather like the fog factor formula.
I use quadtree culling plus LOD switching algorithm.
My near and far planes are set to 1, 1000 respectively, so I see quite a lot of the terrain at one time unless I am looking at more of a downward angle.
I get average 100-150 FPS in windowed mode, I get 300-500 FPS (depending on how much visible terrain) in fullscreen mode.
If I move away from the terrain whilst still looking at it, where the LOD would be most coarse, I get 600+ FPS.
If I look at nothing, so everything is culled, I get 1000+ FPS.
I suck at artwork, and my engine is in its 'messy needs optimising and refactoring stage' but here is a screenshot I took of a 512x512 heightmap terrain http://geekswithblogs.net/images/geekswithblogs_net/fluxtah/6133/o_terra.jpg
I am not sure why you are getting such low FPS, but I do not think your test is giving accurate results.
Also GFX cards are optimised to render large batches of geometry with as less draw calls rather than small batches with many draw calls, I doubt this is the problem though.
Marc Jones
ok thanks :)
ill fill func draw with other calls and then will come back here again :)
Softwhere
2Shawn:
160 fps for void 200 triangles... there will be more than 200 + models + physics + game logic...
2dzraptor:
ofc i will then move out of draw func anything possible. but for now i think it won't gimme +200 fps :)
btw, when i draw loaded textured *.x model that consist of 1800 triangles fps is ~470! still confused why...
edit: i'm using texture non power of 2 dimensions. can it be the reason
XNA Rockstar
R.K.S.
No, that sounds about right. For example, I just ran my game, and I was getting 120 FPS on average, which means about 8 milliseconds per frame. However, I also useda Stopwatch to measure my update and draw frames, and it turns out, those add up to about 4 milliseconds. That means I have another 4 milliseconds as overhead, and 6 milliseconds doesn't seem like that much of a stretch.
Zero_
jackinthegreen
hi again!
i told i'll come back ;)
at the moment i have same 200 triangles rendered with only 25-35 fps. im using 3d texture and my own effect. this fps are definitly less that i expect to see :)
texture3d size is 128x64x128 Color format (i.e. not very big - only 4 mb) and created this way:
vlTexture =
new Texture3D(graphics.GraphicsDevice, lx, ly, lz, 1, ResourceUsage.None, SurfaceFormat.Color);i dont change anything, just draw triangles.
here is the part of my shader:
struct VS_OUTPUT3
{
float4 position : POSITION;
float3 texCoord : TEXCOORD0;
};
VS_OUTPUT3 Main_VS3(
float4 pos : POSITION,
float3 texCoord : TEXCOORD0)
{
VS_OUTPUT3 Out = (VS_OUTPUT3)0;
Out.position = mul(pos, worldViewProj);
Out.texCoord = texCoord;
return Out;
}
float4 Main_PS3(
float3 texCoord : TEXCOORD0) : COLOR
{
return tex3D(textureSampler, texCoord);
}
Grahame Edwards
Morten Dahl
DBLearner
Sure. But my point is, this 160 fps figure is totally meaningless. You can't generalize from drawing just a few things to what kind of performance you will get when you later come to draw lots of things. There just isn't any meaningful relationship between the numbers, because at the moment you are not measuring what you think you are measuring: almost all of that 160 fps figure will be dominated by constant (and very unpredictable) fixed overhead costs.
The only meaningful way to look at framerate figures is to draw what you actually want to draw in your final game, and then see how fast that runs. Drawing less and then trying to apply a linear projection based on whatever figures you get just isn't a valid logic and won't tell you anything useful at all.
scribework
here is my draw func
protected override void Draw(GameTime gameTime){
VertexPositionColor
[] axes = new VertexPositionColoraxes[1] =
new VertexPositionColor(new Vector3(100, 0, 0), Color.Red);axes[3] =
new VertexPositionColor(new Vector3(0, 100, 0), Color.Green);axes[5] =
new VertexPositionColor(new Vector3(0, 0, 100), Color.BlueViolet);basicEffect.View = mainCamera.ViewMatrix;
basicEffect.Texture = tz[0];
basicEffect.Begin();
foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes){
pass.Begin();
graphics.GraphicsDevice.VertexDeclaration = decl1;
graphics.GraphicsDevice.DrawUserPrimitives<
VertexPositionColor>(PrimitiveType.LineList, axes, 0, 3); graphics.GraphicsDevice.VertexDeclaration = decl; graphics.GraphicsDevice.Vertices[0].SetSource(vb, 0, VertexPositionTexture.SizeInBytes);graphics.GraphicsDevice.Indices = ib;
graphics.GraphicsDevice.DrawIndexedPrimitives(
PrimitiveType.TriangleList, 0, 0, lz * 4, 0, lz * 2);pass.End();
}
basicEffect.End();
base.Draw(gameTime);DrawFps();
}
where lz is 100
vb =
new VertexBuffer(graphics.GraphicsDevice, VertexPositionTexture.SizeInBytes * lz * 4, ResourceUsage.None);vb.SetData<
VertexPositionTexture>(pz);ib =
new IndexBuffer(graphics.GraphicsDevice, sizeof(int) * lz * 6, ResourceUsage.None, IndexElementSize.ThirtyTwoBits);ib.SetData<
int>(idz);setuped earlier in loadgraphicscontent
Penicillin
Imran_Akram
A "constant fixed system overhead" of 6 milliseconds per frame That doesn't sound correct...