Jump to content
  • Advertisement

Archived

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

SoaringTortoise

Texture performance question

This topic is 5633 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 am rendering a terrain using tiles for textures. I need exactly 256 textures to achieve what I am doing. At the moment I am storing these all in a single texture and just accessing sub-sets using the UV map. All is fine and works well. The thing is, the texture has to be 2048x2048 in size (giving me 16x16 textures, each 128x128 in size). I have a texture-detail LOD toggle that allows me to load the texture as 1024x1024 and it works fine, but does look really bad and low-res. So now, at the moment, I can render my terrain with a handful of draw-primitive calls (batches of VB''s) and only a single settexture call, because all tiles are drawn with subsets of the exact same texture. The other method would be to batch my primitives by texture and render them with several draw-primitives and possibly lots of settexture calls (up to 256 settexture calls assuming really wild terrain texturing). My current method is very fast and works flawlessly on the GeForce3 and GeForce4 cards I''ve tried it on. Obviously, on older cards it won''t work at all because of max texture size limitations. But, I read somewhere that even on cards that can handle 2048x2048 textures it''s still better to keep textures smaller. Does this apply here to my case, or is it better to keep the settexture calls minimal as I am doing? I guess the question is: Is the settexture call actually slow enough to warrant using only a single texture, or does the massive texture this implies slow it down to the point where it''s better to use multiple textures? Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Advertisement
NVIDIA wrote somewhere a technical paper where says that it is better to keep the textures in a size of 512x512.

Doing this and trying to keep your texture changes to a max of 16
can be a better way, besides you can target to older cards.

If God with me, Who against me?

Share this post


Link to post
Share on other sites

A massive texture with the polygons using small, random parts of the overall map and not using lots of the map does imply potential texel/texture cache misses:

http://www.gamedev.net/community/forums/topic.asp?topic_id=147722

So making sure that most of the map is actually being USED, and using mipmapping can make a difference.


The cost of a SetTexture call itself depends on a number of things such as:

- the specific chip and driver (for example 3DLabs have a technology called virtual texturing which only uploads the part of the texture actually in use).

- whether the texture is in video (or AGP) memory - if it has to be "uploaded" to the card then the upload cost is the most likely bottleneck. Using automatic texture management and the hint calls like Prefetch and SetPriority can help smooth this.

- a change of texture does mean that the chip has to stall and finish with all the polygons using the previous texture - though this is once again entirely hardware and driver dependent - the chip you''re using may in fact be treating multiple textures as one single texture anyway.

- whether another texture which may be required this frame has to be evicted to make room for the new map.

Avoiding too many SetTexture() calls is good, avoiding too many DrawPrimitive batches is good, avoiding too many texel cache misses is good.

But there isn''t a single, simple point where a few more batches is better or worse than a single texture - there''s too many other factors.

There''s really no substitute for adding some profiling code to YOUR app and maybe giving the end user an advanced option OR if you feel adventurous, do it automatically (i.e. when the app is first run, go for 100 frames with one method, then 100 with another, then pick which had the better frame rate on that particular users machine).


An alternative thing to do is have all of the small sub-textures as separate images and then compose larger textures at load time depending on the hardware caps.



--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Hmmm. I hadn''t thought of that last option (loading in chunks depending on caps).

The thing is, I was doing multiple textures and getting around 60fps. Then I converted to a single massive texture and I got up to 120fps. This was on my machine (GeForce4ti4600, 256mb ram and an AMD 1.8ghz). I then tested the same thing on a GeForce3, 128MB Ram and an Intel 1ghz processor and actually got 130fps (which I wrote off to my machine having a LOT of other stuff running like Antivirus, SQL, etc. but the GeForce3 setup being a fresh install).

So... with what is currently an entry-level type machine (the GF3 setup) it seems to work really fast, compared to using multiple textures. True, older machines can''t do massive textures, but... well... I was wondering if it''d be worth the compatability if it''s going to run at 1/2 the speed anyway. Thanks for the replies. Think I''ve made my mind up.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Sorry, also... it''s a fair bet that any randomly chosen part of the terrain will use an average of 1/4 the texture so there would be a lot of texturehit misses. On the other hand, chaotic terrain texturing or abrupt texture switching from one 1/4 to another would have zero additional penalty. I like that a lot.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
quote:
Original post by SoaringTortoise
I am rendering a terrain using tiles for textures. I need exactly 256 textures to achieve what I am doing. At the moment I am storing these all in a single texture and just accessing sub-sets using the UV map.


How do you deal with UV wrapping??

As for the minimum spec, the notion that an entry level machine has GF3 is game programmer wishful thinking. The entry level machine is some crappy 845G integrated video, or, at most, a GF4MX420.

Share this post


Link to post
Share on other sites
I don''t particularly care about UV wrapping for the type of terrain I''m using. This isn''t for a first-person shooter where view-distance is critical, it''s more for RPG/RTS perspectives where texturing and texture blending is more critical. The way I have it, I can have multiple different types of blends (hard for road-edges, soft for organic, soft & wavy for mulch, jagged for rocks, etc.) Plus, each quad on the terrain can contain a different variation of the same texture to reduce repetition.

My massive texture is made up of 16x16 cells. The first row number is used to give me up to 16 variations of the same texture (i.e. sixteen different grass textures, with different ornamentation... rocks, cracks, flowers, etc.). The second row gives me the required 14 blend pieces, plus 2 left over that I scavenge for cliff facing. This allows me to have up to 8 unique terrain textures for any given map (plus a further 16 for the cliff faces). All the meshes use standard texture assignments.

Then, on top of that, I use an almost identical texture to give me a bump-map. This means that I can use a single UV coordinate on my VB to give me the texture and the bump... which is really cool. The program I wrote to generate the massive textures, also does random placement of the ornamentation (cracks, rocks, flowers, etc.) to give me the variation, plus it paints a normal map of the ornament to the bump map so... anyway, it looks kind of cool, it''s really easy to work with and I''ve got excellent speed on GF3.

UV wrapping in my case would actually be a disadvantage because I rely on the 16 variations to create less repetition whereas wrapping would just increase it.

I saw a post earlier asking how to do texture wrapping with subset quads (was that you?). I don''t think it''s possible to do it with straight forward texture addressing. You would need to render to texture (or similar), then use the generated texture, which is going to slow you down a lot.


Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
As for the minimum spec... I don''t know anyone in my area who recently bought anything with less than 64mb on the video card (even the laptop folks). With the popular games coming out looking so bad on anything lower it''s hardly any wonder. I remember when Quake3 came out. No-one I knew even had a 3d accelerator. Within 3 weeks everyone did. Same thing now with Unreal2 and UT2003. Even the local internet cafe went through a major upgrade within days of its release. I''m only looking to be finished late this year, maybe early next year so... a minspec of GF3 is hardly unreasonable.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
This is off-topic regarding the subject, but I wanted to comment on what you regard as entry-level machine specs. Wherever you live must be really nice, because I only know two people who've actually bought video cards within the last year -- one of them is careless with his money and thinks that every new toy absolutely must be in his machine. The other was using a 3D Blaster Banshee prior to buying a TNT2. Of all the people I know: two now have TNT2's, one has a GeForce2 MX, one has a GeForce2 GTS, one has a GeForce3, one has a GeForce4 Ti4600 (the eccentric one), one has an ATI 9700 (very nice), and one has some obscure piece of crap that isn't worth half of my V770 Ultra.

Serious gamers with money will have GeForce3/4/FX chipsets. Everyone else has MX's or less. If you want to own the market, you really need to focus on casual gamers, because believe it or not, they're far more likely to pick up your game spur-of-the-moment than the hardcore gamer, who is only looking for that one specific genre that he really likes.

[edited by - Tom on April 21, 2003 12:15:26 PM]

Share this post


Link to post
Share on other sites
SoaringTortoise: I would have to agree w/ assen. I''m an avid gamer and I''m still using a GF2 TI. Several of my friends are also still on GF2''s. I''ve thought seriously about upgrading, but so far, I haven''t found a game that I couldn''t run well. When the next generation MMORPG''s get released later this year, I might upgrade.

If you''re planning to release your game this year to a large population of the public, I would definitely lower your minimum specs.

I''m working on a terrain engine also and have read a lot of your posts regarding your terrain''s evolution. Just curious.. do you have any screenshots?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!