Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture performance question

Started by SoaringTortoise Apr 21, 2003 at 8:28 AM 12 replies 500+ views
Original Post
SoaringTortoise
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. 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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
NeonGE
NeonGE
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?
--------------------------------------------- If God with me, Who against me?Personal Web Samuel Prince Blog...
S1CA
S1CA

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
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
SoaringTortoise
SoaringTortoise
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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
SoaringTortoise
SoaringTortoise
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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
assen
assen
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.
SoaringTortoise
SoaringTortoise
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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
SoaringTortoise
SoaringTortoise
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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
Tom
Tom
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]
GDNet+. It's only $5 a month. You know you want it.
bpopp
bpopp
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?
SoaringTortoise
SoaringTortoise
Absolutely, but no server to host them on right now. Email?

MMORG''s aren''t my target area anyhoo. Think more along the lines of C&C Generals, WarcraftIII, Dungeon Seige, NeverWinter.... While they will run on older cards, they are dog-slow so most of the folks I''m with just upgraded.

Learning to fly is easy, but as a tortoise, the landings are really rough.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
SoaringTortoise
SoaringTortoise
Sorry Tom, missed your post there.

I do agree with you about casual gamers. Thing is, I'm not making a casual game - I'm going all out for something as sophisticated as I can get. Market domination will come with my second or third title :-)

Where I live, a half-decent video card (like a GF3) will cost a mid 20's professional almost a month's take-home salary. The folks just keep on buying them up anyway. Says a lot about the other entertainment available to us, eh?

Not only that, but the oldest card I can get my hands on in a Voodoo 5 with 32MB. My engine runs quite fine on that with all the detail cranked down. A little slow, but you can tweak the engine parameters till it works at around 20 fps... which is still faster than I can get Dungeon Seige to do. Still, with minimum detail you're looking at no bump-mapping, minimal texture resolution and about 40 meters view-distance.

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

[edited by - SoaringTortoise on April 21, 2003 3:46:04 PM]
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
SoaringTortoise
SoaringTortoise
Hang on, here''s some screenshots. Forgot I had them.

Old Pic to show Geometrical Density
Old Pic
Isometric View
Same shot in wireframe
Same shot, flatter perspective
Reverse view with a particle effect running
Some of the particle properties you can set
The Critter Editor
A close-up of the texture blending (to show non-linear texture blending)

Please excuse the quality of the graphics - they are still very much in-production. Mostly what I''m trying to show here is the amount of visual detail I could achieve with VB 6.0 (see bottom of the other thread for more).

Learning to fly is easy, but as a tortoise, the landings are really rough.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
bpopp
bpopp
SoaringTortoise: sweet.. I''d love to see them. You can post them to this thread on my site:

Terrain Rendering Newbie (Not that you''re a newbie.. this is where I''m journaling my progress)

Just add a comment (at the bottom) and include one or more [img] tags somewhere in the text. After hitting submit, another page will prompt you to upload one image and a caption for each [img] tag. I''m not currently scaling, so keep the size down to under 640x480 or so.

Or, if you''de rather not post them publicly, you can email me @ bpopp -at- midsouth.rr.com.

bpopp (bpopp.net)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.