[El Ka-BUG] In-scene geometries and Nifty Text (Label) issue

Not sure if anyone else has noticed this or not… and wasn’t really sure where to start the thread… so here it is:



If a geometry outside of the gui node is close to the camera (how close? not really sure), it renders over Nifty’s text. No other Nifty elements seem to be effected in this way… only Labels. Lemme grab a screen shot at least.







And… there it is.

Hm, you should be able to fix it by extending the near frustum but its kinda silly I agree, I remember I had this with jME2 already though… @Momoko_Fan got any ideas on why the z levels in nifty have to overlap with the scene?

@normen said:
Hm, you should be able to fix it by extending the near frustum but its kinda silly I agree, I remember I had this with jME2 already though.. @Momoko_Fan got any ideas on why the z levels in nifty have to overlap with the scene?


Just a bit more info... this is very recent. I just noticed it today (so in the past week or two at most)

Guess:



The nifty “layer” is not clearing Z or otherwise turning off depth checks.



BitmapText used for the labels is pretty much the only real scene graph object and so is the only one affected by the z buffer.



When I updated JME, I noticed that the tests have geometry that intersects the HUD if you get close enough. I didn’t notice this in Mythruna so just assumed it’s something I did in my local JME changes to support “depth in the guiNode”. But maybe there is more to it. I think nifty comes after the guiNode so if the gui viewport used to clear Z and doesn’t now then that could cause an issue like this.

@t0neg0d said:
Just a bit more info... this is very recent. I just noticed it today (so in the past week or two at most)


Hmm... then my last paragraph may not matter. The other stuff may zero in on the cause.

Never seen this issue, nor can I reproduce it.



Is that a default ChatController or something you wrote up?

Have you tampered with any settings in nifty/gui node?



http://puu.sh/1lLwM

@perfecticus said:
Never seen this issue, nor can I reproduce it.

Is that a default ChatController or something you wrote up?
Have you tampered with any settings in nifty/gui node?

http://puu.sh/1lLwM


Custom control using other standard nifty controls builders/creators... however it affects all Bitmap Text... not just the chat window.
And no to the second question.

Strange indeed, I havnt seen it at all, I can zoom in through objects without seeing that behaviour.

Would be strange if you could set near frustrum in a way that it would affect the gui rendering in my opinion.

Are you using nifty.setautoscale ()? I found there’s a general issue with text not being positioned properly when using a different resolution other than the auto scale base value.

@wezrule said:
Are you using nifty.setautoscale ()? I found there's a general issue with text not being positioned properly when using a different resolution other than the auto scale base value.


I'm not doing any font scaling... if I remember correctly. I believe I created two separate Bitmap Fonts for the two sizes I needed. Should I be calling setsutoscale anyways?
@pspeed said:
Hmm... then my last paragraph may not matter. The other stuff may zero in on the cause.


Actually, I could be mistaken as far as timeline goes. I hadn't really been working much on my game at that time... so there was no real need to do anything with Nifty.

So the hud text gets clipped also?

@pspeed said:
BitmapText used for the labels is pretty much the only real scene graph object and so is the only one affected by the z buffer.


And I was wrong about this. The images, quads, etc. are also real JME objects (quads).

So I have no idea unless the materials are setup differently.... ah, they are. The BitmapText uses plain old Unshaded while everything else in the nifty layer uses an unshaded material with depth test and write turned off. Can't really do that for BitmapText because it gets its material from the font... which is shared.

As a quick and dirty solution... you could try grabbing the gui viewport from RenderManager and setting depth clear to true.
1 Like

Mhh we should do with nifty what we do with the gui bucket and force the depth to 0.



EDIT

maybe something like

[java]

renderer.setDepthRange(0, 0);

…render nifty

renderer.setDepthRange(0, 1);

[/java]

int the postQueue of the NiftyJmeDisplay



EDIT2 : and it also fixes this issue http://hub.jmonkeyengine.org/groups/gui/forum/topic/rendering-problem-with-nifty-and-addititonal-processor/



EDIT3 : I committed the change, i think it’s an ok solution, tell me if it’s ok

1 Like
@nehon said:
Mhh we should do with nifty what we do with the gui bucket and force the depth to 0.

EDIT
maybe something like
[java]
renderer.setDepthRange(0, 0);
..render nifty
renderer.setDepthRange(0, 1);
[/java]
int the postQueue of the NiftyJmeDisplay

EDIT2 : and it also fixes this issue http://hub.jmonkeyengine.org/groups/gui/forum/topic/rendering-problem-with-nifty-and-addititonal-processor/

EDIT3 : I committed the change, i think it's an ok solution, tell me if it's ok


Awesome! As soon as I am able, I'll post feedback. But, I'm fairly confident that this will fix the situation. Thanks in advance!

Pretty much the same as posted here.

@madjack, I didn’t realize this was the same issue (though yours was fixed since a long time though).

Does the fix for this issue fixes yours?

@nehon said:
I didn't realize this was the same issue (though yours was fixed since a long time though).

Maybe someone should tell that to the jME3 code I have here. (Yes. It's up to date and no the issue is still there. If it weren't the case I wouldn't have linked my thread AND I would've change my thread to [SOLVED] AND I wouldn't have posted a week ago asking for an update.)


Does the fix for this issue fixes yours?

I'll have to check on that either today or, most likely, Monday as I only barely read the first couple of message in this thread and replied when I saw it was the same kind of issue I was having.

My apologies @nehon as it seems the issue is indeed fixed.



For some reason the engine’s source files hadn’t been updated… Not sure how that happened but as I updated to day I noticed there was a LOT of files changes which hinted that something had gone wrong before. Maybe I’m just being forgetful, old age and everything.



Anyway. Thanks. (I’ll also post in my original thread)

1 Like

Just checked the result after commenting the “setDepthRender(…)” lines and it seems the issue was fixed by Momoko_Fan’s modification.



Could anyone confirm or is this a different problem?