This topic is now archived and is closed to further replies.

*choke* 90, 000 polys

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a small grass field using grass patches. Looks nice but is it ever slow. There is no lighting or texturing of the blades. There are 100 patches of grass which consist of a single grass patch set in world co-ordinates. Within each patch are 100 Blades of grass. That number use to be 400. Each blade is made up of 9 verticies making up 7 triangles in a triangle list. The patch of grass is loaded into a vertex buffer. Using world translation, the vertex buffer is copied to 3D space according to a map which holds the co-ordinates of grass patches. I rotate and move the grass field by altering the viewing matrix for rotation and translation. For each re-draw it is taking about 1/4 of a second. That''s a tad too slow for me. This is however and Intel integrated video system. Maybe I''m asking too much of it ? Apparantly Hardware Vertex Processing is not supported on this computer. I am using the HAL layer. Guy

Share this post

Link to post
Share on other sites
The cost of changing matrix and draw calls will be crippling your frame rate. Generate the vertices with the translation offset applied to the vertices, set the world matrix to identity and draw ALL the blades of grass with ONE draw call (DrawIndexedPrimitive[VB] if you''re using D3D).

Fill rate could also be an issue depending on overdraw - change the positions so that all blades of grass are drawn off screen (or draw them into a tiny area of space) - if the framerate shoots up, its a fill rate issue.

If the vertex buffers are filled dynamically every frame, make sure they''re created with the dynamic flag, and the software vertex processing flag. Also make sure you use the proper flags when you lock the buffer, and lock it in batches of around 3000 vertices or you could be starving the hardware of transformed triangles.

On a modern machine using software vertex processing with HAL rasterisation and using the API in a more efficient way, I''d expect more like 30 frames per second. See what you get for the OptimizedMesh sample. On my home machine if I use software VP with HAL output, I get around 69 frames per second with 46464 polygons.

Simon O''''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites

What I have done so far:

( 1 )
Changed to
That improved preformance quite a bit.

( 2 )
I also took away two verticies from each grass
blade which also sped things up.

( 3 )
I''m trying to be memory efficient, so I am using a single vertex buffer to hold the grass patch and moving the verticies manually. I was using a location map to determine where the verticies should be drawn to. I am now using an offset map. This
gets rid of unnecessary calculations on the verticies. This also sped things up quite a bit. There are 100 patches holding 100 blades of grass with 7 verticies per blade ( 5 triangles). So that''s 50,000 triangles rendered each frame. I''m only locking at 700 verticies. That''s inefficient. It does save from the manual vertex calculations however. Fewer verticies to move manually. Maybe I can find a happy medium in there somewhere.

The optimized mesh example reported about 300,000
triangles rendered per second.

When you move over the grass field, it is still a little jerky but much improved.

Thanks, Guy

Share this post

Link to post
Share on other sites
Reducing the amount of Draw*Primitive* calls per frame will help - any less than 20 polygons per call is BAD for D3D. For hardware transform & light cards (e.g. GeForce and above), less than approximately 200 polys per Draw*Primitive* will kill performance.

Share this post

Link to post
Share on other sites

Thanks, Simon

I''m just recovering from buring out my fully integrated mother board and losing about 200 hours of programming due to a lost directory that didn''t get backed up. I''m going to cry and wine about this for some time.

I now have a Celeron 900 with a 64 Meg GeForce graphics card. When I finally get things back to normal, I think that will speed things up substantially. I think my grass was saved. Good thing I keep multiple work directories.


Share this post

Link to post
Share on other sites