faturek at October 8th, 2010 17:55 — #1
This is my first post. Hope, it's the right forum.
I've got a question about the performance of the gamebryo-engine (Elder Scrolls IV: Oblivion) regarding "amount of polygons" vs "texture size".
Which way to go for a good performance:
Have a lot of (> 1'000) (grass-)meshes with 4 triangles (12 triangle points => that is 4'000 triangles (12'000 triangle points) for 1'000 grass-meshes) with a 512*1024 px texture (every grass mesh has the same texture).
Have a lot of (> 1000) (grass-)meshes with 2 triangles (6 triangle points => that is 2'000 triangles (6'000 triangle points) for 1'000 grass-meshes) but with a 1024*2048 px texture (every grass mesh has the same texture).
Hope, someone can answer this question.
Thanks in advance.
reedbeta at October 8th, 2010 19:00 — #2
Sorry, there is no simple answer to that question. It depends on the hardware, the view, the geometry of the grass, and probably other things. With too many vertices you'll be vertex bound, and with fewer you'll be pixel bound. Texture sizes will affect rendering performance less than you think because with a full mip chain, you'll be sampling the mip levels best specialized for the pixel-to-texel ratio on each triangle, so adding another high-res mip will only affect the parts close enough to the camera for it to be visible. The only sure-fire way to answer questions like this is to try it out and measure the performance for the situations you're interested in.
faturek at October 9th, 2010 07:40 — #3
Thx for your answer. I'll test the framerates with both versions.
About the grass-geometry:
In v1, each grass-mesh consists of two rectangles = 4 faces (in 3ds Max-terms) = 4 triangles (in gamebryo-mesh-format-terms (*.nif)). This means that each rectangle is "splitted" into 2 faces (= 2 triangles). This makes 4 faces and 8 vertices (in 3ds Max-terms) and 4 triangles and 12 triangle points (in gamebryo-mesh-format-terms (*.nif)) for each grass-mesh.
in v2, each grass-mesh consists of two triangles = 2 faces (in 3ds Max-terms) = 2 triangles (in gamebryo-mesh-format-terms (*.nif)). This makes 2 faces and 6 vertices (in 3ds Max-terms) and 2 triangles and 6 triangle points (in gamebryo-mesh-format-terms (*.nif)) for each grass-mesh.
In my opinion, the v2-version gives a better performance because of the huge poly reduction in comparison to v1 (e.g. 2'000 grass meshes in v1 have 8'000 faces (or 8'000 triangles); in v2, the 2'000 grass meshes only have half the amount of the faces / triangles (4'000)). Since every grass mesh has the same texture, I don't think, that for every grass mesh the texture will be loaded separately...?
rouncer at October 9th, 2010 08:46 — #4
why would you want a full 1024x2048 texture just for a blade of grass? are you megatexturing or what?
faturek at October 9th, 2010 10:34 — #5
It's not just one blade of grass... Most of the games (I know) have for the grass meshes just some rectangles with an alpha layered texture applied. The texture-file "represents" a whole bunch of "grass blades".
This means that a single grass-mesh (either consisting of 4 or only 2 faces) with the "alpha-layered-grass-texture" applied represents a whole bunch of grass blades (sry, I can't describe it better, English isn't my native language).
kenneth_gorking at October 9th, 2010 14:33 — #6
I belive you are referring to 'billboards'. Just don't render each mesh one-at-the-time, or you will have bigger performance issues to worry about
rouncer at October 10th, 2010 02:57 — #7
I dont understand man, sorry cant help you
thenut at October 10th, 2010 12:56 — #8
Your 2nd option is the semi-correct way as far as geometry structuring goes. With one quad, or 2 triangles, you should have only 4 vertices, not 6. With just 4 vertices, 2 of them get reused twice, so you benefit from vertex caching. You should have 6 indices defined per quad. You should also batch all the grass up into a single buffer and render them in one toss. With just 4000 vertices, that should fly even on old hardware.
Textures should be at a resolution optimal for a single quad at close proximity. 1024x2048 seems a bit excessive to me. Most games use resolutions of 512 or less. You're wasting a lot of memory just for grass.
aticatac at October 23rd, 2010 14:30 — #9
If your grass is too slow then smoke it :w00t: