I have some advanced models one in particular has a 14mb png texture which opengl does not like but being the only thing showing can handle the model just fine and I think can handle it with textures just not 1 big one.

I am far from a 3d modeler so have no clue about the best way to do this but I would assume there is a way to break the giant texture into smaller gpu friendly textures how can I do this? I use blender for tinkering although im up for anything.

simple downsampling is not suitable? breaking texture into multiple pieces can be hard depending on how UV are mapped to the model. If you have only a terrain that's fine and simple, more complex models will make things harder if not impossible. You can split the texture into 4 textures and remap UV to 1 to 4 different sets of UVs. That will need a shader and 4 textures used at the same time. So input of the vertex is always a UV set (you don't need to change UV). But instead of using 1 texture unit you use 4 textures units (each one with 1/4 of the original image)

When UV is in the first quad you scale it by 2 and use first texture newU= 2*U; newV=V*2;
when UV is in the second quad newU = U*2 -1; newV = V*2;
When UV is in the third quad newU=U*2; newV = V*2-1;
When UV is in the fourth quad newU=U*2-1; newV = V*2-1;

quads assumed in this order

1 2
3 4

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!

Downsampling will work but im looking to get really good detail out of the object and downsampling to something like 1024x1024 will quickly deteriorate quality as its a big model. I do think that I will give it a try though just too see.

Hmm I dont think breaking it down manually is an option as its a mesh/model not something easier like terrain and its lots triangles so far out of my knowledge.

Theres no way something like blender or 3d studio max can take a max texture size and then break it up accordingly? It makes no difference how its broken up to me I just want to show it and fly through the model I dont need animation or anything.

I have some advanced models one in particular has a 14mb png texture which opengl does not like but being the only thing showing can handle the model just fine and I think can handle it with textures just not 1 big one.

What is the texture size? What does opengl does not like it mean? Are you using DXT compression?

Hi jeff8j, do try to be as specific as possible about errors. The nature of the error affects what solutions people will offer. Is there a code error? The object appears black? The texture looks distorted? If there is a visual artefact, a screenshot of how it looks in your game vs in the modelling program may help.

Kill whoever built it. max texture size is 8192x8192 unless it got bumped up even more that I dont know of. But that doesnt matter, no texture for an object needs to be that big.

Downsampling will work but im looking to get really good detail out of the object

I've seen plenty of detail out of 2048 textures, most of the time not needed 4096 textures. I would post a pic because that doesnt make any sense. Unless you plan to in game hold a microscope and zoom it in 10x.

If for say a gigantic spaceship, then this should have been built with multiple uv textures/uv coordinate sets. So each section would be a separate model/texture. If you need tiny detail, multiply a tiled black and white detail map and blend that with the other lower res textures. Or do the same: tile a detail normal map over the object.

Its only used for specific scenes that will pan across the outside of the ship where the game itself takes place inside so no performance concern because at max were talking the ship and a few other smaller things in the scene at once. Im for the sections was hoping for an easy way to achieve them with software rather than me messing with the model.

Chop your image up into square sections that are 2048x2048 with the end sections only carrying whatever is left.
Take the uv coords 0 to 1, and mutliply them by 12,000. Then convert them to 0 to 1 for each section. Do some math and convert pixel coordinate x = 2048, y = 2048 = 1,1 for tile 0,0. x= (2048 + 1024), y = (2048 + 512) = .5,.25 for the texture tile 1,1

8192x8192 is REALLY large. Even modern games don't typically exceed 2048x2048, and most get by on MUCH less (shadowmaps, for instance, are often 512x512). I have seen demos (e.g. NVIDIA's human head) that produce very very high quality results with 4096x4096, and that had a lot of sampling.

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

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.

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.

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:

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?

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.

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.

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.

Edited by Geometrian, 31 July 2012 - 11:25 PM.

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.