Texture size problem

Zini

17-10-2007 09:10:19

Now I am getting a crash on startup:

Exception: OGRE EXCEPTION(1:): The texture is not large enough to fit all widget
images in QuickGUIImageSet

I have modfied the original textures only slightly. No idea, if that changed the size.

kungfoomasta

17-10-2007 17:17:54

The SkinSet Texture size is 1024 x 1024, and is laid out row by row. If you have a few images that are very tall, this will make the row very tall, and could potentially use a lot of space.

Most of the textures used in the default skin can by very small, for example 5 x 5 pixels. I haven't reduced them, but the textures are not complex, and they stretch to fit the part they represent.

I will see if I can alter the exception to output the generated texture, so you can see what is happening.

Zini

18-10-2007 09:28:55

Apparently it was the panel background texture, that caused the problem. I removed it, since I don't really need a special background for panels.

I am fine with this solution for now. But I think something will have to be done about it later. Maybe an option to have the available textures scanned at startup and calculate the skin set size from it? Or if that is too complex at least an option to configure the size manually at startup?

kungfoomasta

18-10-2007 17:10:36

You're right, I realized this last night. Currently the images are taken in and sorted according to height. The skinset texture is created in rows, so if you have a short texture and tall texture in the same row, the row size will match the tall texture, and some space will be wasted. In the future I'm thinking of rebuilding the texture at 2048 x 2048, instead of throwing an exception, etc. I should make a function to output the image file, since I already wrote the code to do it.

Not sure how we can better automate creation of the skinset, in terms of texture placement for optimal fit. I really don't want to go down the CEGUI Imageset route, where the artist has to edit xml and specify the locations of all the images. Its conveniently done transparently..

tuan kuranes

19-10-2007 13:28:33

I just updated scrollbarvertical.png size from 600 height to 594 and it works nice at 1024.

I really don't want to go down the CEGUI Imageset route, where the artist has to edit xml and specify the locations of all the images. Its conveniently done transparently..

Well, cegui has a nice working imageset editor
Perhaps both way would be good, automatic and preGenerated, so that it gains in loading time. no need to rebuild each time... (but please no XML, a .cfg is ok.). Can help once you made design decision (what to store in cfg file ? x, y, w, h, rotation, etc...)

kungfoomasta

19-10-2007 17:17:41

That could be a good option as well, for already provided SkinSets.

JohnJ put up a scripting parser on the wiki, I was thinking of looking into that, and getting it to a state where it can write data (right now only reads). What I need for each image:

1. starting/left x position
2. starting/top y position
3. width
4. height

With these I can calculate the UV coords for each image, which is the main functionality of the SkinSet, other than having all images in one larger Image.

tuan kuranes

19-10-2007 17:55:50

You mean that one, I guess ?

Seems a good idea to me.

I would say rotation is mandatory, not
it would allow better packing (if user pack himself, everything is permitted) but it would aslo allow to get rid of vertical/horizontal dupicates of element ?
(twice less scrollbars texture space, four time less arrow texture space, etc...)

Do you think quickGui is mature enough to be the gui used to be the imageset editor, or we just reuse convert imageseteditor to wxwidget/quickgui instead of wxwidget/cegui ?

kungfoomasta

19-10-2007 18:18:50

Oh, you want to make an actual image set editor! It sounds good, but will be quite a bit of work.

I'm trying to make QuickGUI robust and mature enough to be a solution to editor needs by itself! :wink:

But if its at that current state, I haven't tried.

Rotation is a smart idea to conserve texture space. It would have to become a widget property, since I would need to make sure the rotation occurs for each texture. For example, 3 states of a button:

Normal - "qgui.button.png"
Mouse Over - "qgui.button.over.png"
Mouse Button Down - "qgui.button.down.png"

Under the hood, I change the texture to simulate the behavior of a button. When I change the texture, I'll also need to apply the rotation. But this is just background information, not necessary right now. :wink:

I'm not familiar with the CEGUI ImageSet Editor. For better or worse, I would probably pick the long, arduous route of making the Editor from scratch. Find out what people dislike about the CEGUI ImageSet Editor, what would be a good feature, and what are limitations... etc.

I have not even tried to use QGUI on multiple RenderWindows, although it should work in theory. So much todo!

kingdranix

20-10-2007 02:30:16

Hi, I got the same problem too. I got the latest version from the svn and the demo always crashes on startup. I haven't edited anything yet. Just compile, run and crash. Any idea how to fix this? Thanks in advance.

kungfoomasta

20-10-2007 02:44:23

Is there an exception thrown? Make sure you have the file "QuickGUI.output.png" in your resources, it is used to generate the SkinSet Texture upon failure. The actual output file is named "SkinSetImage.png".

Make sure your skin textures are updated, I reduced the size on a lot of them. I guess a SkinSet Editor is becoming inevitable.. lol.

kingdranix

20-10-2007 04:00:20

Yes there is an exception: "The texture is not large enough to fit all widget images." There is an output file called SkinSetImage.png which is 1024 x 1024.

I have taken latest version 1.96 and it still crash. I even made sure to delete the media folder to get the most updated textures.
I don't have QuickGUI.output.png in my resource. Am I suppose to create this and place in a resource folder?

Here's my output file:

kungfoomasta

20-10-2007 05:41:45

It looks like the file was created anyway.. strange. I guess I should tweak the exception to say what file was trying to be added at time of failure. I don't see the skin overflowing off that texture size, do you have any large textures that start with "qgui"?

[edit] revision 197 will tell you what texture was trying to be added, that caused the exception to be thrown. Please post the texture name and its pixel size.

Also, your exception should have looked different, since I updated it..

Should look like this in 197:

"Failed trying to add " + mTextureNames.at(i) + ". The texture is not large enough to fit all widget images. Please view \"SkinSetImage.png\""

[\edit]

kingdranix

20-10-2007 06:15:19

Now I get "Failed trying to add qgui.scrollbar.vertical.png".
The QuickGUI.output.png was created just now but I somehow missed it.

kungfoomasta

20-10-2007 06:21:28

And the dimensions of this image are?

kingdranix

20-10-2007 06:23:23

37 x 600
I just deleted it and it can run now.

kungfoomasta

20-10-2007 06:27:57

Sorry about this. I've set up my development environment a little differently, and was using a second set of qgui textures. I've updated SVN with the same textures I am currently working with.

kingdranix

20-10-2007 06:35:52

No problem. I'm glad I get to use your awesome gui instead of creating my own. :P

tuan kuranes

20-10-2007 10:32:16

Oh, you want to make an actual image set editor! It sounds good, but will be quite a bit of work.
Not that much. I'll start small, using actual quickgui auto skin mode, using naming conventions . user would just be able to autoload/save, resize, change, suppr part of created imageset.
Postponed :
- Rotation (needs under the hood support)
- Adding Texture to imageset (needs a file selection dialog)

I'll make a first version using Ogre script asap.

Rotation is a smart idea to conserve texture space. It would have to become a widget property, since I would need to make sure the rotation occurs for each texture.

Rotation is a start, I would say.
Opacity, Tint color, etc... properties should make its way in there to minimize texture size and maximize Gui customization using declarative mode (script) without making it too much procedural. (c++ code)

kungfoomasta

20-10-2007 13:24:51

Awesome. A file selection dialog would be pretty useful and I think I will have to end up making one for personal use, so I might as well at it to the library when that time comes.

I look forward to your progress, let me know if you have any suggestions/questions!

ititrx

19-02-2008 04:52:41

I am having this same challenge, over and over again. It keeps saying one image is the wrong size, yet its the same size as the original.

My question. How exactly does this thing work to produce that image.

Where does it start and end?

Start with the smallest? end with the largest? Does it go through a less than greater than routine? If so what is it?

It seem a witch hunt to find the texture that is throwing it all off. Who has time for that?

What is the algorithym in english not code, lol.

Its very frustrating. So I hope you can help. I checked your WIKI, but there isnt anything there.

Thanks. Hope to hear from you soon.

kungfoomasta

19-02-2008 05:47:35

Are you using the latest from SVN? I believe I put the name of the image in the error message.

If I remember correctly, this is the algorithm:

1. sort images from smallest to biggest size.
2. start placing images from left to right. At the end of a row, start at the beginning of the next row. The amount to go down is defined by the largest image on the row just placed.
3. Repeat Step 2. Throw an error if there is no room for an image within the space given.

If you are familiar with SVN I would update to the latest code, make sure to remove all previous images, and then delete the .skinset and Skinset*.png files, so that they get rebuilt next time you run the app.

ititrx

21-02-2008 03:50:42

Thanks for the fast reply.

Yes it showed the name of the image that didnt fit, however, thats not very helpful, since that image wasnt changed. Smile.

I did not compile this, it was given to us already compiled and part of the game/info/stuff.

I was just trying to create new images for our purpose. You know?

So, it would be really helpful, if after the exception, it would at the very least, build the set with what it has.

If you follow me? Then you could look at the set and see which image was large, one direction or the other to figure out where it was getting thrown off.

As someone before me said, they kept deleting some images till it worked.

Do you think you could make that change?

Thanks very much.

Later:

Do you have any pictures of the the layout of the UI? Do you understand what I mean...sorry,

Where all the buttons go, the bars, ets in the UI.

Thanks again.

kungfoomasta

21-02-2008 17:51:55

it wouldn't be hard to add this in, I just have to find the time. There is no layout, the images can go anywhere within the skin set.

ititrx

26-02-2008 18:59:01

LOL, thanks very much. That would help a lot, you could instantly see which image was out a wack. Smile.

What I mean about the picture, not of the skin set, but a picture of the UI in use... hard for me to find the correct words to ask you.

Just a screen shot showing where all those arrow buttons are used, and the bars, etc.. Does that make sense? All the pieces put together. Smile.

I looked around but couldnt find any?

OH, you have a new release, were you able to get that in the new release? Probably not, but had to ask. smile

Thanks again for all your help, I really appreciate it.