Texturing and impact on performance...

Texturing and impact on performance...

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Texturing and impact on performance...

Post by Forboding Angel »

Would someone go into detail as to how much s3o textures affect performance?
User avatar
MR.D
Posts: 1527
Joined: 06 Aug 2005, 13:15

Post by MR.D »

Well for starters, I can tell you that by using a tileset where many units share the same textures, it saves space, and alot of memory.

S3o just like any modern format, by using dedicated "per-unit" textures takes up alot more memory, even if you're using 128x128 or 256x256 textures per unit at 48kb, or 96 kb, you multiply that by how many units and you end up with typically much more loaded textures in memory as long as they're being drawn on screen.

As far as anything else goes, I'll leave it up to sombody with the "know" :-)
User avatar
rcdraco
Posts: 781
Joined: 22 Nov 2006, 02:50

yea

Post by rcdraco »

Well, the texturing very well could be larger, but you are dealing with the fact you could use png, jpg, or dds for textures, versus only bmp's in 3do, with no triangle support. :O

Do 200 bmp's[32x32 to 512x512, max 2048x2048 of all textures]take more power then 200 png's[max 2048x2048 per unit.]?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

s3o textures are unlikely to be the cause of any slowdown however it would be nice to specify high and low resolution images for those on ram impaired cards.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Post by jK »

Do 200 bmp's[32x32 to 512x512, max 2048x2048 of all textures]take more power then 200 png's[max 2048x2048 per unit.]?
Gfx's can't handle PNG natively, so DevIL converts PNGs into a RGBA struct, so it doesn't safe memory at all (also it stress the vram bandwidth). Only dds can be loaded as is into the vram, so those save memory. The best way would be if spring would compress all none dds textures on load :?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

AF wrote:s3o textures are unlikely to be the cause of any slowdown however it would be nice to specify high and low resolution images for those on ram impaired cards.

Actually this is the most helpful post so far...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

You could seperate your models from the other content for different texture configurations. Or you could seperate the textures and make mutators for a 256x256 and 512x512 package, for example. If you're really concerned, that is. Though this isn't really the bottleneck.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

With textures the problem is not slowdown due to content or size, but rather slowdown due to shifting textures in and out of video memory because the video card can't hold it all at once.

Once your dealing with regularly shifting texture data from video ram to system memory and back again it slows everthing down tremendously and holds up any other graphics commands beign sent across at the time.

So really memory space is the deciding factor. Detail etc are somewhat irrelevant save for how they affect memory usage. DDS textures would still be preferable as they remain compressed in video ram, and should be quicker to move between system and video ram due to their decreased size.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

Irregardless.. it is wise and prudent to use smaller texture sizes wherever possible.. especially if you have very little in the way of serious small detailing.. as it will simply improve preformance.. and wont really detract from anything.. A key item to maintain is scaling consistancy..
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

It's not hard to downsample textures at load time. Spring could offer an option to do so.
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

Yeah, downsizing textures is easy but you can't upsize them. So it's much better if textures are made large and then (dynamically?) downsized as much as necessary due to hardware crappyness and game state.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I agree, that it would be good if users could manually set which mipmap level was highest, for games using DDS textures with mipmaps pre-built. However, I think all RGBA stuff is being handled purely through OpenGL calls to MipMapNearest, not being handled by Spring in any really direct way. Therefore, it'd probably be a royal pain to get working.

As for performance... here are the factors...

1. Polycount.

S3Os are half the tricount when turned into tristrips than the equivalent 3DO, because they aren't rendered double-sided. However, that's less-meaningful than you'd think, because of the extra render passes, which require the engine to redraw stuff every time.

2. Render passes.

3DOs go through three render passes: 1 for diffuse, 1 for reflectivity, 1 for teamcolor. Reflectivity is user-controlled, so you can just have 2.

And 1 more if an object's geometry qualifies as being "round"- I'd have to go look up the default breaking angle to see when things are being made "round", but it's something like 45-30 degrees.

S3Os go through many more passes, being forced to use multiple rendering methods with "advanced shaders" on than they really should:

Diffuse
Reflectivity
Glow
1-bit alpha transparency
Teamcolor
Rounding

This is irregardless of whether the object has any transparency (i.e., objects with a pure ON / OFF state still go through that loop, IIRC) ... same with glow and teamcolor and reflectivity, and I forget whether rounding is checked per-pass, or when the object is first loaded....





At any rate, S3Os are a lot less efficient, and the size of the texture map makes a very big difference in how they operate. Every time your object runs through the engine, the texture's coordinates need to be projected onto the surface normals, and IIRC (OpenGL peeps, feel free to correct my ignorance) that's a pixel-based grid search. Then the pixels need to be displayed on the triangles. In short, the bigger the texture, the longer it takes to do the searches, which is why all of the experienced modelers are somewhat obsessed with keeping the size of the texture as low as possible.

For everything in PURE, I use 512 or 1024 skins. I should probably keep everything 512, but for some of the bigger objects, with a lot of details, it just didn't work out- in most games, they fudge around this problem using multitexturing, which Trepan said he'd deliver months ago... but based on the LOD post, he doesn't understand why it's important, because he doesn't know jack about modeling, or the crazy tricks we can do with multitexturing, and are currently forced to emulate in Spring with brute-force methods (uv cloning and mirroring) :roll:
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Rounding? Do you mean gouraud shading?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

TBH, I don't know what to call it- it's the "fragment program" stuff that handles reflectivity, which also tesselates objects where vertex angles < Y. Gourad shading is just a drawing method- this is actually re-tesselating things.

I'd need to look at the code again, though, to see whether it does it only once, when the S3O of whatever type is loaded into memory, or every render pass, or whatever. The long and the short of it, though, is that the reflective shader, which also turns on the rounded effect on S3Os and 3DOs, is using far more triangles than the object had originally- it's SJ code (I think- then JC ported it to S3O, correct me if I'm mis-attributing), and insofar as I can tell, it's related to the tesselation methods used for the dynamic water, where a low-poly mesh is tesselated and made more "round" around areas of disturbance in the water- which is why it's always been the ultimate stress test of Spring rendering ;)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

(fragment programs cannot tesselate, you're thinking of vertex programs)

Those "passes" are texture layers, they are not necessarily rendered in different passes, depending on the multitexturing capabilities of the graphics card.

The grid search you're talking about goes the other way around, it looks through the pixels covered by the polygon, projects its position into UV space and calculates the pixel value from the texels using the filtering defined by the engine (bilinear with mipmaps).

BTW, don't confuse the devs with wrong terminology, multitexturing means using multiple texture units to calculate the texture of a single surface, I think you want to have multiple materials per s3o. Or at least I want those so I don't have to cram everything into the same UV space :P.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Argh, you should read up on OpenGL normal co-ords and making a low poly sphere look smoother. There's no need for a smoothing/rounding pass if you're just using the simplest smoothing openGL provides which is specified at the same time the vertexes are specified using glNormal and glVertex.
At any rate, S3Os are a lot less efficient, and the size of the texture map makes a very big difference in how they operate. Every time your object runs through the engine, the texture's coordinates need to be projected onto the surface normals, and IIRC (OpenGL peeps, feel free to correct my ignorance) that's a pixel-based grid search. Then the pixels need to be displayed on the triangles. In short, the bigger the texture, the longer it takes to do the searches, which is why all of the experienced modelers are somewhat obsessed with keeping the size of the texture as low as possible.
nonsense. 3do objects suffer the same flaw because the graphics card has to map the uv co-ords to the uv map in memory. The difference here is that spring generated the uv map not the suer, and spring generated the uv co-ords not the user.

3do textures are all shunted onto a 2048x2048 texture, which holds all the textures 3do units can use. Spring then takes the 3do units and maps their uv co-ords onto these textures on this uv map.

A set of uv co-ords maps directly onto the co-ords of a texture image in memory. The whole business of texture mapping has been in video cards for quite a while and has been hardware accelerated and optimized for the last decade.

This is something that's been made somewhat irrelevant, just like those brand new cards that can do several billion triangles on screen at once. The geometry and the colours are not the bottleneck here.

The real bottleneck is in moving things back and forth and pushing them onto the GL pipeline, all that communication between the gpu and the cpu/ram, and all those shaders and effects applied ontop of whats being rendered. Thats why thigns like display lists and vertex bfufer objects are such a performance boost because they push thigns onto the video card and minimize back and forth communication. Things like shadows and alpha distortions and bloom and more fancy effects all layered onto each other are what really slow things down, ever wonder why newer video cards have so many shader units of ever increasing numbers and complexity? That 8800GTX is a 124 core shader gpu.


Argh I would recommend OpenGL Super Bible to you.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

KDR_11k wrote:Or at least I want those so I don't have to cram everything into the same UV space Razz.
Ditto! Because redoing an entire map because you forgot of something important or just felt like adding something isn't fun at all.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I'm with you on that, Rattle. Moreover, if we could use multiple textures, we could start building models out've modular parts, which would make providing a really nice, user-friendly model inventory for modders a lot easier :-)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

But you can already do that using lua. Have you not seen trepan talk about lua models? At one point eh even said it was faster. Lua does have OpenGL access after all.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

I support multiple textures per object.. for president...!
Post Reply

Return to “Art & Modelling”