Re-done PIEs

Improving the artwork in Warzone2100 - not for mod discussions
User avatar
kage
Regular
Regular
Posts: 751
Joined: 05 Dec 2006, 21:45

Re: Re-done PIEs

Post by kage »

Kyor wrote: In my new textures project, all textures are 1024*1024 with 32bit colors... I'm replacing the textures with extremelly real textures, then, you think the graphics are cool even if the zoom are maxed =]
hmmmm... mip mapping support might be good as a possibility
Giel
Regular
Regular
Posts: 725
Joined: 26 Dec 2006, 19:18
Contact:

Re: Re-done PIEs

Post by Giel »

kage wrote: i see... so if the pie asks for a 256 256 texpage, and the texpage is actually some multiple of two that's larger than that, warzone will automatically adjust texture coords as necessary?
Correct, warzone will, PIEslicer won't so you just have to "fool" PIE slicer by handing a 256x256 texture to PIEslicer while using for example a 1024x1024 in game
kage wrote: what if you have the pie ask for, say, a 512 512 texture?
I believe that all texture coordinates are relative to the size specified in the PIE file, so if you specify a PIE file of 256x256, a coordinate set of (48,64), (112,192) will be (on a 0 to 1 range): 48/256=0.1875, 64/256=0.25 => (0.1875, 0.25), 112/256=0.4375, 192/256=0.75 => (0.4375, 0.75). OpenGL then calculates these values back to the texture file that is loaded for real. I'm not sure but I think that if you specify a texture size (in your PIE file) of 512x512 this will result in all coordinates being divided by 512 instead of 256, so they'd have to be relative to 512 instead of 256 then.
kage wrote: also, what's the largest supported texpage resolution atm?
I believe it is 2048x2048, but that is probably overkill (in terms of performance, not graphics quality). 1024x1024 is a sane maximum.
"First make sure it works good, only then make it look good." -- Giel
Want to tip/donate? bitcoin:1EaqP4ZPMvUffazTxm7stoduhprzeabeFh
User avatar
eikei
Rookie
Rookie
Posts: 25
Joined: 08 Oct 2006, 16:04
Location: Kyiv, Ukraine
Contact:

Re: Re-done PIEs

Post by eikei »

... i think that "white logo" is the project logo, and if so, i think it's a really damned stylish representation, so i'm personally in favor of keeping it exactly as it is, or leaving it to eikei's discretion.
The white logo is really the project logo or maybe it looks like it :)
But as far as i know there's still a limit to the amount of texpages warzone can read. As long as that's not replaced, we can forget about making separate textures for each model.


And what is the limit? Nevertheless it's possible just to use the textures like original but with reslution 1280x1280 for exumple or even larger. (I didn't know that wz can automatically correct the textures coords). Then it is possible to place for exumple all new detalized body textures to one large PNG file.
Sorry for my English:)
Giel
Regular
Regular
Posts: 725
Joined: 26 Dec 2006, 19:18
Contact:

Re: Re-done PIEs

Post by Giel »

eikei wrote: And what is the limit?
I think 64 textures.
eikei wrote: Nevertheless it's possible just to use the textures like original but with reslution 1280x1280 for exumple or even larger. (I didn't know that wz can automatically correct the textures coords). Then it is possible to place for exumple all new detalized body textures to one large PNG file.
You mean to dump textures for multiple models into one texture page? I personally am in favor for not doing this since it is difficult to maintain such textures.
"First make sure it works good, only then make it look good." -- Giel
Want to tip/donate? bitcoin:1EaqP4ZPMvUffazTxm7stoduhprzeabeFh
User avatar
eikei
Rookie
Rookie
Posts: 25
Joined: 08 Oct 2006, 16:04
Location: Kyiv, Ukraine
Contact:

Re: Re-done PIEs

Post by eikei »

That's righr. Of curse it would be better to use different texture for each object as i've allready said. It is necessary to check how many textures wz supports. And then change the limit - i'm not a programmer, so you know better how to do it.
Sorry for my English:)
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Re-done PIEs

Post by Watermelon »

Giel wrote: I think 64 textures.
You mean to dump textures for multiple models into one texture page? I personally am in favor for not doing this since it is difficult to maintain such textures.
storing all textures of a 'component type' is the only feasible approach,since we have limited texture pages.Though per-component texture page is very inefficient,because it has to bind texture for number of components types times(at least 3 times).Per-model texture will be the best solution,but unfortunately it will require redoing all exist pies and re-texturing all the newly created ones,which is a bit unrealistic in the foreseeable future.
tasks postponed until the trunk is relatively stable again.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Re-done PIEs

Post by DevUrandom »

Giel wrote: I believe that all texture coordinates are relative to the size specified in the PIE file, so if you specify a PIE file of 256x256, a coordinate set of (48,64), (112,192) will be (on a 0 to 1 range): 48/256=0.1875, 64/256=0.25 => (0.1875, 0.25), 112/256=0.4375, 192/256=0.75 => (0.4375, 0.75). OpenGL then calculates these values back to the texture file that is loaded for real. I'm not sure but I think that if you specify a texture size (in your PIE file) of 512x512 this will result in all coordinates being divided by 512 instead of 256, so they'd have to be relative to 512 instead of 256 then.
This is wrong. Warzone totally ignores the texture size in the PIE file and assumes the texture coordinates to be in the range of 0..256 everywhere. For reference see lib/ivis_common/imdload.c:151 and lib/ivis_opengl/screen.c:176 (r1223)

It works this way, because OpenGL expects texture coordinates to be in the range 0.0f..1.0f with 0.0f being the bottom (or left) side and 1.0f the top (or right) side of the currently used texture. This makes texture coordinates independend of the actual texture size (resolution).
Since the PIE format does not support floating point values and additionaly all PIE files use a texture size of 256x256, the texture coords were internally scaled up in the drawing process when porting the renderer to OpenGL. This might eventually change with 2.1 (no official decision is made, yet).
Giel wrote: I think 64 textures.
This limit could probably be raised easily, since it is only a #define somewhere in the sources and not some limit of OpenGL or the hardware.
Watermelon wrote: Though per-component texture page is very inefficient, because it has to bind texture for number of components types times (at least 3 times).
Yes, that is an issue. The drawing process could perhaps be changed to order by turret/prop/body types, but still this would require a fair amount of texture binding.
On the other hand per component textures are much easier to handle, since you can easily exchange the texture for just one component.

Best is probably to:
- Evaluate the costs of texture binds on different video cards
- Check whether we can try to predict the type of components on the screen (and thus take a mixed approach, by having eg. certain propulsion types on one texture page)
- See if there is any benefit in rearranging the textures dynamically into texture pages upon loading (while they are still seperate on the hard drive)
Last edited by DevUrandom on 02 May 2007, 12:59, edited 1 time in total.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Re-done PIEs

Post by Per »

Hatsjoe wrote: But as far as i know there's still a limit to the amount of texpages warzone can read. As long as that's not replaced, we can forget about making separate textures for each model. :(
That limit can easily be increased. Let me know when you hit it, and I'll fix it.
"Make a man a fire, you keep him warm for a day. Set a man on fire, you keep him warm for the rest of his life."
Giel
Regular
Regular
Posts: 725
Joined: 26 Dec 2006, 19:18
Contact:

Re: Re-done PIEs

Post by Giel »

DevUrandom wrote:
  • See if there is any benefit in rearranging the textures dynamically into texture pages upon loading (while they are still seperate on the hard drive)
I'm pretty sure this falls very easily in the category of premature optimizations. (Will require a lot of code and probably only provide a small gain.)

Simply appending propulsion, body and turret textures into one big texture might be easier than rearranging while providing a similar gain in speed.
"First make sure it works good, only then make it look good." -- Giel
Want to tip/donate? bitcoin:1EaqP4ZPMvUffazTxm7stoduhprzeabeFh
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Re-done PIEs

Post by DevUrandom »

Giel wrote: Simply appending propulsion, body and turret textures into one big texture might be easier than rearranging while providing a similar gain in speed.
I'd like to know what you mean by "appending".
Also keep in mind that since they are in different files, they might be in different sizes as well. What leads me to the conclusion that you have to arrange them somehow, one way or the other.
User avatar
Hatsjoe
Trained
Trained
Posts: 285
Joined: 20 Feb 2007, 19:57

Re: Re-done PIEs

Post by Hatsjoe »

Giel wrote: I'm pretty sure this falls very easily in the category of premature optimizations. (Will require a lot of code and probably only provide a small gain.)

Simply appending propulsion, body and turret textures into one big texture might be easier than rearranging while providing a similar gain in speed.
Ok, i want you to look at it from another pov :)

Let's assume we use a single 2048*2048 png texture file for that includes the textures for all the for all the weapons.
Now let's say mister X creates a mod in which he replaces textures on the smg. His mod will be about 3 MB in file size.
You wouldn't have this problem if the smg used a seperate 128*128 png.
Image
User avatar
kage
Regular
Regular
Posts: 751
Joined: 05 Dec 2006, 21:45

Re: Re-done PIEs

Post by kage »

DevUrandom wrote: I'd like to know what you mean by "appending".
Also keep in mind that since they are in different files, they might be in different sizes as well. What leads me to the conclusion that you have to arrange them somehow, one way or the other.
yes, choosing not to arrange them would create more problems than the simplicity would be worth, since you'd have to require that all texpages be the same size.

but as long as they're all power-of-two textures, arranging isn't too much of a problem. if you look at:
Image
(linked from http://en.wikipedia.org/wiki/Mipmap)

you can see a vague example of what this might look like (though each piece of that would presumably be a different texpage), and a relatively simple algorithm could be used to arrange those (assuming that all texpages are square), after sorting them by size. you could then put compile-time options, probably in the ./configure script for *nixes, and whatever else for windows, that specify the maximum resolution on a side of the clumped texture to be created at runtime, which should also be a power of two -- when one clumped texture is filled, a new one is created and populated.

the biggest issue with this option is texture management -- if any code was added to warzone to detect the greatest possible tech that can be achieved in a mission, and only load those textures that could possibly be displayed, than dealing with clumped textures would be not so simple. of course, given the way textures are currently stored and loaded, texture management like that isn't practical, but in the future, it might be...
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Re-done PIEs

Post by Watermelon »

Per wrote: That limit can easily be increased. Let me know when you hit it, and I'll fix it.
hmm do you think we should increase that cap to a number that is big enough for all potential texture 'pages'?

I think the per-model texture wont work out because the combination of 3 core components:weapon,body,propulsion is unpredictable,unlike other RTS games with fixed units type and limited number of variants of a unit...
tasks postponed until the trunk is relatively stable again.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Re-done PIEs

Post by DevUrandom »

Well, there you need it again: Texture arrangement.
The texture will not always be of halved sidelengths, there might be several textures of the same size, or a lot of big ones, or a lot of small ones. You all need to get them into a sane order.
For the best result you might want to guess which textures will be possibly used at the same time, so you can put them on one page. What would make it again slightly more complicated.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Re-done PIEs

Post by Watermelon »

DevUrandom wrote: Well, there you need it again: Texture arrangement.
The texture will not always be of halved sidelengths, there might be several textures of the same size, or a lot of big ones, or a lot of small ones. You all need to get them into a sane order.
For the best result you might want to guess which textures will be possibly used at the same time, so you can put them on one page. What would make it again slightly more complicated.
heh that is impossible in warzone,to make warzone not to change texture per unit,you will have to include all bodies,all weapons,all propulsions in one page,which will be well exceeded 2048x2048 limits.
tasks postponed until the trunk is relatively stable again.
Post Reply