How to add a 3D screen in Nifty?

How would I go about adding a 3d screen in Nifty? I want to show the weapon selected in a small screen (see picture) and make it so it rotates and isn’t just a picture. Is this possible yet? Could I just attach a Node to the guiNode and attach all models to that node?



Imgur

Look at TestNiftyToMesh.java.

I don’t want to put my Nifty menu onto a mesh, I want a mesh to render in a window with Nifty, instead of it just being a picture.

@glaucomardano said:
Look at TestNiftyToMesh.java.

As i get it it's more the other way around

You should take a look at TestRenderToTexture, then use this texture as an image in Nifty

So attach your mesh to the guinode.

Alright, thanks to both, I’ll try both and see what happens. Also, if I attach my mesh to the guiNode, and translate it, it moves by pixels, right? ie, a translation of (1, 1, 1,) would move it 1, 1 ,1 pixel?

Spatials are moved by units. If you wanna move it projectively (screen coordinates) then use cam.getScreenCoordinates(). There are examples for this.

Alright. Actually, it seems the class TestMultiViews.java is exactly what I want. Another screen rendering the 3d object. I’m gonna give that a shot and hope it works.

@vinexgames said:
Alright, thanks to both, I'll try both and see what happens. Also, if I attach my mesh to the guiNode, and translate it, it moves by pixels, right? ie, a translation of (1, 1, 1,) would move it 1, 1 ,1 pixel?

yeah that won't be nice, because the guiNode is rendered in parallel projection, which mean there is no perspective.It can look weird
it seems the class TestMultiViews.java is exactly what I want


What does it have to do :P ?

It just makes another viewport and renders it as a seperate window. Now, to figure out how to make it above Nifty… is there like a Z value of the new viewport I can set higher so it’s seen above the Nifty menu?

Now I’m faced with this problem: How do I get the newly made viewport to show above Nifty? As far as I can tell there’s no way to organize the viewports from front to back. In fact, is it even possible to have 1 viewport overlapping another?

Yes you can. Just play with the view port locations.

EDIT: If you wanna render the nifty viewport above the others, then create a separated viewport to it, and add it after the other ones.

Ooooh, I see. So if I made a viewport and added Nifty to it, THEN added my new viewport, it would render the latest added viewport on top? That makes sense I guess. I’ll give it a try.

Yea. It does. Last weekend @nehon gave a code snippet to a guy with the same question than you.

Awesome, thanks for all the help!

not sure if you seen this yet:



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:multiple_camera_views



cheers…