Really Big Textures?

Started by
16 comments, last by Geometrian 11 years, 8 months ago
dpadam450 I am going to take my little knowledge and work with that, in my mind thats exactly what needs to be done and wouldnt be much processing either, although im not confident about my ability to pull it off lol.

Geometrain 12000x12000 is really large for a single image but not when it occupies 10 seconds or so of maneuvering from multiple points to and from multiple angles it can actually quite easily be alot more. Thanks for the concern but theres alot of data that we would like to have a 1to1 scale.
Advertisement
jeff8j, the only way you can get 1:1 scale is if a single piece of geometry is 12000x12000 in area, otherwise, it'll be down sampled by the hardware anyway.

but, let's say you absolutely have to(although i'm doubtful you can provide an actual valid reason that each pixel absolutely must be seen(and again, the hardware will downsample via nearest/linear mapping based on MAG and MIN filters to screen space for your texture anyway),

what you need to do is what dpadman said:

upon loading the texture, split it into several tiles, let's say 4096x4096, this means a total of 9 tiles in a row major format, where the mapping between each tile is 0-4096/12000=0.3413.

so, in the pixel shader, you take the input uv, from the original modeal and do something like:


sampler2D TexTiles[9];
vec2 inputUV;
vec2 UVMap; //0.3413 for both u/v.

void main(void){
int xtile = floor(inputUV.x/UVMap.x);
int yTile = floor(inputUV.y/UVMap.y);
sampler2D MappedTile = TexTiles[xTile+yTile*3];
vec2 mappedUV = vec2((inputUV.x-xtile*UVMap.x)/UVMap.x, (inputUV.y-ytile*UVMap.y)/UVMap.y); //get the inputUV into the tile range, then divide by the maximum size to map between 0-1.
vec4 Texel = texture2D(MappedTile, MappedUV);
}


anywho, that's what my pixel shader would probably look like, but i doubt i'd ever build a game that absolutely relied on such ridiculously sized textures.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Well it should be 1:1 it just wont be all visible so not all 12000x12000 but 1920x1280 give or take would be visible and be 1:1 although still probably not exactly the same.

I havent yet started on the code to break the texture apart but that looks like it will help out alot thank you.

If you had a big structure that played a major role how would you go about building it then besides using such a huge texture? Would you break it down into levels or something arbitrary of that nature? For us that would make it harder to edit because its not like a building made of squares that can be equally separated. Thats why I was wondering if something could break it down in software not necessarily at run time.

Well it should be 1:1 it just wont be all visible so not all 12000x12000 but 1920x1280 give or take would be visible and be 1:1 although still probably not exactly the same.

I havent yet started on the code to break the texture apart but that looks like it will help out alot thank you.

If you had a big structure that played a major role how would you go about building it then besides using such a huge texture? Would you break it down into levels or something arbitrary of that nature? For us that would make it harder to edit because its not like a building made of squares that can be equally separated. Thats why I was wondering if something could break it down in software not necessarily at run time.


it sounds like your doing a perspective projection setup for your camera, so again, how the texture is filtered before it reach's the screen means that you won't ever have a 1:1 projection:screen space, the only way is via ortho projection, and it doesn't sound like this is an ortho simulation.

for your question, you say this is a game, I wouldn't build my editor to be bound to loading a single huge model/texture, this is absolutely horrible in terms of performance, you would have practically no method of culling large piece's of offscreen geometry, because all of the geometry/level sounds like it's one huge model(although i could be wrong, but this is what i understand from what i've read). I would never build a game in such a way, instead, the level would be broken up into chunks, and managed in such a way that i can create a nice bsp tree. as such, i could then have my modeler break the 12000x12000 texture into several pieces, to be mapped over several objects.

either way, without more information about what you are doing, we can't suggest a better approach/method, all you have told us is that it's a large model and texture, it's still a game, and it's viewed from several viewpoints. what is it?, why is it so difficult to be broken down manually? what are you trying to accomplish?
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

The only excuse I can think of for a texture that large is raw medical or scientific survey measurements. And even that should be reduced before going on a screen. You don't have 12000x12000 pixels on a monitor, so it's just plain pointless to have that much data.

-G


It is not pointless to have a lot of data. I regularly work with data that is dozens or hundreds of Gigabyte in size and all of it is needed. The important point is: not at the same time. The same goes for the OPs problem. If he just needs a wide shot from the distance of his ship, then, yes, he could just downsample his data. A lot. But if he needs detail images of his ship he will need the full resolution texture (or more accurately: small subsets of the full resolution image at any one time). That is what LoD concepts are about after all.

If you had a big structure that played a major role how would you go about building it then besides using such a huge texture? Would you break it down into levels or something arbitrary of that nature? For us that would make it harder to edit because its not like a building made of squares that can be equally separated. Thats why I was wondering if something could break it down in software not necessarily at run time.


If an object is so big that it needs a texture of that resolution then the object will be too big to be seen on screen at once in all that detail.
Therefore your object is the problem because the object is too big.

Large structres in games are made up of smaller substructures so that we can cull the chunks which aren't visable at any given moment and only process those which are.

For example, lets say you had a huge castle in the world. This would not be made as a single model instead various walls, ramparts and turrets would be made seperately and then placed together to form the final world object.

If you built the model as one solid object then you can only visibility test against that one huge object. Lets say the castle is 3 million verts in size. Now lets say you can only see the tip of the top of a tower - in the 'huge model' method you now have to submit and run the vertex shader for all 3 million verts (give or take depending on reuse) where as with a broken up model you'll end up submitting only the tower segement which might only be a few thousand verts at most.

The long and the short of it is you are not going to need a single model of such a size that it will need a single texture map of that size; if you have a model of that size then you'll want to break it up.

Doing otherwise is going to cost you performance AND, as you've discovered, is physically impossible to do in many cases.
I might sound a bit simple, but the way you described those specific scenes makes me guess that those are cutscenes. If it's so, and you really need a texture this size, you could consider prerendering the scene. With the right settings, you could even make it look similar to an engine render. It would add the hassle of using a video decoder and displaying it, but this might be still easier than getting a 12k*12k texture working properly on the desired range of machines.
Also, as written above, breaking the model itself can be a nice idea too. This could work best if you had reusable parts of your object. This way you could get over redundant mesh data ( only store each element once ). The texture issue would be realigned - you would have to texture the individual parts. You would have small individual textures that would easily fit into the GPU. Also, the clipping issue would be conveniently solved.

Edit.: Forgot to mention that rendering takes some time, depending on your cutscene's length, complexity and your rig. Expect it to be somewhere from a few hours ( for 10-30 sec ), to a few days ( for 10-20 minutes ). However, these were just guesses based on my experiences. I own a not too competent machine.

[quote name='Geometrian' timestamp='1343707161' post='4964696']
The only excuse I can think of for a texture that large is raw medical or scientific survey measurements. And even that should be reduced before going on a screen. You don't have 12000x12000 pixels on a monitor, so it's just plain pointless to have that much data.

-G


It is not pointless to have a lot of data. I regularly work with data that is dozens or hundreds of Gigabyte in size and all of it is needed. The important point is: not at the same time. The same goes for the OPs problem. If he just needs a wide shot from the distance of his ship, then, yes, he could just downsample his data. A lot. But if he needs detail images of his ship he will need the full resolution texture (or more accurately: small subsets of the full resolution image at any one time). That is what LoD concepts are about after all.[/quote]I should clarify, that's what I meant when I said "that should be reduced before going on a screen." If your data is too large to even fit on your graphics card, that's an excellent indication that you need to do CPU processing to transfer the relevant bits only. However, I maintain that, while over time a large amount of different data might be loaded and displayed, a large amount of data in a short time is almost always unnecessary.
Geometrain 12000x12000 is really large for a single image but not when it occupies 10 seconds or so of maneuvering from multiple points to and from multiple angles it can actually quite easily be alot more.
I think the absolute worst case scenario for something like this is a REALLY up-close fly-through of a REALLY detailed model. You can imagine a quad with your texture mapped onto it, and then looking along one of the diagonals. Nearly all the data is visible, but most of it is minified. The problem is that there's not really a hard distinction between levels of detail--you blend mipmap levels for this. Another worst case is looking at that quad from above as a scale of about 1:1, then rapidly panning around the texture area. Breaking up the model into pieces will help, but you can still get worst cases like these.

If you really need every part of a fully, 100% contiguous texture that doesn't fit in texture memory, by definition, you're out of luck. You can get "all" of that detail at once by paging mipmap level texels in as necessary. This makes things more complicated, and again makes filtering (e.g. mipmap blending, anisotropic filtering) hard if not impossible.

I still feel like we're asking the wrong questions, though. Seriously--you need a 12K texture for an object? The largest unpaged texture I have ever seen in a game is 8K (the hardware limit), and that was a hack to demonstrate how ridiculously useless it was. It's OK to have smaller textures. Will a 2x or 3x reduction really hurt that much? There ARE situations where that kind of resolution is warranted (offline rendering, maybe), but unless you need cinematic-quality rendering, you're barking up the wrong tree.

Maybe you DO need that much resolution. But do you really need information, or just detail? Procedural texturing uses next to no memory, and because texture samples are into smaller images (for lookup tables), it's cache-coherent and faster than sampling the actual data. If the state is small enough, you don't even need (texture) lookup tables at all! You can make a hybrid approach where you sample a more reasonably-sized texture, and then add as much detail as you want with some noise. This works so well that offline renderers often do that instead of making huge textures (memory efficiency pays off on the CPU too!). Every major renderer has procedural texture support for this exact reason. Don't forget, Perlin noise was invented to solve this problem!

Maybe you DO need that much resolution because your texture is broadband noise, doesn't have a nice Fourier decomposition, and so recreating it with noise is out, or maybe you just can't add noise instead because every single subpixel-sized texel must be exactly right for some reason. Maybe you just need to view five orders of magnitude of texture all at once. In these cases, even if you can figure out a way to robustly figure out which texels are necessary, page them in from RAM and render them, you're still talking about processing and transferring up to hundreds of megabytes of texels every few frames--a gigabyte or so per second if you really have a bad case. It's possible, but that will start eating up a lot of your CPU and GPU time just on data transfer. Many applications fail--I have seen games where clumsily-paged textures lead to LOD jumps (not in geometry but in texture). This is disconcerting and distracting. Setting the texture resolution smaller fixes the problem. There are no jumps, and the game plays smoothly. Even if a pixel here or there could be more detailed, it is immensely better not to have the little pops all over the place.

So maybe you DO need all that resolution, and you can't recreate it with noise--now you've figured out a way to rapidly page texels in and out of CPU and GPU memory--maybe with PBOs so it's somewhat asynchronous and doesn't hurt too much, and it works robustly and is miraculously realtime. What have you gained? You can display so much information that it's silly--humans can't differentiate small changes in data changing at more than about two times per second. Your model is rendered with much more detail than is needed. If you paused the moving camera and looked closely, admittedly you could see a pixel or two that are different--the higher resolution one looks better, yes. Maybe you're zoomed in and huge sections of texture space are magnified. That would point to a LOD problem (which is beside the point)--but hey, the texture is maybe twice as detailed in each direction, so you win, right?

In sum:
-I am almost certain that you don't need a 12000x12000 texel texture, even without knowing exactly what your application is.
-Even for the most demanding applications, you still almost certainly don't need that much--you can recreate it MUCH more efficiently (and often, better) using procedural/hybrid techniques.
-This problem occurs frequently in industry, because people want "higher resolution" everything. It's a natural desire, but it is almost always an insignificant one. In nearly all cases, there is minimal perceptual difference in even large resolution improvements, simply because the display technology and the human eye can't keep up. Even if you succeed in making most of your scene's textures more detailed, it usually doesn't even matter because you kill your framerate and you get LOD pops--which is just not an improvement.
-On modern graphics hardware, it is (usually) possible to page texels in and out of memory fast enough to keep up with non-pathological cases where textures don't fit into memory, assuming minimal other work is being done on both the CPU and GPU. If doing it is still somehow absolutely critical, you might be better off looking into realtime CPU raytracing.
-A texture about half the resolution in both dimensions (4096x4096) avoids all the above problems. For magnified pixels, of which there are usually none, it looks maybe half as good--but in return you get portability, high framerate, robustness, elegance, and simplicity--and it's still ultimately high-quality. I strongly recommend using 4096x4096 as a maximum, and (for only the most extreme of circumstances), add procedural noise.

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement