[SOLVED] Mesh z-order problem in GuiNode

Hello there, I’m trying to render my character’s model to the gui as part of the “equipped items” screen and am getting some z-order problems, but only when the model is rotated at certain angles. When the model faces the camera it looks as it should, from the side it looks as shown below.

The model on the left is a clone that’s been attached to the GuiNode, the right model is attached to the RootNode.


Anyone run into this problem before that might have a pointer in the right direction?

The gui node scales Z to 0… meshes will almost never work right there.

You are better off setting up your own viewport that is adjusted to be guiNode-like but is not actually using the GUI bucket. ie: make it ortho, move it to the appropriate size/location, etc…

You can even do it non-ortho if you like which can be a nice effect in certain cases as things will actually have foreshortening and look different in different places on the screen making it pop a little. In that case, you need only set that viewports camera to the appropriate distance to make 1 unit = 1 pixel.


Although technically would you even need that? I haven’t actually tested this random idea yet, but I figure if you took the usual shader code and axed the camera projection transformation it may give the same effect once you tweak things out. Then you can just attach it to root I guess? There may be some depth issues with stuff drawing over it I suppose and probably some slight fuckery with culling.

You could also just “fake” it and translate a parent node to follow the camera directly in front of you and attach the children to it. The frustrums of the camera should help you with the limits of the screen, basically a “field of view” as it were.

Man, you guys make it sound like setting up another viewport is super hard.

1 Like

@Dave, what is the rest of your GUI made with? Custom or some library?

@pspeed I’m using Nifty right now for most of it.

Thanks for all the ideas and knowledge guys really appreciate it. Also sorry for reviving this dead topic, I just didn’t know how to search properly and after looking further there’s at least 5 other threads. Thanks again though all.

1 Like

grumbles something about open broadcaster errors and other random problems

It’s not hard per-se, just long term problematic for maintenance.

Nah, not really. Certainly 1000x less problematic than forking shaders.

I think if I have time I will post a gui node app state that supports at least perspective… and maybe optionally ortho.


Thanks for the help everyone! I ended up creating another ViewPort and a camera that updates with my characters position, I will manually manage it’s enabled state corresponding with the visibility boolean that nifty provides. Here’s what it looks like :slight_smile:
Also, as a side note, really happy with how this turned out because I was running into some problems already with attaching armor and weapons to the GuiNode through SkeletonControl. Thanks again!