Nifty GUI performance issues

@normen said:
@pspeed said: No. You misunderstand the interaction between Nifty and JME. Nifty says: draw this part of this image, draw this part of this image, draw this part of this image, etc... for each of those, JME sets the texture coordinates, sets the transform of the quad, renders the quad... over and over. Effectively this is like having x number of quads.
Yes! You must be misinterpreting me talking about object count in the post you quote, I guess. I gave an example for a possible low-level / self-built solution for that quite some time ago in this thread.

Nehon said: “If they are different then they are updated. It cannot be otherwise.”

I said: “If they are different then they are updated. It cannot be otherwise.”

Both of us were talking about how nifty interacts with JME.

…then you said I was wrong. “But they are only different when the layout changes”

So I was correcting that. The texture coordinates change many times per frame. The same number as the number of partial images on the screen.

The low level solution is not to use nifty so that you can use a texture atlas since a texture atlas buys you nothing in nifty except some saved texture space maybe. It’s unclear whether 49 separate small textures or one giant texture matters much in this case since they can all fit on the GPU.

@pspeed said:

Nehon said: “If they are different then they are updated. It cannot be otherwise.”

I said: “If they are different then they are updated. It cannot be otherwise.”

Both of us were talking about how nifty interacts with JME.

…then you said I was wrong. “But they are only different when the layout changes”

So I was correcting that. The texture coordinates change many times per frame. The same number as the number of partial images on the screen.

The low level solution is not to use nifty so that you can use a texture atlas since a texture atlas buys you nothing in nifty except some saved texture space maybe. It’s unclear whether 49 separate small textures or one giant texture matters much in this case since they can all fit on the GPU.


Right, the texture coords, I lost you three at the 8th detail of the nifty implementation.

Still you now misinterpret me talking about Nifty again in the “low level solution” I mentioned, I talked about basically the same as you later did too, just with the extension of using an atlas instead of just jME Pictures. Nifty could just supply better id-ing for objects on screen that jME is supposed to draw to solve this “coord update problem” if it is one, I bet Jens wouldn’t mind thinking about it. They wouldn’t even have to be collected or anything beyond one frame.

@normen said:
@pspeed said:

Nehon said: “If they are different then they are updated. It cannot be otherwise.”

I said: “If they are different then they are updated. It cannot be otherwise.”

Both of us were talking about how nifty interacts with JME.

…then you said I was wrong. “But they are only different when the layout changes”

So I was correcting that. The texture coordinates change many times per frame. The same number as the number of partial images on the screen.

The low level solution is not to use nifty so that you can use a texture atlas since a texture atlas buys you nothing in nifty except some saved texture space maybe. It’s unclear whether 49 separate small textures or one giant texture matters much in this case since they can all fit on the GPU.


Right, the texture coords, I lost you three at the 8th detail of the nifty implementation.

Still you now misinterpret me talking about Nifty again in the “low level solution” I mentioned, I talked about basically the same as you later did too, just with the extension of using an atlas instead of just jME Pictures. Nifty could just supply better id-ing for objects on screen that jME is supposed to draw to solve this “coord update problem” if it is one, I bet Jens wouldn’t mind thinking about it. They wouldn’t even have to be collected or anything beyond one frame.

Everyone in the conversation was talking specifically about the nifty implementation now since it was recommended by someone to try using it to do atlases instead of just using JME directly. I pointed out that the nifty implementation is non-optimal for this case. nehon said he fixed that issue. I said no, not really and that it was basically impossible (given the current nifty->JME implementation it is impossible). He agreed… then you start correcting me. Is it wrong that I would assume that you were talking about the same topic we were?

Bottom line:

  1. an atlas is definitely the most optimal way to go.
  2. nifty can technically do an “atlas” but it provides no benefit over separate images.
  3. fixing nifty to handle atlases well is on no one’s to do list currently, requires changes (or some unknown level of impact) to nifty itself, and is a sizable change. ie: unlikely to happen in the near term. I agree that passing an ID or something means we could do something similar to the optimization done for bitmap text of the frame-coherent caching. I don’t believe it will happen soon enough to matter to the OP. I guess we could also create a texture coordinate keyed cache without needing a change to nifty… but how far backwards do we bend to match up two interfaces that don’t really mesh well together. Scene graphs were not meant to do immediate mode style rendering. At this point, I almost feel like everyone’s life would be better if nifty just gave us a texture for the whole screen, already rendered.
@pspeed said:

Everyone in the conversation was talking specifically about the nifty implementation now since it was recommended by someone to try using it to do atlases instead of just using JME directly. I pointed out that the nifty implementation is non-optimal for this case. nehon said he fixed that issue. I said no, not really and that it was basically impossible (given the current nifty->JME implementation it is impossible). He agreed… then you start correcting me. Is it wrong that I would assume that you were talking about the same topic we were?

Bottom line:

  1. an atlas is definitely the most optimal way to go.
  2. nifty can technically do an “atlas” but it provides no benefit over separate images.
  3. fixing nifty to handle atlases well is on no one’s to do list currently, requires changes (or some unknown level of impact) to nifty itself, and is a sizable change. ie: unlikely to happen in the near term. I agree that passing an ID or something means we could do something similar to the optimization done for bitmap text of the frame-coherent caching. I don’t believe it will happen soon enough to matter to the OP. I guess we could also create a texture coordinate keyed cache without needing a change to nifty… but how far backwards do we bend to match up two interfaces that don’t really mesh well together. Scene graphs were not meant to do immediate mode style rendering. At this point, I almost feel like everyone’s life would be better if nifty just gave us a texture for the whole screen, already rendered.

Gha, will you stop it? I agreed already on all of that, just not on the additional point you brought in, which is me suggesting adding atlases to nifty to solve OP’s issue, I never did that. This was to not further confuse OP about what the options are.

Your accusing sounding “started correcting me” is this little half-sentence that I took back when you told me the first time that I didn’t get its the texture coords you talk about FFS: “But they are only different when the layout changes”. Also that you can live without Nifty for Mythruna equals theres no use in aiding people who are using nifty at a larger scale as the OP sounds quite a lot more indifferent than the pointless nitpicking.

How do you think this 10th thread of nifty hate will help the OP? You agree it could be a solution to this issue. Good. I guess I won’t answer GUI or effects threads anymore, people tend to get funny in these.

You said: “Right, the texture coords, I lost you three at the 8th detail of the nifty implementation.”

Then you said: “Still you now misinterpret me talking about Nifty again in the “low level solution” I mentioned,” So I interpreted the beginning possible agreement as sarcasm.

I said: “Everyone in the conversation was talking specifically about the nifty implementation” I’m trying to explain why I thought you were still talking about nifty. Though it’s pretty clear now that you aren’t.

Then you also said: “Nifty could just supply better id-ing for objects on screen that jME is supposed to draw to solve this “coord update problem” if it is one, I bet Jens wouldn’t mind thinking about it. They wouldn’t even have to be collected or anything beyond one frame.”

My item (3) was attempting to address this.

No nifty hate here in this case. There is a way to make this work better but the current interface between nifty and JME is very limiting. I think everyone has to agree on that. I wasn’t being hateful when I suggest that nifty just render to a texture and give it to us. For more than the most simple UIs, it actually gets rid of a whole bunch of problems. It’s overall more efficient, nifty doesn’t pick up our crappy BitmapText oddness, etc… I do wonder where the break even point, is, though. Is it 15 on screen controls or 50?

And this is what spawned the whole “atlas in nifty” discussion in the first place. And that’s when we dove into why it wasn’t a good way. Later misinterpretations or not. I humbly apologize for then assuming we were talking about the OP doing an atlas implementation using nifty… apparently the conversation shifted and I did not shift with it.

@normen said: After looking at the nifty docs, a custom nifty control that uses an atlas of buttons should be a breeze. And you keep the option to have the GUI layout separate as well as exchangeable for different platforms.
@pspeed said: You said: "Right, the texture coords, I lost you three at the 8th detail of the nifty implementation."

Then you said: “Still you now misinterpret me talking about Nifty again in the “low level solution” I mentioned,” So I interpreted the beginning possible agreement as sarcasm.

[snip, from here you further derail it towards nifty-jme micro optimizations]

Aha, okay. I guess just “right” never really sounds like “you’re right” or “thats right” in english then, sorry.

Right is a heavily overloaded term in English :slight_smile:

It has a lot of different meanings and different shades of meaning.